aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Duran2012-02-06 19:27:53 -0800
committerJonathan Duran2012-02-06 19:27:53 -0800
commit7e83bb2ac681eb1340dea0f6efaaddfcf0f2b52a (patch)
tree6e969074e03447ac3f36b0715bd0e671b5742240
parent7a3af25c3d54fc980fd85b77f5da509d288efb44 (diff)
downloadninja-7e83bb2ac681eb1340dea0f6efaaddfcf0f2b52a.tar.gz
Change keyframe to use element mediator when repositioning animated elements on stage
Signed-off-by: Jonathan Duran <jduran@motorola.com>
-rw-r--r--js/panels/Timeline/Keyframe.reel/Keyframe.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/js/panels/Timeline/Keyframe.reel/Keyframe.js b/js/panels/Timeline/Keyframe.reel/Keyframe.js
index 1259fa63..4bb73514 100644
--- a/js/panels/Timeline/Keyframe.reel/Keyframe.js
+++ b/js/panels/Timeline/Keyframe.reel/Keyframe.js
@@ -1,5 +1,6 @@
1var Montage = require("montage/core/core").Montage; 1var Montage = require("montage/core/core").Montage;
2var Component = require("montage/ui/component").Component; 2var Component = require("montage/ui/component").Component;
3var ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
3 4
4var Keyframe = exports.Keyframe = Montage.create(Component, { 5var Keyframe = exports.Keyframe = Montage.create(Component, {
5 6
@@ -82,6 +83,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
82 this.tweenkeyframe.addEventListener("click", this, false); 83 this.tweenkeyframe.addEventListener("click", this, false);
83 this.animatedProperties = new Array(); 84 this.animatedProperties = new Array();
84 85
86 // should element mediator be used here?
85 this.animatedProperties["top"] = this.containingTrack.animatedElement.offsetTop; 87 this.animatedProperties["top"] = this.containingTrack.animatedElement.offsetTop;
86 this.animatedProperties["left"] = this.containingTrack.animatedElement.offsetLeft; 88 this.animatedProperties["left"] = this.containingTrack.animatedElement.offsetLeft;
87 } 89 }
@@ -96,7 +98,7 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
96 handleElementChange:{ 98 handleElementChange:{
97 value:function (event) { 99 value:function (event) {
98 100
99 if(event.detail.source && event.detail.source !== "pi") { 101 if(event.detail.source && event.detail.source !== "keyframe") {
100 102
101 var items = this.application.ninja.selectedElements; 103 var items = this.application.ninja.selectedElements;
102 104
@@ -131,8 +133,8 @@ var Keyframe = exports.Keyframe = Montage.create(Component, {
131 var currentTop = this.animatedProperties["top"] + "px"; 133 var currentTop = this.animatedProperties["top"] + "px";
132 var currentLeft = this.animatedProperties["left"] + "px"; 134 var currentLeft = this.animatedProperties["left"] + "px";
133 135
134 this.containingTrack.ninjaStylesContoller.setElementStyle(this.containingTrack.animatedElement, "top", currentTop); 136 ElementsMediator.setProperty([this.containingTrack.animatedElement], "top", [currentTop], "Change", "keyframe");
135 this.containingTrack.ninjaStylesContoller.setElementStyle(this.containingTrack.animatedElement, "left", currentLeft); 137 ElementsMediator.setProperty([this.containingTrack.animatedElement], "left", [currentLeft], "Change", "keyframe");
136 138
137 // turn on element change event listener 139 // turn on element change event listener
138 this.eventManager.addEventListener("elementChange", this, false); 140 this.eventManager.addEventListener("elementChange", this, false);