aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorEric Guzman2012-03-12 15:33:04 -0700
committerEric Guzman2012-03-12 15:33:04 -0700
commit7e3161153b87b891875ac65368a19aed12909fa3 (patch)
treeb80f48d711a9729fc39dbbdff28c4f0620e7302d /js/controllers
parent7a28932ba8a7517bbaaabe1f5edf678416aafc9c (diff)
parent69d90467865a1384725b2301901be2180c5a841f (diff)
downloadninja-7e3161153b87b891875ac65368a19aed12909fa3.tar.gz
Merge branch 'refs/heads/master' into CSSPanelUpdates
Conflicts: js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/color-controller.js4
-rwxr-xr-xjs/controllers/document-controller.js18
-rwxr-xr-xjs/controllers/elements/shapes-controller.js17
-rwxr-xr-xjs/controllers/elements/stage-controller.js2
-rwxr-xr-xjs/controllers/selection-controller.js12
-rwxr-xr-xjs/controllers/undo-controller.js17
6 files changed, 52 insertions, 18 deletions
diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js
index a6e41dd3..53573baf 100755
--- a/js/controllers/color-controller.js
+++ b/js/controllers/color-controller.js
@@ -259,6 +259,7 @@ exports.ColorController = Montage.create(Component, {
259 //Radial gradient 259 //Radial gradient
260 gradient.stops = []; 260 gradient.stops = [];
261 gradient.mode = 'radial'; 261 gradient.mode = 'radial';
262 gradient.gradientMode = 'radial';
262 gradient.css = css; 263 gradient.css = css;
263 // 264 //
264 arr = css.split('%,'); 265 arr = css.split('%,');
@@ -284,6 +285,7 @@ exports.ColorController = Montage.create(Component, {
284 //Linear gradient 285 //Linear gradient
285 gradient.stops = []; 286 gradient.stops = [];
286 gradient.mode = 'linear'; 287 gradient.mode = 'linear';
288 gradient.gradientMode = 'linear';
287 gradient.css = css; 289 gradient.css = css;
288 // 290 //
289 arr = css.split('from('); 291 arr = css.split('from(');
@@ -317,7 +319,7 @@ exports.ColorController = Montage.create(Component, {
317 } 319 }
318 } 320 }
319 //Creating gradient object 321 //Creating gradient object
320 color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, css: css}}; 322 color = {mode: 'gradient', value: {stops: gradient.stops, mode: gradient.mode, gradientMode: gradient.gradientMode, css: css}};
321 } else if (css){ 323 } else if (css){
322 //Simple solid color 324 //Simple solid color
323 color = this.parseCssToColor(css); 325 color = this.parseCssToColor(css);
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 64ff2c7e..a8056519 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -76,11 +76,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
76 // 76 //
77 handleWebRequest: { 77 handleWebRequest: {
78 value: function (request) { 78 value: function (request) {
79 if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { 79 //TODO: Check if frameId is proper
80 if (this._hackRootFlag && request.parentFrameId !== -1) {
80 //TODO: Optimize creating string 81 //TODO: Optimize creating string
81 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]}; 82 //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url);
82 } 83 //return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split('/')[request.url.split('/').length-1]};
84 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/montage-html/'))[1]};
83 } 85 }
86 }
84 }, 87 },
85 //////////////////////////////////////////////////////////////////// 88 ////////////////////////////////////////////////////////////////////
86 // 89 //
@@ -333,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
333 nextDocumentIndex = closeDocumentIndex - 1; 336 nextDocumentIndex = closeDocumentIndex - 1;
334 } 337 }
335 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); 338 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
339 if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();}
336 this._removeDocumentView(doc.container); 340 this._removeDocumentView(doc.container);
337 }else if(this._documents.length === 0){ 341 }else if(this._documents.length === 0){
342 if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){
343 this.activeDocument.pauseAndStopVideos();
344 }
338 this.activeDocument = null; 345 this.activeDocument = null;
339 this._removeDocumentView(doc.container); 346 this._removeDocumentView(doc.container);
340 this.application.ninja.stage.stageView.hideRulers(); 347 this.application.ninja.stage.stageView.hideRulers();
341 document.getElementById("iframeContainer").style.display="block"; 348 document.getElementById("iframeContainer").style.display="block";
342 349
343 this.application.ninja.stage.hideCanvas(true); 350 this.application.ninja.stage.hideCanvas(true);
351 }else{//closing inactive document tab - just clear DOM
352 if(typeof doc.pauseAndStopVideos !== "undefined"){
353 doc.pauseAndStopVideos();
354 }
355 this._removeDocumentView(doc.container);
344 } 356 }
345 357
346 NJevent("closeDocument", doc.uri); 358 NJevent("closeDocument", doc.uri);
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js
index 749a1dd9..3423a5a7 100755
--- a/js/controllers/elements/shapes-controller.js
+++ b/js/controllers/elements/shapes-controller.js
@@ -8,6 +8,9 @@ var Montage = require("montage/core/core").Montage,
8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, 8 CanvasController = require("js/controllers/elements/canvas-controller").CanvasController,
9 njModule = require("js/lib/NJUtils"); 9 njModule = require("js/lib/NJUtils");
10 10
11var World = require("js/lib/drawing/world").World;
12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
13
11exports.ShapesController = Montage.create(CanvasController, { 14exports.ShapesController = Montage.create(CanvasController, {
12 15
13 setProperty: { 16 setProperty: {
@@ -78,7 +81,7 @@ exports.ShapesController = Montage.create(CanvasController, {
78 this.application.ninja.selectionController.selectElement(el); 81 this.application.ninja.selectionController.selectElement(el);
79 return; 82 return;
80 case "strokeMaterial": 83 case "strokeMaterial":
81 var sm = Object.create(MaterialsLibrary.getMaterial(value)); 84 var sm = Object.create(MaterialsModel.getMaterial(value));
82 if(sm) 85 if(sm)
83 { 86 {
84 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 87 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
@@ -88,7 +91,7 @@ exports.ShapesController = Montage.create(CanvasController, {
88 } 91 }
89 break; 92 break;
90 case "fillMaterial": 93 case "fillMaterial":
91 var fm = Object.create(MaterialsLibrary.getMaterial(value)); 94 var fm = Object.create(MaterialsModel.getMaterial(value));
92 if(fm) 95 if(fm)
93 { 96 {
94 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); 97 el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm);
@@ -317,7 +320,7 @@ exports.ShapesController = Montage.create(CanvasController, {
317 optionItem.innerText = "Default"; 320 optionItem.innerText = "Default";
318 cb.appendChild(optionItem); 321 cb.appendChild(optionItem);
319 322
320 var materials = MaterialsLibrary.materials; 323 var materials = this.application.ninja.appModel.materials;
321 var len = materials.length; 324 var len = materials.length;
322 325
323 var i; 326 var i;
@@ -366,19 +369,19 @@ exports.ShapesController = Montage.create(CanvasController, {
366 worldData = el.elementModel.shapeModel.GLWorld.export(); 369 worldData = el.elementModel.shapeModel.GLWorld.export();
367 if(worldData) 370 if(worldData)
368 { 371 {
369 world = new GLWorld(el, true); 372 world = new World(el, true);
370 el.elementModel.shapeModel.GLWorld = world; 373 el.elementModel.shapeModel.GLWorld = world;
371 el.elementModel.shapeModel.useWebGl = true; 374 el.elementModel.shapeModel.useWebGl = true;
372 world.import(worldData); 375 world.import(worldData);
373 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); 376 el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot();
374 377
375 sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); 378 sm = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
376 if(sm) 379 if(sm)
377 { 380 {
378 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); 381 el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm);
379 el.elementModel.shapeModel.strokeMaterial = sm; 382 el.elementModel.shapeModel.strokeMaterial = sm;
380 } 383 }
381 fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); 384 fm = Object.create(MaterialsModel.getMaterial("FlatMaterial"));
382 // TODO - Use consts after GL code is converted to object literal notation 385 // TODO - Use consts after GL code is converted to object literal notation
383// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) ) 386// if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) )
384 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) ) 387 if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) )
@@ -402,7 +405,7 @@ exports.ShapesController = Montage.create(CanvasController, {
402 worldData = el.elementModel.shapeModel.GLWorld.export(); 405 worldData = el.elementModel.shapeModel.GLWorld.export();
403 if(worldData) 406 if(worldData)
404 { 407 {
405 world = new GLWorld(el, false); 408 world = new World(el, false);
406 el.elementModel.shapeModel.GLWorld = world; 409 el.elementModel.shapeModel.GLWorld = world;
407 el.elementModel.shapeModel.useWebGl = false; 410 el.elementModel.shapeModel.useWebGl = false;
408 world.import(worldData); 411 world.import(worldData);
diff --git a/js/controllers/elements/stage-controller.js b/js/controllers/elements/stage-controller.js
index abad3736..34bb1fb5 100755
--- a/js/controllers/elements/stage-controller.js
+++ b/js/controllers/elements/stage-controller.js
@@ -104,9 +104,11 @@ exports.StageController = Montage.create(ElementController, {
104 el.elementModel.viewPort.style.setProperty(p, value); 104 el.elementModel.viewPort.style.setProperty(p, value);
105 break; 105 break;
106 case "width": 106 case "width":
107 this.application.ninja.currentDocument.iframe.width = parseInt(value) + 1400;
107 el.elementModel.stageDimension.style.setProperty(p, value); 108 el.elementModel.stageDimension.style.setProperty(p, value);
108 break; 109 break;
109 case "height": 110 case "height":
111 this.application.ninja.currentDocument.iframe.height = parseInt(value) + 400;
110 el.elementModel.stageDimension.style.setProperty(p, value); 112 el.elementModel.stageDimension.style.setProperty(p, value);
111 break; 113 break;
112 default: 114 default:
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index c4623d3f..75968d4a 100755
--- a/