From b88ebb47d82fc1ffebea49c3bf182aaf3c9419af Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Mon, 30 Jan 2012 15:53:11 -0800 Subject: Fixed issue with elements not drawing in the correct plane. When first adding an element, force the 3d model to update with the element's webkit transform values. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 59 +++++++++++++-------------- 1 file changed, 29 insertions(+), 30 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index f254220c..30469db0 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -127,36 +127,35 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, } else { - // TODO - for now, just return the identity matrix - return Matrix.I(4); -// var mat; -// -// if (elt) -// { -// var xformStr = ElementsMediator.getProperty(elt, "-webkit-transform"); -// if (xformStr) -// mat = this.transformStringToMat( xformStr ); -// if (!mat) -// mat = Matrix.I(4); -// -// if (elt.style && elt.style.zoom) -// { -// var zoom = Number(elt.style.zoom); -// if (zoom != 1) -// { -// var zoomMat = Matrix.create( [ -// [ zoom, 0, 0, 0], -// [ 0, zoom, 0, 0], -// [ 0, 0, zoom, 0], -// [ 0, 0, 0, 1] -// ] ); -// glmat4.multiply( zoomMat, mat, mat ); -// } -// } -// } -// -// elt.elementModel.props3D.matrix3d = mat; -// return mat; + var mat; + + if (el) + { + var xformStr = this.application.ninja.elementMediator.getProperty(el, "-webkit-transform"); + if (xformStr) + mat = this.transformStringToMat( xformStr ); + if (!mat) + mat = Matrix.I(4); + + var zoom = this.application.ninja.elementMediator.getProperty(el, "zoom"); + if (zoom) + { + zoom = Number(zoom); + if (zoom != 1) + { + var zoomMat = Matrix.create( [ + [ zoom, 0, 0, 0], + [ 0, zoom, 0, 0], + [ 0, 0, zoom, 0], + [ 0, 0, 0, 1] + ] ); + glmat4.multiply( zoomMat, mat, mat ); + } + } + } + + el.elementModel.props3D.matrix3d = mat; + return mat; } } }, -- cgit v1.2.3 From c0f43749523f4720ca4c8942fa9ac17753d93a67 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 31 Jan 2012 15:01:04 -0800 Subject: Fixing 3d section of the PI. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/element-controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/element-controller.js b/js/controllers/elements/element-controller.js index 30469db0..f2b54014 100644 --- a/js/controllers/elements/element-controller.js +++ b/js/controllers/elements/element-controller.js @@ -206,7 +206,7 @@ var ElementController = exports.ElementController = Montage.create(NJComponent, el.elementModel.props3D.matrix3d = mat; el.elementModel.props3D.perspectiveDist = dist; -// if(update3DModel) + if(update3DModel) { this._update3DProperties(el, mat, dist); } -- cgit v1.2.3 From 89d64cf06e170c3c50b02eeadd9dcf10d6efe1a3 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 2 Feb 2012 13:22:30 -0800 Subject: Updating Shapes PI to support corner radii. Also fixed PI bug where we were always updating custom section 0. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/shapes-controller.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index d34644a7..c5f22138 100644 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js @@ -24,6 +24,26 @@ exports.ShapesController = Montage.create(CanvasController, { el.elementModel.shapeModel.GLGeomObj.setInnerRadius(val/100); el.elementModel.shapeModel.GLGeomObj.buildBuffers(); break; + case "tlRadius": + this.setShapeProperty(el, "tlRadius", value); + el.elementModel.shapeModel.GLGeomObj.setTLRadius(val); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + break; + case "trRadius": + this.setShapeProperty(el, "trRadius", value); + el.elementModel.shapeModel.GLGeomObj.setTRRadius(val); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + break; + case "blRadius": + this.setShapeProperty(el, "blRadius", value); + el.elementModel.shapeModel.GLGeomObj.setBLRadius(val); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + break; + case "brRadius": + this.setShapeProperty(el, "brRadius", value); + el.elementModel.shapeModel.GLGeomObj.setBRRadius(val); + el.elementModel.shapeModel.GLGeomObj.buildBuffers(); + break; case "width": el.elementModel.shapeModel.GLGeomObj.setWidth(val); CanvasController.setProperty(el, p, value); @@ -46,8 +66,16 @@ exports.ShapesController = Montage.create(CanvasController, { getProperty: { value: function(el, p) { switch(p) { + case "stroke": + case "fill": case "strokeSize": case "innerRadius": + case "tlRadius": + case "trRadius": + case "blRadius": + case "brRadius": + case "strokeMaterial": + case "fillMaterial": return this.getShapeProperty(el, p); default: return CanvasController.getProperty(el, p); -- cgit v1.2.3 From d41dee0c552a30724a146965ae4272a268777fc5 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 2 Feb 2012 14:53:14 -0800 Subject: Integrating Pan and Zoom tool and snap manager fixes. Signed-off-by: Nivesh Rajbhandari --- js/controllers/elements/canvas-controller.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'js/controllers/elements') diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js index 21de9879..b5df3911 100644 --- a/js/controllers/elements/canvas-controller.js +++ b/js/controllers/elements/canvas-controller.js @@ -34,12 +34,12 @@ exports.CanvasController = Montage.create(ElementController, { } } }, - - setProperties: { - value: function(el, props, index) { - for(var p in props) { - el.elementModel.controller.setProperty(el, p, props[p][index]); - } - } + + setProperties: { + value: function(el, props, index) { + for(var p in props) { + el.elementModel.controller.setProperty(el, p, props[p][index]); + } + } } }); \ No newline at end of file -- cgit v1.2.3