From 4c3aac5eabd93052b1554a03d78235215bb49db4 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 29 May 2012 00:34:40 -0700 Subject: document bindings phase 1 - using array controller to bind the current document to all ninja components - removed open document event - removed references to the document controller Signed-off-by: Valerio Virgillito --- js/tools/PanTool.js | 1 - 1 file changed, 1 deletion(-) (limited to 'js/tools') diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index 39f89d17..a8911c0c 100755 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js @@ -122,7 +122,6 @@ exports.PanTool = Montage.create(toolBase, value: function () { var uc = this.application.ninja.currentDocument.model.documentRoot; - //var uc = documentManagerModule.DocumentManager.activeDocument var ucMat = viewUtils.getMatrixFromElement(uc); var noTrans = ucMat.slice(); -- cgit v1.2.3 From dd8a94c4ef0ccf19c332dd0a0c56fb8249aea63b Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Wed, 30 May 2012 13:13:01 -0700 Subject: Fixed bad reference to stage element in pen tool. Signed-off-by: Nivesh Rajbhandari --- js/tools/PenTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tools') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 10eb03c9..3813123a 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -428,7 +428,7 @@ exports.PenTool = Montage.create(ShapeTool, { var globalMousePos=null, localMousePos=null, stageWorldMousePos = null; var drawingCanvas = this._selectedSubpath.getCanvas(); if (!drawingCanvas){ - drawingCanvas = ViewUtils.getStageElement(); + drawingCanvas = this.application.ninja.currentDocument.model.documentRoot; stageWorldMousePos = hitRec.calculateStageWorldPoint(); stageWorldMousePos[0]+= snapManager.getStageWidth()*0.5; stageWorldMousePos[1]+= snapManager.getStageHeight()*0.5; -- cgit v1.2.3 From 4dde49e0376e2cb64140f5baa85f5cadae0c9e16 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 1 Jun 2012 14:59:04 -0700 Subject: IKNinja-1609 - Stage rotates too fast when closing and re-opening file or switching between files. Signed-off-by: Nivesh Rajbhandari --- js/tools/RotateStage3DTool.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'js/tools') diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js index 12b21a64..9e117837 100755 --- a/js/tools/RotateStage3DTool.js +++ b/js/tools/RotateStage3DTool.js @@ -85,6 +85,12 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { } }, + captureSelectionChange: { + value: function(event){ + this.eventManager.addEventListener("selectionDrawn", this, true); + } + }, + captureSelectionDrawn: { value: function(event){ this._origin = null; @@ -114,6 +120,11 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, { this._origin = viewUtils.localToGlobal(eltCtr, stage); this._setTransformOrigin(false); this.DrawHandles(); + + if(event) + { + this.eventManager.removeEventListener("selectionDrawn", this, true); + } } }, -- cgit v1.2.3 From 6db48c84047466baadfb6132cba9dbc6e0d3799c Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Fri, 1 Jun 2012 16:09:51 -0700 Subject: IKNinja-1610 and IKNinja-1647 - Can't use transform tool if you haven't used a drawing tool yet. Signed-off-by: Nivesh Rajbhandari --- js/tools/drawing-tool-base.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/tools') diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js index 3549de1c..a752ad65 100755 --- a/js/tools/drawing-tool-base.js +++ b/js/tools/drawing-tool-base.js @@ -86,7 +86,7 @@ exports.DrawingToolBase = Montage.create(Component, { // return null; // } if(downHitRec) { - hitRec = hitRec.convertToWorkingPlane(this.dragPlane); + hitRec = hitRec.convertToWorkingPlane(this.dragPlane || downHitRec.getPlane()); } else if ((hitRec.getType() !== hitRec.SNAP_TYPE_STAGE) && !hitRec.isSomeGridTypeSnap()) { hitRec = hitRec.convertToWorkingPlane( snapManager.getDragPlane() ); } -- cgit v1.2.3 From 3293b0b730227c14bd4f7bd53c125b48f9886764 Mon Sep 17 00:00:00 2001 From: Pushkar Joshi Date: Tue, 5 Jun 2012 14:53:15 -0700 Subject: handle switching between multiple documents for Pen tool by having its own selection change handler --- js/tools/PenTool.js | 91 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 83 insertions(+), 8 deletions(-) (limited to 'js/tools') diff --git a/js/tools/PenTool.js b/js/tools/PenTool.js index 1536a334..4daae420 100755 --- a/js/tools/PenTool.js +++ b/js/tools/PenTool.js @@ -46,7 +46,6 @@ exports.PenTool = Montage.create(ShapeTool, { _isEscapeDown: {value: false, writable: true }, //whether we have just started a new path (may set true in mousedown, and always set false in mouse up - //todo this seems to be unnecessary _isNewPath: {value: false, writable: true}, //whether we have clicked one of the endpoints after entering the pen tool in ENTRY_SELECT_PATH edit mode @@ -73,7 +72,10 @@ exports.PenTool = Montage.create(ShapeTool, { //the center of the subpath center in stageworld space _selectedSubpathCanvasCenter: {value: null, writable: true}, - + + //this flag is set true by the Configure(true) and set false by Configure(false) or handleSelectionChange + _doesSelectionChangeNeedHandling: {value: false, writable: true}, + //constants used for picking points --- todo: these should be user-settable parameters _PICK_POINT_RADIUS: { value: 4, writable: false }, _DISPLAY_ANCHOR_RADIUS: { value: 5, writable: false }, @@ -286,7 +288,7 @@ exports.PenTool = Montage.create(ShapeTool, { //assume we are not starting a new path as we will set this to true if we create a new Subpath() this._isNewPath = false; - + //if we had closed the selected subpath previously, or if we have not yet started anything, create a subpath if (this._entryEditMode !== this.ENTRY_SELECT_PATH && this._selectedSubpath && this._selectedSubpath.getIsClosed() && this._makeMultipleSubpaths) { this._selectedSubpath = null; @@ -691,6 +693,7 @@ exports.PenTool = Montage.create(ShapeTool, { var top = Math.round(midPt[1] - 0.5 * h); if (!canvas) { + this._doesSelectionChangeNeedHandling = false; //this will ignore the selection change event triggered by the new canvas var newCanvas = document.application.njUtils.make("canvas", {"data-RDGE-id": NJUtils.generateRandom()}, this.application.ninja.currentDocument); document.application.njUtils.createModelWithShape(newCanvas, "Subpath"); var styles = document.application.njUtils.stylesFromDraw(newCanvas, parseInt(w), parseInt(h), {midPt: midPt, planeMat: planeMat}); @@ -733,8 +736,9 @@ exports.PenTool = Montage.create(ShapeTool, { //now send the event that will add this canvas to the timeline NJevent("elementAdded", newCanvas); - if(newCanvas.elementModel.isShape) //todo why is this not true for the path canvas? + if(newCanvas.elementModel.isShape) { + this._doesSelectionChangeNeedHandling = false; //this will ignore the selection change event triggered by the new canvas this.application.ninja.selectionController.selectElement(newCanvas); } } //if (!canvas) { @@ -775,8 +779,9 @@ exports.PenTool = Montage.create(ShapeTool, { //TODO this will not work if there are multiple shapes in the same canvas canvas.elementModel.shapeModel.GLGeomObj = subpath; - if(canvas.elementModel.isShape) //todo why is this not true for the path canvas? + if(canvas.elementModel.isShape) { + this._doesSelectionChangeNeedHandling = false; //this will ignore the selection change event triggered by the canvas this.application.ninja.selectionController.selectElement(canvas); } } //else of if (!canvas) { @@ -843,6 +848,7 @@ exports.PenTool = Montage.create(ShapeTool, { this.ShowSelectedSubpath(); } //if (this._selectedSubpath.getNumPoints() > 0) { + //always assume that we're not starting a new path anymore this._isNewPath = false; this._editMode = this.EDIT_NONE; @@ -1404,6 +1410,8 @@ exports.PenTool = Montage.create(ShapeTool, { this._selectedSubpathCanvas = null; this._selectedSubpathPlaneMat = null; this._snapTargetIndex = -1; + //clear the canvas + this.application.ninja.stage.clearDrawingCanvas(); } }, //if the document is opened with the pen tool being active, we do the same thing as when configure(false) is called @@ -1442,9 +1450,14 @@ exports.PenTool = Montage.create(ShapeTool, { this.application.ninja.stage.drawingCanvas.style.cursor = //"auto"; "url('images/cursors/penCursors/Pen_newPath.png') 5 1, default"; - if (this.application.ninja.selectedElements.length === 0){ + //TODO in case of switching between docs, this call to setEntryMode may refer to the old document, + // which is why we set the _doesSelectionChangeNeedHandling flag next + this.setEntryMode(); + this._doesSelectionChangeNeedHandling = true; //this will make sure that the setEntry mode gets called by the selectionChange handler + /*if (this.application.ninja.selectedElements.length === 0){ this._entryEditMode = this.ENTRY_SELECT_NONE; } + else{ for (var i=0;i