aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJon Reid2012-02-23 17:10:08 -0800
committerJon Reid2012-02-23 17:10:08 -0800
commit5570a42a3220a14a614b6dd52fe530e8f436c8b0 (patch)
treee368f458b89dc20b25a6f09157a3c9ab62307257 /js
parent0b18fb2fef124a26204d5dba90cd82c975b69df3 (diff)
parentdb2fd02a1b0e909bb536fa63cefd2144f4642ead (diff)
downloadninja-5570a42a3220a14a614b6dd52fe530e8f436c8b0.tar.gz
Merge remote-tracking branch 'ninja-internal/master' into Timeline-local
Conflicts: js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js9
-rwxr-xr-xjs/mediators/keyboard-mediator.js6
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js84
-rwxr-xr-xjs/panels/properties/content.reel/content.js15
4 files changed, 70 insertions, 44 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index fa611de4..1c9d9d59 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -84,8 +84,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
84 // 84 //
85 handleAppLoaded: { 85 handleAppLoaded: {
86 value: function() { 86 value: function() {
87 //Adding an intercept to resources loaded to ensure user assets load from cloud simulator 87 //Checking for app to be loaded through extension
88 if (window.chrome.app.isInstalled) { 88 var check;
89 if (chrome && chrome.app) {
90 check = chrome.app.getDetails();
91 }
92 if (check !== null) {
93 //Adding an intercept to resources loaded to ensure user assets load from cloud simulator
89 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]); 94 chrome.webRequest.onBeforeRequest.addListener(this.handleWebRequest.bind(this), {urls: ["<all_urls>"]}, ["blocking"]);
90 } 95 }
91 } 96 }
diff --git a/js/mediators/keyboard-mediator.js b/js/mediators/keyboard-mediator.js
index 0282060f..a4bf9baa 100755
--- a/js/mediators/keyboard-mediator.js
+++ b/js/mediators/keyboard-mediator.js
@@ -162,15 +162,17 @@ exports.KeyboardMediator = Montage.create(Component, {
162 return; 162 return;
163 } 163 }
164 164
165 // Hand tool
165 if(evt.keyCode === Keyboard.H ) { 166 if(evt.keyCode === Keyboard.H ) {
166 evt.preventDefault(); 167 evt.preventDefault();
167 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[15]}); 168 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[13]});
168 return; 169 return;
169 } 170 }
170 171
172 // Zoom tool
171 if(evt.keyCode === Keyboard.Z ) { 173 if(evt.keyCode === Keyboard.Z ) {
172 evt.preventDefault(); 174 evt.preventDefault();
173 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[16]}); 175 this.application.ninja.handleSelectTool({"detail": this.application.ninja.toolsData.defaultToolsData[14]});
174 return; 176 return;
175 } 177 }
176 178
diff --git a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
index 67dbbced..fd06371f 100644
--- a/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
+++ b/js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js
@@ -358,12 +358,12 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
358 358
359 didDraw:{ 359 didDraw:{
360 value:function () { 360 value:function () {
361 if(this.application.ninja.currentDocument.documentRoot.children[0]){ 361 if(this.application.ninja.currentDocument.documentRoot.children[0]){
362 if (this._openDocRedrawCheck) { 362 if (this._openDocRedrawCheck) {
363 this.retrieveStoredTweens(); 363 this.retrieveStoredTweens();
364 this._openDocRedrawCheck = false; 364 this._openDocRedrawCheck = false;
365 } 365 }
366 } 366 }
367 } 367 }
368 }, 368 },
369 369
@@ -461,42 +461,48 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
461 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];
462 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");
463 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");
464 this.trackDuration = this.animationDuration.split("s"); 464 if(this.animationDuration){
465 this.currentMilliSec = this.trackDuration[0] * 1000; 465 this.trackDuration = this.animationDuration.split("s");
466 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 466 this.currentMilliSec = this.trackDuration[0] * 1000;
467 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 467 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
468 this.nextKeyframe = 0; 468 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
469 469 this.nextKeyframe = 0;
470 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document); 470
471 while (this.currentKeyframeRule[i]) { 471 this.currentKeyframeRule = this.application.ninja.stylesController.getAnimationRuleWithName(this.animationName, this.application.ninja.currentDocument._document);
472 var newTween = {}; 472 while (this.currentKeyframeRule[i]) {
473 if (this.currentKeyframeRule[i].keyText === "0%") { 473 var newTween = {};
474 newTween.spanWidth = 0; 474
475 newTween.keyFramePosition = 0; 475 if (this.currentKeyframeRule[i].keyText === "0%") {
476 newTween.keyFrameMillisec = 0; 476 newTween.spanWidth = 0;
477 newTween.tweenID = 0; 477 newTween.keyFramePosition = 0;
478 newTween.spanPosition = 0; 478 newTween.keyFrameMillisec = 0;
479 this.tweens.push(newTween); 479 newTween.tweenID = 0;
480 newTween.spanPosition = 0;
481 this.tweens.push(newTween);
480 482
481 } 483 }
482 else { 484 else {
483 percentValue = this.currentKeyframeRule[i].keyText; 485 percentValue = this.currentKeyframeRule[i].keyText;
484 splitValue = percentValue.split("%"); 486 splitValue = percentValue.split("%");
485 fraction = splitValue[0] / 100; 487 fraction = splitValue[0] / 100;
486 this.currentMilliSec = fraction * this.trackDuration[0] * 1000; 488 this.currentMilliSec = fraction * this.trackDuration[0] * 1000;
487 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80); 489 this.currentMillisecPerPixel = Math.floor(this.application.ninja.timeline.millisecondsOffset / 80);
488 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel; 490 this.clickPos = this.currentMilliSec / this.currentMillisecPerPixel;
489 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition; 491 newTween.spanWidth = this.clickPos - this.tweens[this.tweens.length - 1].keyFramePosition;
490 newTween.keyFramePosition = this.clickPos; 492 newTween.keyFramePosition = this.clickPos;
491 newTween.keyFrameMillisec = this.currentMilliSec; 493 newTween.keyFrameMillisec = this.currentMilliSec;
492 newTween.tweenID = this.nextKeyframe; 494 newTween.tweenID = this.nextKeyframe;
493 newTween.spanPosition = this.clickPos - newTween.spanWidth; 495 newTween.spanPosition = this.clickPos - newTween.spanWidth;
494 this.tweens.push(newTween); 496 this.tweens.push(newTween);
495 497
496 498
499 }
500 i++;
501 this.nextKeyframe += 1;
497 } 502 }
498 i++; 503 }
499 this.nextKeyframe += 1; 504 else{
505 return;
500 } 506 }
501 } 507 }
502 }, 508 },
@@ -643,4 +649,4 @@ var TimelineTrack = exports.TimelineTrack = Montage.create(Component, {
643 } 649 }
644 } 650 }
645 } 651 }
646}); \ No newline at end of file 652});
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