From 0a500496236bedbdd9fbbcb3d841a195b3e5fc0f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 1 Mar 2012 13:38:44 -0800 Subject: stage and elements fixes - Resizing the iframe container when resizing the stage - Removing 3d rules from elements when adding them - Adding a name property in the pi Signed-off-by: Valerio Virgillito --- js/controllers/elements/stage-controller.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/controllers') 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, { el.elementModel.viewPort.style.setProperty(p, value); break; case "width": + this.application.ninja.currentDocument.iframe.width = parseInt(value) + 1400; el.elementModel.stageDimension.style.setProperty(p, value); break; case "height": + this.application.ninja.currentDocument.iframe.height = parseInt(value) + 400; el.elementModel.stageDimension.style.setProperty(p, value); break; default: -- cgit v1.2.3 From 84332ab81c1b445195f1d9be8bbeae0725c8e758 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 10:58:25 -0800 Subject: Squashed commit of preload-fix into Master - Requiring all the previously pre-loaded files - RDGE, Codemirror and gl-matrix are not included via a script tag. Signed-off-by: Valerio Virgillito --- js/controllers/elements/shapes-controller.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'js/controllers') 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, CanvasController = require("js/controllers/elements/canvas-controller").CanvasController, njModule = require("js/lib/NJUtils"); +var World = require("js/lib/drawing/world").World; +var MaterialsModel = require("js/models/materials-model").MaterialsModel; + exports.ShapesController = Montage.create(CanvasController, { setProperty: { @@ -78,7 +81,7 @@ exports.ShapesController = Montage.create(CanvasController, { this.application.ninja.selectionController.selectElement(el); return; case "strokeMaterial": - var sm = Object.create(MaterialsLibrary.getMaterial(value)); + var sm = Object.create(MaterialsModel.getMaterial(value)); if(sm) { el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); @@ -88,7 +91,7 @@ exports.ShapesController = Montage.create(CanvasController, { } break; case "fillMaterial": - var fm = Object.create(MaterialsLibrary.getMaterial(value)); + var fm = Object.create(MaterialsModel.getMaterial(value)); if(fm) { el.elementModel.shapeModel.GLGeomObj.setFillMaterial(fm); @@ -317,7 +320,7 @@ exports.ShapesController = Montage.create(CanvasController, { optionItem.innerText = "Default"; cb.appendChild(optionItem); - var materials = MaterialsLibrary.materials; + var materials = this.application.ninja.appModel.materials; var len = materials.length; var i; @@ -366,19 +369,19 @@ exports.ShapesController = Montage.create(CanvasController, { worldData = el.elementModel.shapeModel.GLWorld.export(); if(worldData) { - world = new GLWorld(el, true); + world = new World(el, true); el.elementModel.shapeModel.GLWorld = world; el.elementModel.shapeModel.useWebGl = true; world.import(worldData); el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); - sm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); + sm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); if(sm) { el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(sm); el.elementModel.shapeModel.strokeMaterial = sm; } - fm = Object.create(MaterialsLibrary.getMaterial("FlatMaterial")); + fm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); // TODO - Use consts after GL code is converted to object literal notation // if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== GLGeomObj.GEOM_TYPE_LINE) ) if( fm && (el.elementModel.shapeModel.GLGeomObj.geomType() !== 3) ) @@ -402,7 +405,7 @@ exports.ShapesController = Montage.create(CanvasController, { worldData = el.elementModel.shapeModel.GLWorld.export(); if(worldData) { - world = new GLWorld(el, false); + world = new World(el, false); el.elementModel.shapeModel.GLWorld = world; el.elementModel.shapeModel.useWebGl = false; world.import(worldData); -- cgit v1.2.3 From c2805e03c84b6e598556fd06d1ede7aaeea7ce9c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 6 Mar 2012 16:17:54 -0800 Subject: Squashed commit FileIO-Build-Candidate into Master Fixing issues with HTML and CSS URLs. Adjusted RegEx logic. Also code a mirror update and undo/redo changes were merged into this request. Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 9 ++++++--- js/controllers/selection-controller.js | 12 +++++++----- js/controllers/undo-controller.js | 17 +++++++++++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 64ff2c7e..194496a6 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -76,11 +76,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component, // handleWebRequest: { value: function (request) { - if (this._hackRootFlag && request.url.indexOf('js/document/templates/montage-html') !== -1) { + //TODO: Check if frameId is proper + if (this._hackRootFlag && request.parentFrameId !== -1) { //TODO: Optimize creating string - 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]}; - } + //console.log(this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1], request.url); + //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]}; + 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]}; } + } }, //////////////////////////////////////////////////////////////////// // diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index c4623d3f..75968d4a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -76,7 +76,7 @@ exports.SelectionController = Montage.create(Component, { this.application.ninja.selectedElements = currentSelectionArray; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); @@ -92,12 +92,14 @@ exports.SelectionController = Montage.create(Component, { handleSwitchDocument: { value: function() { this._selectedItems = this.application.ninja.selectedElements.slice(0); - if(this._selectedItems.length === 0 ){ + if(this._selectedItems.length === 0) { this._isDocument = true; - }else{ + } else { this._isDocument = false; } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); + + this._selectionContainer = this.application.ninja.currentSelectedContainer; } }, @@ -137,7 +139,7 @@ exports.SelectionController = Montage.create(Component, { value: function(event) { this.application.ninja.selectedElements = []; this._isDocument = true; - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument}); } }, diff --git a/js/controllers/undo-controller.js b/js/controllers/undo-controller.js index 926803d3..19cfb6e6 100755 --- a/js/controllers/undo-controller.js +++ b/js/controllers/undo-controller.js @@ -71,22 +71,28 @@ exports.UndoController = Montage.create( Component, { /** * Undo Queue */ - _undoQueue: { value: [] }, + _undoQueue: { value: []}, undoQueue: { get: function() { return this._undoQueue; + }, + set: function(value){ + this._undoQueue = value; } }, /** * Redo Queue */ - _redoQueue: { value: [], enumerable: false }, + _redoQueue: { value: [], enumerable: false}, redoQueue: { get: function() { return this._redoQueue; + }, + set: function(value){ + this._redoQueue = value; } }, @@ -202,5 +208,12 @@ exports.UndoController = Montage.create( Component, { this.redoQueue.splice(0, this.redoQueue.length); //this.redoQueue = []; } + }, + + clearHistory:{ + value: function(){ + this.undoQueue.length = 0; + this.redoQueue.length = 0; + } } }); \ No newline at end of file -- cgit v1.2.3 From 130cd6d4b99c9db344ec0ab44a54a59d11b31d2f Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Thu, 8 Mar 2012 13:29:58 -0800 Subject: IKNINJA-1270: fixed browser crashing when you close a document while playing a video Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 194496a6..a8056519 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -336,14 +336,23 @@ var DocumentController = exports.DocumentController = Montage.create(Component, nextDocumentIndex = closeDocumentIndex - 1; } this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); + if(typeof this.activeDocument.stopVideos !== "undefined"){doc.stopVideos();} this._removeDocumentView(doc.container); }else if(this._documents.length === 0){ + if(typeof this.activeDocument.pauseAndStopVideos !== "undefined"){ + this.activeDocument.pauseAndStopVideos(); + } this.activeDocument = null; this._removeDocumentView(doc.container); this.application.ninja.stage.stageView.hideRulers(); document.getElementById("iframeContainer").style.display="block"; this.application.ninja.stage.hideCanvas(true); + }else{//closing inactive document tab - just clear DOM + if(typeof doc.pauseAndStopVideos !== "undefined"){ + doc.pauseAndStopVideos(); + } + this._removeDocumentView(doc.container); } NJevent("closeDocument", doc.uri); -- cgit v1.2.3