aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKruti Shah2012-07-10 09:55:55 -0700
committerKruti Shah2012-07-10 09:55:55 -0700
commit7b32af1ebeec13f4186ba0a88a6d33362178d60f (patch)
tree91feeeab486e33937613e6e7d1b11991eee42631
parentba1341b82d51a5380e7dd2dc91aef76caf635e60 (diff)
downloadninja-7b32af1ebeec13f4186ba0a88a6d33362178d60f.tar.gz
Adding Zoom Control to Property Tracks
Signed-off-by: Kruti Shah <kruti.shah@motorola.com>
-rw-r--r--js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js42
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js2
2 files changed, 42 insertions, 2 deletions
diff --git a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
index b2683d30..8c8112ad 100644
--- a/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
+++ b/js/panels/Timeline/PropertyTrack.reel/PropertyTrack.js
@@ -192,6 +192,7 @@ 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 this.eventManager.addEventListener("tlZoomSlider", this, false);
195 } 196 }
196 }, 197 },
197 198
@@ -274,6 +275,45 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
274 } 275 }
275 }, 276 },
276 277
278 handleTlZoomSlider: {
279 value: function(event) {
280
281 var currentMilliSecPerPixel , currentMilliSec , clickPos,thingToPush;
282 var i = 0,
283 tweensLength = this.propTweens.length;
284
285 for (i = 0; i < tweensLength; i++) {
286
287 if (i === 0) {
288 // Exception: 0th item does not depend on anything
289 // If 0th tween is draggable, this will need to be fixed.
290 this.propTweens[i].tweenData.spanWidth=0;
291 this.propTweens[i].tweenData.spanPosition=0;
292 this.propTweens[i].tweenData.keyFramePosition=0;
293 this.propTweens[i].tweenData.keyFrameMillisec=0;
294
295 } else {
296 var prevKeyFramePosition = this.propTweens[i - 1].tweenData.keyFramePosition,
297 myObj = {},
298 thing = {};
299
300 currentMilliSecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
301 currentMilliSec = this.propTweens[i].tweenData.keyFrameMillisec;
302 clickPos = currentMilliSec / currentMilliSecPerPixel;
303
304 for (thing in this.propTweens[i].tweenData) {
305 myObj[thing] = this.propTweens[i].tweenData[thing];
306 }
307 myObj.spanWidth = clickPos - prevKeyFramePosition;
308 myObj.keyFramePosition = clickPos;
309 myObj.spanPosition = clickPos - (clickPos - prevKeyFramePosition);
310
311 this.propTweens[i].tweenData = myObj;
312 }
313 }
314 }
315 },
316
277 /* End: Event Handlers */ 317 /* End: Event Handlers */
278 318
279 /* Begin: Controllers */ 319 /* Begin: Controllers */
@@ -303,7 +343,7 @@ var PropertyTrack = exports.PropertyTrack = Montage.create(Component, {
303 newTween; 343 newTween;
304 344
305 selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 345 selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
306 this.application.ninja.timeline.selectLayer(selectedIndex, true); 346 this.application.ninja.timeline.selectLayers([selectedIndex]);
307 347
308 currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 348 currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
309 currentMillisec = currentMillisecPerPixel * clickPos; 349 currentMillisec = currentMillisecPerPixel * clickPos;
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index f443553c..c9516d1f 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -645,7 +645,7 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
645 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID); 645 var selectedIndex = this.application.ninja.timeline.getLayerIndexByID(this.trackID);
646 // this.application.ninja.timeline.selectLayer(selectedIndex, true); // deprecated 646 // this.application.ninja.timeline.selectLayer(selectedIndex, true); // deprecated
647 this.application.ninja.timeline.selectLayers([selectedIndex]); 647 this.application.ninja.timeline.selectLayers([selectedIndex]);
648 this.application.ninja.timeine.updateStageSelection(); 648 this.application.ninja.timeline.updateStageSelection();
649 if (this.tweens.length < 1) { 649 if (this.tweens.length < 1) {
650 this.insertTween(0); 650 this.insertTween(0);
651 this.addAnimationRuleToElement(ev); 651 this.addAnimationRuleToElement(ev);