aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-05-08 11:48:29 -0700
committerJon Reid2012-05-08 11:48:29 -0700
commit307d339e45b209dab80ff88196a9f85f8d58f425 (patch)
treeca15b20cd8053ef9525c4b788bd1ac07e9adba56 /js
parent4ef8ec674695fb60c9ef6668206243471a0fe347 (diff)
downloadninja-307d339e45b209dab80ff88196a9f85f8d58f425.tar.gz
Timeline: Update drag and drop handlers to be unique for drag and drop type.
Diffstat (limited to 'js')
-rw-r--r--js/panels/Timeline/Layer.reel/Layer.js10
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js26
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
3 files changed, 40 insertions, 0 deletions
diff --git a/js/panels/Timeline/Layer.reel/Layer.js b/js/panels/Timeline/Layer.reel/Layer.js
index 34c300df..c213cb70 100644
--- a/js/panels/Timeline/Layer.reel/Layer.js
+++ b/js/panels/Timeline/Layer.reel/Layer.js
@@ -868,6 +868,9 @@ var Layer = exports.Layer = Montage.create(Component, {
868 }, 868 },
869 handleDragleave: { 869 handleDragleave: {
870 value: function(event) { 870 value: function(event) {
871 if (this.parentComponent.parentComponent.draggingType !== "layer") {
872 return;
873 }
871 this.element.classList.remove("dragOver"); 874 this.element.classList.remove("dragOver");
872 } 875 }
873 }, 876 },
@@ -875,10 +878,14 @@ var Layer = exports.Layer = Montage.create(Component, {
875 value: function(event) { 878 value: function(event) {
876 this.parentComponent.parentComponent.dragLayerID = this.layerID; 879 this.parentComponent.parentComponent.dragLayerID = this.layerID;
877 event.dataTransfer.setData('Text', 'Layer'); 880 event.dataTransfer.setData('Text', 'Layer');
881 this.parentComponent.parentComponent.draggingType = "layer";
878 } 882 }
879 }, 883 },
880 handleDragover: { 884 handleDragover: {
881 value: function(event) { 885 value: function(event) {
886 if (this.parentComponent.parentComponent.draggingType !== "layer") {
887 return;
888 }
882 event.preventDefault(); 889 event.preventDefault();
883 this.element.classList.add("dragOver"); 890 this.element.classList.add("dragOver");
884 event.dataTransfer.dropEffect = "move"; 891 event.dataTransfer.dropEffect = "move";
@@ -888,6 +895,9 @@ var Layer = exports.Layer = Montage.create(Component, {
888 895
889 handleDrop : { 896 handleDrop : {
890 value: function(event) { 897 value: function(event) {
898 if (this.parentComponent.parentComponent.draggingType !== "layer") {
899 return;
900 }
891 event.stopPropagation(); 901 event.stopPropagation();
892 this.element.classList.remove("dragOver"); 902 this.element.classList.remove("dragOver");
893 if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) { 903 if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) {
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 4b82814b..41472359 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -273,6 +273,17 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
273 _dragLayerID : { 273 _dragLayerID : {
274 value: null 274 value: null
275 }, 275 },
276 _draggingType: {
277 value: false
278 },
279 draggingType: {
280 get: function() {
281 return this._draggingType;
282 },
283 set: function(newVal) {
284 this._draggingType = newVal;
285 }
286 },
276 287
277 layersDragged:{ 288 layersDragged:{
278 value:[], 289 value:[],
@@ -1499,6 +1510,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1499 }, 1510 },
1500 handleLayerDragover: { 1511 handleLayerDragover: {
1501 value: function(event) { 1512 value: function(event) {
1513 if (this.draggingType !== "layer") {
1514 return;
1515 }
1502 var currPos = 0, 1516 var currPos = 0,
1503 myScrollTest = ((event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)) + 28) - this.user_layers.scrollTop; 1517 myScrollTest = ((event.y - (this._dragAndDropHelperOffset - this.user_layers.scrollTop)) + 28) - this.user_layers.scrollTop;
1504 if ((myScrollTest < 60) && (this.user_layers.scrollTop >0)) { 1518 if ((myScrollTest < 60) && (this.user_layers.scrollTop >0)) {
@@ -1521,6 +1535,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1521 }, 1535 },
1522 handleLayerDragEnd : { 1536 handleLayerDragEnd : {
1523 value: function(event) { 1537 value: function(event) {
1538 if (this.draggingType !== "layer") {
1539 return;
1540 }
1524 this._deleteHelper = true; 1541 this._deleteHelper = true;
1525 this.needsDraw = true; 1542 this.needsDraw = true;
1526 1543
@@ -1528,6 +1545,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1528 }, 1545 },
1529 handleLayerDrop : { 1546 handleLayerDrop : {
1530 value: function(event) { 1547 value: function(event) {
1548 if (this.draggingType !== "layer") {
1549 return;
1550 }
1531 event.stopPropagation(); 1551 event.stopPropagation();
1532 event.preventDefault(); 1552 event.preventDefault();
1533 this._deleteHelper = true; 1553 this._deleteHelper = true;
@@ -1538,6 +1558,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1538 // Keyframe drag-and-drop 1558 // Keyframe drag-and-drop
1539 handleKeyframeDragover: { 1559 handleKeyframeDragover: {
1540 value: function(event) { 1560 value: function(event) {
1561 if (this.draggingType !== "keyframe") {
1562 return;
1563 }
1541 event.preventDefault(); 1564 event.preventDefault();
1542 var currPos = 0; 1565 var currPos = 0;
1543 /* 1566 /*
@@ -1574,6 +1597,9 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1574 }, 1597 },
1575 handleKeyframeDrop: { 1598 handleKeyframeDrop: {
1576 value: function(event) { 1599 value: function(event) {
1600 if (this.draggingType !== "keyframe") {
1601 return;
1602 }
1577 event.stopPropagation(); 1603 event.stopPropagation();
1578 //this.element.classList.remove("dragOver"); 1604 //this.element.classList.remove("dragOver");
1579 //if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) { 1605 //if (this.parentComponent.parentComponent.dragLayerID !== this.layerID) {
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 76d52036..03e3b01e 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -890,10 +890,14 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
890 this._appendHelper = true; 890 this._appendHelper = true;
891 this._deleteHelper = false; 891 this._deleteHelper = false;
892 this.parentComponent.parentComponent.draggingTrackId = this.trackID; 892 this.parentComponent.parentComponent.draggingTrackId = this.trackID;
893 this.parentComponent.parentComponent.draggingType = "keyframe";
893 } 894 }
894 }, 895 },
895 handleKeyframeDragend : { 896 handleKeyframeDragend : {
896 value: function(event) { 897 value: function(event) {
898 if (this.parentComponent.parentComponent.draggingType !== "keyframe") {
899 return;
900 }
897 this._deleteHelper = true; 901 this._deleteHelper = true;
898 this.needsDraw = true; 902 this.needsDraw = true;
899 903