From 15c7bdad38a83d192bd5a1d55a54362c12c73d38 Mon Sep 17 00:00:00 2001 From: hwc487 Date: Tue, 8 May 2012 12:10:07 -0700 Subject: Fixed a snapping issue on the mouse down in drawing tools. --- js/tools/drawing-tool-base.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'js/tools/drawing-tool-base.js') diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 376b3a27..84641754 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -36,9 +36,8 @@ exports.DrawingToolBase = Montage.create(Montage, { * 2 - Y value converted to screen point */ getInitialSnapPoint: { - value: function(x, y, shapeCanvas) { - snapManager.clearDragPlane(); - + value: function(x, y, shapeCanvas) + { // update the snap settings snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); snapManager.enableElementSnap( snapManager.elementSnapEnabledAppLevel() ); -- cgit v1.2.3 From b72c5f72ea5df4aa164350e1ba66fd1b4e23369d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 17 May 2012 23:07:48 -0700 Subject: removing all stageDeps for drawing classes. Signed-off-by: Valerio Virgillito --- js/tools/drawing-tool-base.js | 39 +++++++++++++-------------------------- 1 file changed, 13 insertions(+), 26 deletions(-) (limited to 'js/tools/drawing-tool-base.js') diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 84641754..0a3767b5 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -12,17 +12,7 @@ var viewUtils = require("js/helper-classes/3D/view-utils").ViewUtils; var vecUtils = require("js/helper-classes/3D/vec-utils").VecUtils; var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils; -exports.DrawingToolBase = Montage.create(Montage, { - - //!!!! HACK - // TODO: Need to find a better way to address this - stage: { - value: null - }, - - stageComponent: { - value: null - }, +exports.DrawingToolBase = Montage.create(Component, { dragPlane: { value: null @@ -164,9 +154,8 @@ exports.DrawingToolBase = Montage.create(Montage, { // get the hit rec. points in plane space var psPos = hitRec.getLocalPoint(); - var stage = this.stage; - var stageOffset = viewUtils.getElementOffset(stage); - viewUtils.setViewportObj(stage); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -194,9 +183,8 @@ exports.DrawingToolBase = Montage.create(Montage, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stage = this.stage; - var stageOffset = viewUtils.getElementOffset(stage); - viewUtils.setViewportObj(stage); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -301,10 +289,10 @@ exports.DrawingToolBase = Montage.create(Montage, { draw2DRectangle: { value: function(x0, y0, x1, y1) { - var drawingContext = this.stageComponent.drawingContext, - drawingPrefs = this.stageComponent.drawingContextPreferences; + var drawingContext = this.application.ninja.stage.drawingContext, + drawingPrefs = this.application.ninja.stage.drawingContextPreferences; - this.stageComponent.clearDrawingCanvas(); + this.application.ninja.stage.clearDrawingCanvas(); //TODO Save and restore state drawingContext.strokeStyle = drawingPrefs.color; drawingContext.lineWidth = drawingPrefs.thickness; @@ -320,11 +308,10 @@ exports.DrawingToolBase = Montage.create(Montage, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stage = this.stage; - var stageMat = viewUtils.getMatrixFromElement( stage ); + var stageMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); var elt = hitRec0.getElt(); if (!elt) { elt = hitRec1.getElt(); } - if (!elt) { elt = stage; } + if (!elt) { elt = this.application.ninja.currentDocument.documentRoot; } if (elt) { viewUtils.pushViewportObj(elt); @@ -420,11 +407,11 @@ exports.DrawingToolBase = Montage.create(Montage, { if ( isProjected) { var unprojPtArr = [s0, s1, s2, s3]; - this.stageComponent.draw3DProjectedAndUnprojectedRectangles( unprojPtArr, projPtArr ); + this.application.ninja.stage.draw3DProjectedAndUnprojectedRectangles( unprojPtArr, projPtArr ); } else { - this.stageComponent.draw3DSelectionRectangle(s0[0], s0[1], + this.application.ninja.stage.draw3DSelectionRectangle(s0[0], s0[1], s1[0], s1[1], s2[0], s2[1], s3[0], s3[1], @@ -440,7 +427,7 @@ exports.DrawingToolBase = Montage.create(Montage, { value: function (hitRec0, hitRec1, strokeSize, strokeColor) { var p0 = hitRec0.getScreenPoint(), p1 = hitRec1.getScreenPoint(); - this.stageComponent.drawLine(p0[0], p0[1], p1[0], p1[1], strokeSize, strokeColor); + this.application.ninja.stage.drawLine(p0[0], p0[1], p1[0], p1[1], strokeSize, strokeColor); } }, -- cgit v1.2.3 From 5914c5b2209c4b8daac4249bb76cda5c9314c4e6 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Thu, 24 May 2012 00:07:23 -0700 Subject: Cleaning up referencing to 'documentRoot' and '_document' Moved to reference new model in DOM architecture rework. This should not affect anything, just moving the references, and also the setting to the render methods in the design view. --- js/tools/drawing-tool-base.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'js/tools/drawing-tool-base.js') diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 0a3767b5..3549de1c 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -154,8 +154,8 @@ exports.DrawingToolBase = Montage.create(Component, { // get the hit rec. points in plane space var psPos = hitRec.getLocalPoint(); - var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); - viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.model.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -183,8 +183,8 @@ exports.DrawingToolBase = Montage.create(Component, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.documentRoot); - viewUtils.setViewportObj(this.application.ninja.currentDocument.documentRoot); + var stageOffset = viewUtils.getElementOffset(this.application.ninja.currentDocument.model.documentRoot); + viewUtils.setViewportObj(this.application.ninja.currentDocument.model.documentRoot); // get the matrix taking the local hit point in plane space // to world space of whatever element it is in. @@ -308,10 +308,10 @@ exports.DrawingToolBase = Montage.create(Component, { var p0 = hitRec0.getLocalPoint(), p1 = hitRec1.getLocalPoint(); - var stageMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot); + var stageMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.model.documentRoot); var elt = hitRec0.getElt(); if (!elt) { elt = hitRec1.getElt(); } - if (!elt) { elt = this.application.ninja.currentDocument.documentRoot; } + if (!elt) { elt = this.application.ninja.currentDocument.model.documentRoot; } if (elt) { viewUtils.pushViewportObj(elt); -- cgit v1.2.3