diff options
Diffstat (limited to 'js/panels/Timeline/TimelineTrack.reel')
-rw-r--r-- | js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js index 03e3b01e..1e918c6e 100644 --- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js +++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js | |||
@@ -363,6 +363,17 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
363 | this._dragAndDropHelperCoords = newVal; | 363 | this._dragAndDropHelperCoords = newVal; |
364 | } | 364 | } |
365 | }, | 365 | }, |
366 | _draggingIndex: { | ||
367 | value: false | ||
368 | }, | ||
369 | draggingIndex: { | ||
370 | get: function() { | ||
371 | return this._draggingIndex; | ||
372 | }, | ||
373 | set: function(newVal) { | ||
374 | this._draggingIndex = newVal; | ||
375 | } | ||
376 | }, | ||
366 | _dragAndDropHelperOffset : { | 377 | _dragAndDropHelperOffset : { |
367 | value: false | 378 | value: false |
368 | }, | 379 | }, |
@@ -864,32 +875,29 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, { | |||
864 | 875 | ||
865 | //this._dragAndDropHelper.style.width = window.getComputedStyle(this.container_layers, null).getPropertyValue("width"); | 876 | //this._dragAndDropHelper.style.width = window.getComputedStyle(this.container_layers, null).getPropertyValue("width"); |
866 | this._dragAndDropHelper.classList.add("track-dnd-helper"); | 877 | this._dragAndDropHelper.classList.add("track-dnd-helper"); |
867 | 878 | ||
868 | // Get the offset | 879 | if (this.draggingIndex < (this.tweens.length -1)) { |
869 | var findYOffset = function(obj) { | 880 | maxPosition = this.tweenRepetition.childComponents[this.draggingIndex+1].keyFramePosition; |
870 | var curleft = curtop = 0; | ||
871 | |||
872 | if (obj.offsetParent) { | ||
873 | do { | ||
874 | curleft += obj.offsetLeft; | ||
875 | curtop += obj.offsetTop; | ||
876 | |||
877 | } while (obj = obj.offsetParent); | ||
878 | } | ||
879 | return curtop; | ||
880 | } | ||
881 | //this._dragAndDropHelperOffset = findYOffset(this.container_layers); | ||
882 | if (this.draggingIndex !== (this.tweens.length -1)) { | ||
883 | maxPosition = this.tweenRepetition.childComponents[this.draggingIndex +1].keyFramePosition; | ||
884 | } | 881 | } |
885 | if (this.draggingIndex > 1) { | 882 | if (this.draggingIndex > 1) { |
886 | minPosition = this.tweenRepetition.childComponents[this.draggingIndex -1].keyFramePosition; | 883 | minPosition = this.tweenRepetition.childComponents[this.draggingIndex-1].keyFramePosition; |
887 | } | 884 | } |
888 | this._keyframeMinPosition = minPosition+2; | 885 | this._keyframeMinPosition = minPosition+2; |
889 | this._keyframeMaxPosition = maxPosition-9; | 886 | this._keyframeMaxPosition = maxPosition-9; |
890 | this._appendHelper = true; | 887 | this._appendHelper = true; |
891 | this._deleteHelper = false; | 888 | this._deleteHelper = false; |
892 | this.parentComponent.parentComponent.draggingTrackId = this.trackID; | 889 | |
890 | // Get my index in the track array | ||
891 | var i = 0, | ||
892 | arrLayersLength = this.parentComponent.parentComponent.arrLayers.length, | ||
893 | myId = null; | ||
894 | for (i = 0; i < arrLayersLength; i++) { | ||
895 | var currUuid = this.parentComponent.parentComponent.trackRepetition.childComponents[i].uuid; | ||
896 | if ( currUuid === this.uuid) { | ||
897 | myId = i; | ||
898 | } | ||
899 | } | ||
900 | this.parentComponent.parentComponent.draggingTrackId = myId; | ||
893 | this.parentComponent.parentComponent.draggingType = "keyframe"; | 901 | this.parentComponent.parentComponent.draggingType = "keyframe"; |
894 | } | 902 | } |
895 | }, | 903 | }, |