aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/OvalTool.js2
-rwxr-xr-xjs/tools/PanTool.js20
-rwxr-xr-xjs/tools/ShapeTool.js22
3 files changed, 31 insertions, 13 deletions
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index e8e88d1d..6edec811 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -66,7 +66,7 @@ exports.OvalTool = Montage.create(ShapeTool, {
66 var world = this.getGLWorld(canvas, this.options.use3D); 66 var world = this.getGLWorld(canvas, this.options.use3D);
67 67
68 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); 68 var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2);
69 var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); 69 var yOffset = -(canvas.height/2 - (top - canvas.offsetTop + h/2));
70 70
71 var oval = new Circle(); //GLCircle(); 71 var oval = new Circle(); //GLCircle();
72 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle); 72 oval.init(world, xOffset, yOffset, w, h, strokeSize, strokeColor, fillColor, innerRadius, strokeMaterial, fillMaterial, strokeStyle);
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js
index 0537a27b..ce7606a1 100755
--- a/js/tools/PanTool.js
+++ b/js/tools/PanTool.js
@@ -331,10 +331,26 @@ exports.PanTool = Montage.create(toolBase,
331 331
332 if (!this._altKeyDown) 332 if (!this._altKeyDown)
333 delta[2] = 0; 333 delta[2] = 0;
334 var transMat = Matrix.Translation( delta ); 334
335 this._worldPt = wPt; 335 // limit the change
336 var ucMat = viewUtils.getMatrixFromElement(this.application.ninja.currentDocument.documentRoot);
337 var tooMuch = false
338 if ((ucMat[12] > 12000) && (delta[0] > 0)) tooMuch = true;
339 if ((ucMat[12] < -12000) && (delta[0] < 0)) tooMuch = true;
340 if ((ucMat[13] > 12000) && (delta[1] > 0)) tooMuch = true;
341 if ((ucMat[13] < -12000) && (delta[1] < 0)) tooMuch = true;
342 if ((ucMat[14] > 12000) && (delta[2] > 0)) tooMuch = true;
343 if ((ucMat[14] < -12000) && (delta[2] < 0)) tooMuch = true;
344 if (tooMuch)
345 {
346 this._isDrawing = false;
347 delta = [0,0,0];
348 }
349 else
350 this._worldPt = wPt;
336 351
337 // update everything 352 // update everything
353 var transMat = Matrix.Translation( delta );
338 this.applyDeltaMat( transMat ); 354 this.applyDeltaMat( transMat );
339 } 355 }
340 } 356 }
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js
index f3b5e92d..b2948fe7 100755
--- a/js/tools/ShapeTool.js
+++ b/js/tools/ShapeTool.js
@@ -54,9 +54,9 @@ exports.ShapeTool = Montage.create(DrawingTool, {
54 }, 54 },
55 55
56 HandleLeftButtonUp: 56 HandleLeftButtonUp:
57 { 57 {
58 value: function (event) 58 value: function (event)
59 { 59 {
60 var drawData; 60 var drawData;
61 61
62 drawData = this.getDrawingData(); 62 drawData = this.getDrawingData();
@@ -69,24 +69,26 @@ exports.ShapeTool = Montage.create(DrawingTool, {
69 drawData.planeMat, drawData.midPt, canvas, true); 69 drawData.planeMat, drawData.midPt, canvas, true);
70 70
71 canvas.elementModel.isShape = true; 71 canvas.elementModel.isShape = true;
72 this.application.ninja.elementMediator.addElements(canvas, elementModel.data);
73 } else { 72 } else {
74 canvas = this._targetedElement; 73 canvas = this._targetedElement;
74 if (!canvas.getAttribute( "data-RDGE-id" ))
75 canvas.setAttribute( "data-RDGE-id", NJUtils.generateRandom() );
75 canvas.elementModel.controller = ShapesController; 76 canvas.elementModel.controller = ShapesController;
76 if(!canvas.elementModel.shapeModel) { 77 if(!canvas.elementModel.shapeModel) {
77 canvas.elementModel.shapeModel = Montage.create(ShapeModel); 78 canvas.elementModel.shapeModel = Montage.create(ShapeModel);
78 } 79 }
79 } 80 }
81 this.application.ninja.elementMediator.addElements(canvas, canvas.elementModel.data);
80 } 82 }
81 83
82 this.endDraw(event); 84 this.endDraw(event);
83 85
84 this._isDrawing = false; 86 this._isDrawing = false;
85 this._hasDraw=false; 87 this._hasDraw=false;
86 88
87 this.DrawHandles(); 89 this.DrawHandles();
88 } 90 }
89 }, 91 },
90 92
91 onAddElements: { 93 onAddElements: {
92 value: function(el) { 94 value: function(el) {