diff options
Diffstat (limited to 'js/panels/Timeline/Keyframe.reel')
-rw-r--r-- | js/panels/Timeline/Keyframe.reel/Keyframe.js | 31 | ||||
-rw-r--r-- | js/panels/Timeline/Keyframe.reel/css/Keyframe.css | 8 |
2 files changed, 24 insertions, 15 deletions
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js index 1259fa63..b6623dcd 100644 --- a/js/panels/Timeline/Keyframe.reel/Keyframe.js +++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js | |||
@@ -1,5 +1,6 @@ | |||
1 | var Montage = require("montage/core/core").Montage; | 1 | var Montage = require("montage/core/core").Montage; |
2 | var Component = require("montage/ui/component").Component; | 2 | var Component = require("montage/ui/component").Component; |
3 | var ElementsMediator = require("js/mediators/element-mediator").ElementMediator; | ||
3 | 4 | ||
4 | var Keyframe = exports.Keyframe = Montage.create(Component, { | 5 | var Keyframe = exports.Keyframe = Montage.create(Component, { |
5 | 6 | ||
@@ -77,11 +78,16 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
77 | } | 78 | } |
78 | }, | 79 | }, |
79 | 80 | ||
81 | containingSpan:{ | ||
82 | value: null | ||
83 | }, | ||
84 | |||
80 | prepareForDraw:{ | 85 | prepareForDraw:{ |
81 | value:function(){ | 86 | value:function(){ |
82 | this.tweenkeyframe.addEventListener("click", this, false); | 87 | this.tweenkeyframe.addEventListener("click", this, false); |
83 | this.animatedProperties = new Array(); | 88 | this.animatedProperties = new Array(); |
84 | 89 | ||
90 | // should element mediator be used here? | ||
85 | this.animatedProperties["top"] = this.containingTrack.animatedElement.offsetTop; | 91 | this.animatedProperties["top"] = this.containingTrack.animatedElement.offsetTop; |
86 | this.animatedProperties["left"] = this.containingTrack.animatedElement.offsetLeft; | 92 | this.animatedProperties["left"] = this.containingTrack.animatedElement.offsetLeft; |
87 | } | 93 | } |
@@ -89,26 +95,25 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
89 | 95 | ||
90 | draw:{ | 96 | draw:{ |
91 | value:function(){ | 97 | value:function(){ |
92 | this.tweenkeyframe.style.left = (this.position - 2) + "px"; | 98 | this.tweenkeyframe.style.left = (this.position - 3) + "px"; |
93 | } | 99 | } |
94 | }, | 100 | }, |
95 | 101 | ||
96 | handleElementChange:{ | 102 | handleElementChange:{ |
97 | value:function (event) { | 103 | value:function (event) { |
98 | 104 | ||
99 | if(event.detail.source && event.detail.source !== "pi") { | 105 | if(event.detail.source && event.detail.source !== "keyframe") { |
100 | 106 | ||
101 | var items = this.application.ninja.selectedElements; | 107 | var items = this.application.ninja.selectedElements; |
102 | 108 | this.containingSpan.highlightSpan(); | |
103 | // update this keyframe's animated properties from the item[0] element props | 109 | if(items[0]._element.offsetTop != this.animatedProperties["top"] && items[0]._element.offsetLeft != this.animatedProperties["left"]){ |
104 | this.animatedProperties["top"] = items[0]._element.offsetTop; | 110 | // update this keyframe's animated properties from the item[0] element props |
105 | this.animatedProperties["left"] = items[0]._element.offsetLeft; | 111 | this.animatedProperties["top"] = items[0]._element.offsetTop; |
106 | this.containingTrack.keyFramePropertyData[this.id] = this.animatedProperties; | 112 | this.animatedProperties["left"] = items[0]._element.offsetLeft; |
107 | 113 | this.containingTrack.keyFramePropertyData[this.id] = this.animatedProperties; | |
108 | this.containingTrack.updateKeyframeRule(); | 114 | this.containingTrack.updateKeyframeRule(); |
115 | } | ||
109 | } | 116 | } |
110 | |||
111 | |||
112 | } | 117 | } |
113 | }, | 118 | }, |
114 | 119 | ||
@@ -131,8 +136,8 @@ var Keyframe = exports.Keyframe = Montage.create(Component, { | |||
131 | var currentTop = this.animatedProperties["top"] + "px"; | 136 | var currentTop = this.animatedProperties["top"] + "px"; |
132 | var currentLeft = this.animatedProperties["left"] + "px"; | 137 | var currentLeft = this.animatedProperties["left"] + "px"; |
133 | 138 | ||
134 | this.containingTrack.ninjaStylesContoller.setElementStyle(this.containingTrack.animatedElement, "top", currentTop); | 139 | ElementsMediator.setProperty([this.containingTrack.animatedElement], "top", [currentTop], "Change", "keyframe"); |
135 | this.containingTrack.ninjaStylesContoller.setElementStyle(this.containingTrack.animatedElement, "left", currentLeft); | 140 | ElementsMediator.setProperty([this.containingTrack.animatedElement], "left", [currentLeft], "Change", "keyframe"); |
136 | 141 | ||
137 | // turn on element change event listener | 142 | // turn on element change event listener |
138 | this.eventManager.addEventListener("elementChange", this, false); | 143 | this.eventManager.addEventListener("elementChange", this, false); |
diff --git a/js/panels/Timeline/Keyframe.reel/css/Keyframe.css b/js/panels/Timeline/Keyframe.reel/css/Keyframe.css index e66bcf10..4afc1180 100644 --- a/js/panels/Timeline/Keyframe.reel/css/Keyframe.css +++ b/js/panels/Timeline/Keyframe.reel/css/Keyframe.css | |||
@@ -1,11 +1,15 @@ | |||
1 | .tween_keyframe{ | 1 | .tween_keyframe{ |
2 | position: absolute; | 2 | position: absolute; |
3 | height: 16px; | 3 | height: 16px; |
4 | width: 4px; | 4 | width: 5px; |
5 | background-color: white; | 5 | background-color: white; |
6 | z-index: 23; | 6 | z-index: 23; |
7 | border-radius: 3px; | ||
7 | } | 8 | } |
8 | 9 | ||
9 | .tween_keyframe.keyframeSelected{ | 10 | .tween_keyframe.keyframeSelected{ |
10 | background-color: blue; | 11 | background-color: #570e19; |
12 | border-style: solid; | ||
13 | border-width: thin; | ||
14 | border-color: #d6d1cf; | ||
11 | } \ No newline at end of file | 15 | } \ No newline at end of file |