From 2fd6db5f46208a5aa8fa58d090f795e5b7eb99bb Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Tue, 29 May 2012 10:35:06 -0700 Subject: Sped up user-interaction by moving grid drawing into its own canvas so the layout code doesn't have to be run when modifying selected elements. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 069c6022..4dcda24a 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -21,8 +21,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { /////////////////////////////////////////////////////////////////////// // Instance variables /////////////////////////////////////////////////////////////////////// - drawingCanvas: { value: null, writable: true}, - + // we keep a stack of working planes to facilitate working on other planes temporarily _workingPlaneStack : { value: [], writable: true }, @@ -2124,7 +2123,7 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { if (hitRec) { var saveContext = drawUtils.getDrawingSurfaceElement(); - drawUtils.setDrawingSurfaceElement(this.drawingCanvas); + drawUtils.setDrawingSurfaceElement(this.application.ninja.stage.drawingCanvas); var context = drawUtils.getDrawingContext(); if (context) { -- cgit v1.2.3 From 0b830a8c6415e9cc255d1593a05ae3fa9d94c5e2 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 31 May 2012 14:31:00 -0700 Subject: Adding back the stage references in the 3d classes. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/3D/snap-manager.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'js/helper-classes/3D/snap-manager.js') diff --git a/js/helper-classes/3D/snap-manager.js b/js/helper-classes/3D/snap-manager.js index 4dcda24a..e3756f32 100755 --- a/js/helper-classes/3D/snap-manager.js +++ b/js/helper-classes/3D/snap-manager.js @@ -22,6 +22,8 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { // Instance variables /////////////////////////////////////////////////////////////////////// + currentStage: { value: null }, + // we keep a stack of working planes to facilitate working on other planes temporarily _workingPlaneStack : { value: [], writable: true }, @@ -82,14 +84,14 @@ var SnapManager = exports.SnapManager = Montage.create(Component, { popWorkingPlane : { value: function () { workingPlane = this._workingPlaneStack.pop(); return workingPlane; }}, getStageWidth : { value: function () { - return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetWidth); + return parseInt(this.currentStage.offsetWidth); }}, getStageHeight : { value: function () { - return parseInt(this.application.ninja.currentDocument.model.documentRoot.offsetHeight); + return parseInt(this.currentStage.offsetHeight); }}, - getStage : { value: function() { return this.application.ninja.currentDocument.model.documentRoot; }}, + getStage : { value: function() { return this.currentStage; }}, getGridVertexHitRad : { value: function() { return this._gridVertexHitRad; }}, getGridEdgeHitRad : { value: function() { return this._gridEdgeHitRad; }}, -- cgit v1.2.3