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/elements') 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/elements') 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 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'js/controllers/elements') 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; } -- 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/elements') 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/elements') 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/elements') 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 6d03f6716104bf5b5daf9c8399623797e1672c89 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 27 Mar 2012 11:47:43 -0700 Subject: Reverting change for IKNinja-1355 because it is causing line tool to fail. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 5b9e4672..f0e9458b 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -274,6 +274,10 @@ exports.ShapesController = Montage.create(CanvasController, { color = this.getShapeProperty(el, "stroke"); } + if(!css) { + return null; + } + css = this.application.ninja.colorController.colorModel.webGlToCss(color); return this.application.ninja.colorController.getColorObjFromCss(css); } -- cgit v1.2.3