diff options
Diffstat (limited to 'js/panels/Timeline/Keyframe.reel/Keyframe.js')
-rw-r--r-- | js/panels/Timeline/Keyframe.reel/Keyframe.js | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index 859cdfb1..52302319 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js | |||
@@ -31,12 +31,18 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
31 | prepareForDraw:{ | 31 | prepareForDraw:{ |
32 | value:function(){ | 32 | value:function(){ |
33 | this.element.addEventListener("click", this, false); | 33 | this.element.addEventListener("click", this, false); |
34 | |||
35 | // Drag and drop event handlers | ||
36 | this.element.addEventListener("mouseover", this.handleMouseover.bind(this), false); | ||
37 | this.element.addEventListener("mouseout", this.handleMouseout.bind(this), false); | ||
38 | this.element.addEventListener("dragstart", this.handleDragstart.bind(this), false); | ||
39 | this.element.addEventListener("dragend", this.handleDragend.bind(this), false); | ||
34 | } | 40 | } |
35 | }, | 41 | }, |
36 | 42 | ||
37 | draw:{ | 43 | draw:{ |
38 | value:function(){ | 44 | value:function(){ |
39 | this.element.style.left = (this.position - 3) + "px"; | 45 | this.element.style.left = (this.position - 6) + "px"; |
40 | } | 46 | } |
41 | }, | 47 | }, |
42 | 48 | ||
@@ -56,6 +62,41 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
56 | handleClick:{ | 62 | handleClick:{ |
57 | value:function(ev){ | 63 | value:function(ev){ |
58 | this.selectKeyframe(); | 64 | this.selectKeyframe(); |
65 | ev.stopPropagation(); | ||
59 | } | 66 | } |
60 | } | 67 | }, |
68 | |||
69 | handleMouseover: { | ||
70 | value: function(event) { | ||
71 | this.element.draggable = true; | ||
72 | } | ||
73 | }, | ||
74 | handleMouseout: { | ||
75 | value: function(event) { | ||
76 | this.element.draggable = false; | ||
77 | } | ||
78 | }, | ||
79 | handleDragstart: { | ||
80 | value: function(event) { | ||
81 | //this.parentComponent.parentComponent.dragLayerID = this.layerID; | ||
82 | event.dataTransfer.setData('Text', 'Keyframe'); | ||
83 | |||
84 | // Get my index in my track's tween array | ||
85 | var i = 0, | ||
86 | tweenRepetitionLength = this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents.length, | ||
87 | myIndex = null; | ||
88 | for (i = 0; i < tweenRepetitionLength; i++) { | ||
89 | if (this.parentComponent.parentComponent.parentComponent.tweenRepetition.childComponents[i].uuid === this.parentComponent.uuid) { | ||
90 | myIndex = i; | ||
91 | } | ||
92 | } | ||
93 | this.parentComponent.parentComponent.parentComponent.draggingIndex = myIndex; | ||
94 | } | ||
95 | }, | ||
96 | handleDragend: { | ||
97 | value: function(event) { | ||
98 | this.parentComponent.isDragging = false; | ||
99 | } | ||
100 | } | ||
101 | |||
61 | }); | 102 | }); |