aboutsummaryrefslogtreecommitdiff
path: root/js/panels
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels')
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js78
-rwxr-xr-xjs/panels/properties/content.reel/content.js15
2 files changed, 57 insertions, 36 deletions
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index fddfd170..61da9e36 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -358,9 +358,11 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
358 358
359 didDraw:{ 359 didDraw:{
360 value:function () { 360 value:function () {
361 if (this._openDocRedrawCheck) { 361 if(this.application.ninja.currentDocument.documentRoot.children[0]){
362 this.retrieveStoredTweens(); 362 if (this._openDocRedrawCheck) {
363 this._openDocRedrawCheck = false; 363 this.retrieveStoredTweens();
364 this._openDocRedrawCheck = false;
365 }
364 } 366 }
365 } 367 }
366 }, 368 },
@@ -459,42 +461,48 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
459 this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0]; 461 this.animatedElement = this.application.ninja.timeline.arrLayers[this.trackID - 1].elementsList[0];
460 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name"); 462 this.animationName = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-name");
461 this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration"); 463 this.animationDuration = this.application.ninja.stylesController.getElementStyle(this.animatedElement, "-webkit-animation-duration");
462 this.trackDuration = this.animationDuration.split("s"); 464 if(this.animationDuration){
463 this.currentMilliSec = this.trackDuration[0] * 1000; 465 this.trackDuration = this.animationDuration.split("s");
464 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 466 this.currentMilliSec = this.trackDuration[0] * 1000;
465 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 467 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
466 this.nextKeyframe = 0; 468 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
467 469 this.nextKeyframe = 0;
468 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); 470
469 while (this.currentKeyframeRule[i]) { 471 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
470 var newTween = {}; 472 while (this.currentKeyframeRule[i]) {
471 if (this.currentKeyframeRule[i].keyText === "0%") { 473 var newTween = {};
472 newTween.spanWidth = 0; 474
473 newTween.keyFramePosition = 0; 475 if (this.currentKeyframeRule[i].keyText === "0%") {
474 newTween.keyFrameMillisec = 0; 476 newTween.spanWidth = 0;
475 newTween.tweenID = 0; 477 newTween.keyFramePosition = 0;
476 newTween.spanPosition = 0; 478 newTween.keyFrameMillisec = 0;
477 this.tweens.push(newTween); 479 newTween.tweenID = 0;
480 newTween.spanPosition = 0;
481 this.tweens.push(newTween);
478 482
479 } 483 }
480 else { 484 else {
481 percentValue = this.currentKeyframeRule[i].keyText; 485 percentValue = this.currentKeyframeRule[i].keyText;
482 splitValue = percentValue.split("%"); 486 splitValue = percentValue.split("%");
483 fraction = splitValue[0] / 100; 487 fraction = splitValue[0] / 100;
484 this.currentMilliSec = fraction * this.trackDuration[0] * 1000; 488 this.currentMilliSec = fraction * this.trackDuration[0] * 1000;
485 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 489 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
486 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 490 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
487 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; 491 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition;
488 newTween.keyFramePosition = this.clickPos; 492 newTween.keyFramePosition = this.clickPos;
489 newTween.keyFrameMillisec = this.currentMilliSec; 493 newTween.keyFrameMillisec = this.currentMilliSec;
490 newTween.tweenID = this.nextKeyframe; 494 newTween.tweenID = this.nextKeyframe;
491 newTween.spanPosition = this.clickPos - newTween.spanWidth; 495 newTween.spanPosition = this.clickPos - newTween.spanWidth;
492 this.tweens.push(newTween); 496 this.tweens.push(newTween);
493 497
494 498
499 }
500 i++;
501 this.nextKeyframe += 1;
495 } 502 }
496 i++; 503 }
497 this.nextKeyframe += 1; 504 else{
505 return;
498 } 506 }
499 } 507 }
500 }, 508 },
diff --git a/js/panels/properties/content.reel/content.js b/js/panels/properties/content.reel/content.js
index 9b6416c7..8fa33a75 100755
--- a/js/panels/properties/content.reel/content.js
+++ b/js/panels/properties/content.reel/content.js
@@ -255,6 +255,12 @@ exports.Content = Montage.create(Component, {
255 255
256 if(currentValue) 256 if(currentValue)
257 { 257 {
258 if(currentValue.color)
259 {
260 currentValue.color.wasSetByCode = true;
261 currentValue.color.type = "change";
262 }
263
258 if(currentValue.mode === "gradient") 264 if(currentValue.mode === "gradient")
259 { 265 {
260 this.application.ninja.colorController.colorModel["gradient"] = 266 this.application.ninja.colorController.colorModel["gradient"] =
@@ -267,7 +273,14 @@ exports.Content = Montage.create(Component, {
267 this.application.ninja.colorController.colorModel.alpha = 273 this.application.ninja.colorController.colorModel.alpha =
268 {value: currentValue.color.a, wasSetByCode: true, type: 'change'}; 274 {value: currentValue.color.a, wasSetByCode: true, type: 'change'};
269 } 275 }
270 this.application.ninja.colorController.colorModel[currentValue.color.mode] = currentValue.color; 276 if(currentValue.color.mode)
277 {
278 this.application.ninja.colorController.colorModel[currentValue.color.mode] = currentValue.color;
279 }
280 else
281 {
282 this.application.ninja.colorController.colorModel["rgb"] = currentValue.color;
283 }
271 } 284 }
272 } 285 }
273 else 286 else