aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Reid2012-07-16 09:20:10 -0700
committerJon Reid2012-07-16 09:20:10 -0700
commit15edcb5fe22793aab024c1ef7dde109b36977dd8 (patch)
tree48d884ad0a48ac5dabf9acfcb844a9dbe63bec28
parent3bea1cb3fb53bac17daa31f4b5cf561fbd040dda (diff)
downloadninja-15edcb5fe22793aab024c1ef7dde109b36977dd8.tar.gz
Timeline: Disable drag-and-drop on subproperty keyframes. Better error
handling. Fix some minor bugs.
-rw-r--r--js/panels/Timeline/Keyframe.reel/Keyframe.js13
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js12
-rw-r--r--js/panels/Timeline/Style.reel/Style.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js9
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js2
5 files changed, 24 insertions, 14 deletions
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js
index a52150af..b771f6f3 100644
--- a/js/panels/Timeline/Keyframe.reel/Keyframe.js
+++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js
@@ -119,14 +119,21 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
119 value: function(event) { 119 value: function(event) {
120 event.dataTransfer.setData('Text', 'Keyframe'); 120 event.dataTransfer.setData('Text', 'Keyframe');
121 var i = 0, 121 var i = 0,
122 tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, 122 tweenRepetitionLength,
123 myTrack,
123 myIndex = null; 124 myIndex = null;
125 if (typeof(this.parentComponent.parentComponent.parentComponent.tweenRepetition) !== "undefined") {
126 myTrack = this.parentComponent.parentComponent.parentComponent;
127 } else {
128 myTrack = this.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent.parentComponent;
129 }
130 tweenRepetitionLength = myTrack.tweenRepetition.childComponents.length;
124 for (i = 0; i < tweenRepetitionLength; i++) { 131 for (i = 0; i < tweenRepetitionLength; i++) {
125 if (this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) { 132 if (myTrack.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) {
126 myIndex = i; 133 myIndex = i;
127 } 134 }
128 } 135 }
129 this.parentComponent.parentComponent.parentComponent.draggingIndex = myIndex; 136 myTrack.draggingIndex = myIndex;
130 this.selectKeyframe(); 137 this.selectKeyframe();
131 } 138 }
132 }, 139 },
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index 12e87636..9ee9b922 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -192,6 +192,11 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
192 this.trackID = this.timelineTrack.trackID; 192 this.trackID = this.timelineTrack.trackID;
193 this.animatedElement = this.timelineTrack.animatedElement; 193 this.animatedElement = this.timelineTrack.animatedElement;
194 this.ninjaStylesContoller = this.application.ninja.stylesController; 194 this.ninjaStylesContoller = this.application.ninja.stylesController;
195
196 // Drag and Drop event handlers
197 this.element.addEventListener("dragstart", this.handleKeyframeDragstart.bind(this), false);
198 this.element.addEventListener("dragend", this.handleKeyframeDragstart.bind(this), false);
199 this.element.addEventListener("drop", this.handleKeyframeDragstart.bind(this), false);
195 } 200 }
196 }, 201 },
197 202
@@ -206,6 +211,13 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
206 /* End: Draw Cycle */ 211 /* End: Draw Cycle */
207 212
208 /* Begin: Event Handlers */ 213 /* Begin: Event Handlers */
214
215 handleKeyframeDragstart: {
216 value: function(event) {
217 event.stopPropagation();
218 return false;
219 }
220 },
209 221
210 handleClick:{ 222 handleClick:{
211 value:function (ev) { 223 value:function (ev) {
diff --git a/js/panels/Timeline/Style.reel/Style.js b/js/panels/Timeline/Style.reel/Style.js
index dc159a01..930e1281 100644
--- a/js/panels/Timeline/Style.reel/Style.js
+++ b/js/panels/Timeline/Style.reel/Style.js
@@ -232,7 +232,7 @@ var LayerStyle = exports.LayerStyle = Montage.create(Component, {
232 set: function(newVal) { 232 set: function(newVal) {
233 if (this._whichView !== newVal) { 233 if (this._whichView !== newVal) {
234 if ((newVal !== "hintable") && (newVal !== "propval")) { 234 if ((newVal !== "hintable") && (newVal !== "propval")) {
235 this.log("Error: Unknown view -"+newVal+"- requested for style.js."); 235 console.log("Error: Unknown view -"+newVal+"- requested for style.js.");
236 return; 236 return;
237 } 237 }
238 this._whichView = newVal; 238 this._whichView = newVal;
diff --git a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
index 93b4d67e..c790466c 100644
--- a/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
+++ b/js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js
@@ -979,9 +979,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
979 this.layout_tracks = this.element.querySelector(".layout-tracks"); 979 this.layout_tracks = this.element.querySelector(".layout-tracks");
980 this.layout_markers = this.element.querySelector(".layout_markers"); 980 this.layout_markers = this.element.querySelector(".layout_markers");
981 981
982 // Bind the event handler for the document close events
983 this.eventManager.addEventListener("closeDocument", this.handleDocumentChange.bind(this), false);
984
985 // Bind drag and drop event handlers 982 // Bind drag and drop event handlers
986 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false); 983 this.container_layers.addEventListener("dragstart", this.handleLayerDragStart.bind(this), false);
987 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false); 984 this.container_layers.addEventListener("dragend", this.handleLayerDragEnd.bind(this), false);
@@ -1628,12 +1625,6 @@ var TimelinePanel = exports.TimelinePanel = Montage.create(Component, {
1628 } 1625 }
1629 }, 1626 },
1630 1627
1631 handleDocumentChange:{
1632 value:function () {
1633
1634 }
1635 },
1636
1637 handlePlayButtonClick:{ 1628 handlePlayButtonClick:{
1638 value:function(ev){ 1629 value:function(ev){
1639 this.application.ninja.appModel.livePreview = !this.application.ninja.appModel.livePreview; 1630 this.application.ninja.appModel.livePreview = !this.application.ninja.appModel.livePreview;
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index c9516d1f..e6d9165a 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -699,7 +699,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
699 this._dragAndDropHelper.style.opacity = 0.8; 699 this._dragAndDropHelper.style.opacity = 0.8;
700 this._dragAndDropHelper.style.position = "absolute"; 700 this._dragAndDropHelper.style.position = "absolute";
701 this._dragAndDropHelper.style.top = "5px"; 701 this._dragAndDropHelper.style.top = "5px";
702 this._dragAndDropHelper.style.left = "0px"; 702 this._dragAndDropHelper.style.left = event.target.style.left;
703 this._dragAndDropHelper.style.zIndex = 700; 703 this._dragAndDropHelper.style.zIndex = 700;
704 this._dragAndDropHelper.classList.add("keyframeSelected"); 704 this._dragAndDropHelper.classList.add("keyframeSelected");
705 this._dragAndDropHelper.classList.add("track-dnd-helper"); 705 this._dragAndDropHelper.classList.add("track-dnd-helper");