From bcddcf118d4ce93e8a2519ed455c6e25a701ce74 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 16:42:13 -0700 Subject: fixing the map styles and temporary disabling the 3d styles for elements. Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 70aba54e..efaa00ee 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -290,10 +290,10 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, value: function(el, props, index, update3DModel) { var dist = props[index]["dist"], mat = props[index]["mat"]; - this.application.ninja.stylesController.setElementStyle(el, - "-webkit-transform", - "perspective(" + dist + ") " + - "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); +// this.application.ninja.stylesController.setElementStyle(el, +// "-webkit-transform", +// "perspective(" + dist + ") " + +// "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -- cgit v1.2.3 From a086ca62423a09807e2f3a79107249bc31d5e908 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sat, 17 Mar 2012 18:41:17 -0700 Subject: Adding back webkit-transform styles in set3DProperties. Changing "zoom" to "zoomValue" in map component to avoid scaling the map. Signed-off-by: Nivesh Rajbhandari Signed-off-by: Valerio Virgillito --- js/controllers/elements/element-controller.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index efaa00ee..70aba54e 100755 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -290,10 +290,10 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, value: function(el, props, index, update3DModel) { var dist = props[index]["dist"], mat = props[index]["mat"]; -// this.application.ninja.stylesController.setElementStyle(el, -// "-webkit-transform", -// "perspective(" + dist + ") " + -// "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); + this.application.ninja.stylesController.setElementStyle(el, + "-webkit-transform", + "perspective(" + dist + ") " + + "matrix3d(" + MathUtils.scientificToDecimal(mat, 5) + ")"); el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -- cgit v1.2.3 From 44d75ed17d56055ed9dbb8f91867bbdbc68924fa Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 18 Mar 2012 22:21:14 -0700 Subject: fixing the selection of components. Temporary workaround for now. Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 13 ++++++++----- js/controllers/selection-controller.js | 25 ++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 6 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 83450d0f..260ee8a0 100755 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -11,6 +11,8 @@ exports.ComponentController = Montage.create(ElementController, { getProperty: { value: function(el, prop) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(prop) { case "id": case "class": @@ -19,18 +21,20 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (prop === "width" || prop === "height")) { - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } else { return ElementController.getProperty(el, prop, true); } default: - return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; + return component[prop]; } } }, setProperty: { value: function(el, p, value) { + var component = el.controller || this.application.ninja.currentDocument.getComponentFromElement(el); + switch(p) { case "id": case "class": @@ -39,15 +43,14 @@ exports.ComponentController = Montage.create(ElementController, { case "width": case "height": if(el.nodeName === "IMG" && (p === "width" || p === "height")) { - this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + component[p] = value; } else { ElementController.setProperty(el, p, value); } break; default: if(p === "min" || p === "max") value = parseFloat(value); - - this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + component[p] = value; break; } diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 154fb7f8..fa82d4cc 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot var Montage = require("montage/core/core").Montage, - Component = require("montage/ui/component").Component; + Component = require("montage/ui/component").Component, + NJUtils = require("js/lib/NJUtils").NJUtils; exports.SelectionController = Montage.create(Component, { @@ -154,6 +155,28 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; } + if(item && item.controller && !item.elementModel.isComponent) { + var componentInfo = Montage.getInfoForObject(item.controller); + var componentName = componentInfo.objectName.toLowerCase(); + switch(componentName) { + case "feedreader": + NJUtils.makeElementModel(item, "Feed Reader", "component", false); + item.elementModel.pi = "FeedReaderPi"; + item.elementModel.isComponent = true; + break; + case "map": + NJUtils.makeElementModel(item, "Map", "component", false); + item.elementModel.pi = "MapPi"; + item.elementModel.isComponent = true; + break; + case "youtubechannel": + NJUtils.makeElementModel(item, "Youtube Channel", "component", false); + item.elementModel.pi = "YoutubeChannelPi"; + item.elementModel.isComponent = true; + break; + } + } + NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } -- cgit v1.2.3 From f9e31800b1dedd7904e6e23c575c94ed4a72abdb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Mon, 19 Mar 2012 15:23:08 -0700 Subject: fixing the selection for the picasa carousel Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index fa82d4cc..5091f99a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -174,6 +174,11 @@ exports.SelectionController = Montage.create(Component, { item.elementModel.pi = "YoutubeChannelPi"; item.elementModel.isComponent = true; break; + case "picasacarousel": + NJUtils.makeElementModel(item, "Picasa Carousel", "component", false); + item.elementModel.pi = "PicasaCarouselPi"; + item.elementModel.isComponent = true; + break; } } -- cgit v1.2.3 From c0a1164b5e84098e005f076de5eddd0e60387286 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 20 Mar 2012 14:21:29 -0700 Subject: Fixing the selection issues Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 5091f99a..9b0e638a 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -155,33 +155,6 @@ exports.SelectionController = Montage.create(Component, { this._isDocument = true; } - if(item && item.controller && !item.elementModel.isComponent) { - var componentInfo = Montage.getInfoForObject(item.controller); - var componentName = componentInfo.objectName.toLowerCase(); - switch(componentName) { - case "feedreader": - NJUtils.makeElementModel(item, "Feed Reader", "component", false); - item.elementModel.pi = "FeedReaderPi"; - item.elementModel.isComponent = true; - break; - case "map": - NJUtils.makeElementModel(item, "Map", "component", false); - item.elementModel.pi = "MapPi"; - item.elementModel.isComponent = true; - break; - case "youtubechannel": - NJUtils.makeElementModel(item, "Youtube Channel", "component", false); - item.elementModel.pi = "YoutubeChannelPi"; - item.elementModel.isComponent = true; - break; - case "picasacarousel": - NJUtils.makeElementModel(item, "Picasa Carousel", "component", false); - item.elementModel.pi = "PicasaCarouselPi"; - item.elementModel.isComponent = true; - break; - } - } - NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); } -- cgit v1.2.3 From fa3ebf391db168d7c4ebcc86450c66684eeeb5cd Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Wed, 21 Mar 2012 11:11:51 -0700 Subject: Removing usage of webRequest APIs Removed the usage of the webRequest API since all files are parsed on open to handle prefixing correct origin. This will most likely not work for assets that are added dynamically and will most likely break, all those adding linking to assets should make use of a function in the mediator to mask the display value and actual value of the linked asset. --- js/controllers/document-controller.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 7d982a62..3db4c7d4 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -73,13 +73,15 @@ var DocumentController = exports.DocumentController = Montage.create(Component, - //////////////////////////////////////////////////////////////////// + /* +//////////////////////////////////////////////////////////////////// // handleWebRequest: { value: function (request) { //TODO: Check if frameId is proper if (this._hackRootFlag && request.parentFrameId !== -1) { //TODO: Optimize creating string + console.log(request); //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]}; @@ -102,6 +104,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, //////////////////////////////////////////////////////////////////// +*/ -- cgit v1.2.3 From f0392fb5a05c5d4b3dd37ebc64c1dee2c2b6b848 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 21 Mar 2012 17:22:47 -0700 Subject: Changes to the webrequest blocking and adding a google.com permission workaround Signed-off-by: Valerio Virgillito --- js/controllers/document-controller.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 3db4c7d4..539fd13e 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -72,8 +72,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, - - /* + //////////////////////////////////////////////////////////////////// // handleWebRequest: { @@ -81,7 +80,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, //TODO: Check if frameId is proper if (this._hackRootFlag && request.parentFrameId !== -1) { //TODO: Optimize creating string - console.log(request); + //console.log(request); //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]}; @@ -104,7 +103,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component, } }, //////////////////////////////////////////////////////////////////// -*/ + -- cgit v1.2.3 From efcec76362a652033254fc6465dd127e8bebc04c Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 22 Mar 2012 09:57:32 -0700 Subject: Adding firstDraw event to components added This will allow us to re-parse the document for styles added dynamically. --- js/controllers/document-controller.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 3db4c7d4..c6f867aa 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js @@ -64,10 +64,16 @@ var DocumentController = exports.DocumentController = Montage.create(Component, this.eventManager.addEventListener("styleSheetDirty", this, false); + this.eventManager.addEventListener("addComponentFirstDraw", this, false); } }, - + handleAddComponentFirstDraw: { + value: function (e) { + //TODO: Add logic to reparse the document for dynamically added styles + console.log(e); + } + }, -- cgit v1.2.3 From fdeed8051c3af538d28ca3bc599121cea483c22c Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 22 Mar 2012 15:47:56 -0700 Subject: Squashed commit of the following GL integration Signed-off-by: Valerio Virgillito --- js/controllers/selection-controller.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js index 9b0e638a..53cca029 100755 --- a/js/controllers/selection-controller.js +++ b/js/controllers/selection-controller.js @@ -112,6 +112,15 @@ exports.SelectionController = Montage.create(Component, { if(!this._isDocument) { if(this.findSelectedElement(event.detail) !== -1) { this.executeSelectElement(); + var element = event.detail; + if (element) { + if (element.elementModel) { + if (element.elementModel.shapeModel) { + if (element.elementModel.shapeModel.GLWorld) + element.elementModel.shapeModel.GLWorld.clearTree(); + } + } + } } } } -- cgit v1.2.3 From e52b0dcb9540b854a341a881de2d26aa753e9a82 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 22 Mar 2012 16:18:38 -0700 Subject: Adding checkbox in PI to start/stop WebGL animation preview. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index b3ac9ddb..9b2fa618 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -105,6 +105,18 @@ exports.ShapesController = Montage.create(CanvasController, { case "editFillMaterial": NJevent("showMaterialPopup",{materialId : el.elementModel.shapeModel.fillMaterial.getName()}); break; + case "animate": + if(value) + { + el.elementModel.shapeModel.animate = true; + el.elementModel.shapeModel.GLWorld.restartRenderLoop(); + } + else + { + el.elementModel.shapeModel.animate = false; + el.elementModel.shapeModel.GLWorld._canvas.task.stop(); + } + break; default: CanvasController.setProperty(el, p, value); } @@ -123,6 +135,7 @@ exports.ShapesController = Montage.create(CanvasController, { case "border": case "background": case "useWebGl": + case "animate": return this.getShapeProperty(el, p); case "strokeMaterial": case "fillMaterial": -- cgit v1.2.3 From 8e9ac98ea1001289cb3834b262200eee253cb408 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 23 Mar 2012 11:41:11 -0700 Subject: Respect play/pause WebGL animation when saving files and re-rendering caused by geometry changes. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 9b2fa618..b060b751 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -109,11 +109,13 @@ exports.ShapesController = Montage.create(CanvasController, { if(value) { el.elementModel.shapeModel.animate = true; + el.elementModel.shapeModel.GLWorld._previewAnimation = true; el.elementModel.shapeModel.GLWorld.restartRenderLoop(); } else { el.elementModel.shapeModel.animate = false; + el.elementModel.shapeModel.GLWorld._previewAnimation = false; el.elementModel.shapeModel.GLWorld._canvas.task.stop(); } break; -- cgit v1.2.3 From 86770d0dba6b137e651cbf5c8d240856be65857c Mon Sep 17 00:00:00 2001 From: hwc487 Date: Fri, 23 Mar 2012 14:59:51 -0700 Subject: Fixed a problem switching from 3D to 2D and back to 3D. --- js/controllers/elements/shapes-controller.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index b060b751..5b9e4672 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -504,13 +504,14 @@ exports.ShapesController = Montage.create(CanvasController, { var sm, fm, world, - worldData = el.elementModel.shapeModel.GLWorld.export(); + worldData = el.elementModel.shapeModel.GLWorld.exportJSON(); if(worldData) { + worldData = this.flip3DSense (worldData ); world = new World(el, true); el.elementModel.shapeModel.GLWorld = world; el.elementModel.shapeModel.useWebGl = true; - world.import(worldData); + world.importJSON(worldData); el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); sm = Object.create(MaterialsModel.getMaterial("FlatMaterial")); @@ -540,13 +541,14 @@ exports.ShapesController = Montage.create(CanvasController, { return; } var world, - worldData = el.elementModel.shapeModel.GLWorld.export(); + worldData = el.elementModel.shapeModel.GLWorld.exportJSON(); if(worldData) { + worldData = this.flip3DSense (worldData ); world = new World(el, false); el.elementModel.shapeModel.GLWorld = world; el.elementModel.shapeModel.useWebGl = false; - world.import(worldData); + world.importJSON(worldData); el.elementModel.shapeModel.GLGeomObj = world.getGeomRoot(); el.elementModel.shapeModel.GLGeomObj.setStrokeMaterial(null); el.elementModel.shapeModel.strokeMaterial = null; @@ -558,6 +560,24 @@ exports.ShapesController = Montage.create(CanvasController, { } } } + }, + + flip3DSense: { + value: function( importStr ) + { + var jObj; + var index = importStr.indexOf( ';' ); + if ((importStr[0] === 'v') && (index < 24)) + { + // JSON format. separate the version info from the JSON info + //var vStr = importStr.substr( 0, index+1 ); + var jStr = importStr.substr( index+1 ); + jObj = JSON.parse( jStr ); + jObj.webGL = !jObj.webGL; + } + + return jObj; + } } }); -- cgit v1.2.3 From 23b89609d7fc26f3523b4a8e354fa8c8208cbdbf Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Mon, 26 Mar 2012 14:05:12 -0700 Subject: Fix: IKNINJA-1355 --- js/controllers/color-controller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/controllers') diff --git a/js/controllers/color-controller.js b/js/controllers/color-controller.js index 53573baf..8e000b19 100755 --- a/js/controllers/color-controller.js +++ b/js/controllers/color-controller.js @@ -198,7 +198,6 @@ exports.ColorController = Montage.create(Component, { handleChange: { enumerable: true, value: function (e) { - // var actionEvent, color, input = e._event.input, panelMode, mode = e._event.mode; if (this.colorView) { @@ -228,14 +227,14 @@ exports.ColorController = Montage.create(Component, { // this.fill = color; // - if(e._event.wasSetByCode) return; + if(e._event.wasSetByCode && mode !== 'nocolor') return; // this.setColor(mode, color, true); } else if (input === 'stroke') { // this.stroke = color; // - if(e._event.wasSetByCode) return; + if(e._event.wasSetByCode && mode !== 'nocolor') return; this.setColor(mode, color, false); } -- cgit v1.2.3