diff options
Diffstat (limited to 'js/tools')
-rw-r--r-- | js/tools/BrushTool.js | 2 | ||||
-rwxr-xr-x | js/tools/FillTool.js | 7 | ||||
-rwxr-xr-x | js/tools/InkBottleTool.js | 2 | ||||
-rwxr-xr-x | js/tools/LineTool.js | 9 | ||||
-rwxr-xr-x | js/tools/OvalTool.js | 6 | ||||
-rwxr-xr-x | js/tools/PanTool.js | 77 | ||||
-rwxr-xr-x | js/tools/PenTool.js | 6 | ||||
-rwxr-xr-x | js/tools/PencilTool.js | 32 | ||||
-rwxr-xr-x | js/tools/RectTool.js | 6 | ||||
-rwxr-xr-x | js/tools/Rotate3DToolBase.js | 12 | ||||
-rwxr-xr-x | js/tools/RotateStage3DTool.js | 40 | ||||
-rwxr-xr-x | js/tools/SelectionTool.js | 11 | ||||
-rwxr-xr-x | js/tools/ShapeTool.js | 2 | ||||
-rwxr-xr-x | js/tools/TagTool.js | 5 | ||||
-rwxr-xr-x | js/tools/TextTool.js | 40 | ||||
-rwxr-xr-x | js/tools/Translate3DToolBase.js | 4 | ||||
-rwxr-xr-x | js/tools/TranslateObject3DTool.js | 9 | ||||
-rwxr-xr-x | js/tools/ZoomTool.js | 6 | ||||
-rwxr-xr-x | js/tools/drawing-tool-base.js | 44 | ||||
-rwxr-xr-x | js/tools/modifier-tool-base.js | 8 |
20 files changed, 146 insertions, 182 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js index 5c334b92..0be378fd 100644 --- a/js/tools/BrushTool.js +++ b/js/tools/BrushTool.js | |||
@@ -132,7 +132,7 @@ exports.BrushTool = Montage.create(ShapeTool, { | |||
132 | if (this._selectedBrushStroke === null){ | 132 | if (this._selectedBrushStroke === null){ |
133 | this._selectedBrushStroke = new BrushStroke(); | 133 | this._selectedBrushStroke = new BrushStroke(); |
134 | var colorArray=[0,0,0,0]; | 134 | var colorArray=[0,0,0,0]; |
135 | var color = this.application.ninja.colorController.colorToolbar.fill.color; | 135 | var color = this.options.fill.color; |
136 | if (color){ | 136 | if (color){ |
137 | colorArray = [color.r/255, color.g/255, color.b/255, color.a]; | 137 | colorArray = [color.r/255, color.g/255, color.b/255, color.a]; |
138 | } else { | 138 | } else { |
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 87a093ff..66dd9305 100755 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js | |||
@@ -72,9 +72,9 @@ exports.FillTool = Montage.create(ModifierToolBase, { | |||
72 | value: function(event) { | 72 | value: function(event) { |
73 | this.isDrawing = true; | 73 | this.isDrawing = true; |
74 | 74 | ||
75 | if(this._canColor && this.application.ninja.selectedElements.length) | 75 | if(this._canColor && this.application.ninja.selectedElements.length) { |
76 | { | 76 | |
77 | var color = this.application.ninja.colorController.colorToolbar.fill, | 77 | var color = this.options.fill, |
78 | colorInfo; | 78 | colorInfo; |
79 | if(color && color.color) | 79 | if(color && color.color) |
80 | { | 80 | { |
@@ -92,5 +92,4 @@ exports.FillTool = Montage.create(ModifierToolBase, { | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | } | 94 | } |
95 | |||
96 | }); \ No newline at end of file | 95 | }); \ No newline at end of file |
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js index fd17f4d6..2c03d133 100755 --- a/js/tools/InkBottleTool.js +++ b/js/tools/InkBottleTool.js | |||
@@ -69,7 +69,7 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, { | |||
69 | 69 | ||
70 | if(this._canColor && this.application.ninja.selectedElements.length) | 70 | if(this._canColor && this.application.ninja.selectedElements.length) |
71 | { | 71 | { |
72 | var color = this.application.ninja.colorController.colorToolbar.stroke, | 72 | var color = this.options.stroke, |
73 | colorInfo; | 73 | colorInfo; |
74 | if(color && color.color) | 74 | if(color && color.color) |
75 | { | 75 | { |
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 5941b464..b2b48383 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js | |||
@@ -44,8 +44,8 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); | 46 | this._strokeSize = ShapesController.GetValueInPixels(this.options.strokeSize.value, this.options.strokeSize.units, null); |
47 | if (this.application.ninja.colorController.colorToolbar.stroke.color) | 47 | if (this.options.stroke.color) |
48 | this._strokeColor = this.application.ninja.colorController.colorToolbar.stroke.color.css; | 48 | this._strokeColor = this.options.stroke.color.css; |
49 | else | 49 | else |
50 | this._strokeColor = [0,0,0,1]; | 50 | this._strokeColor = [0,0,0,1]; |
51 | this.startDraw(event); | 51 | this.startDraw(event); |
@@ -215,7 +215,7 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
215 | var left = Math.round(midPt[0] - 0.5*w); | 215 | var left = Math.round(midPt[0] - 0.5*w); |
216 | var top = Math.round(midPt[1] - 0.5*h); | 216 | var top = Math.round(midPt[1] - 0.5*h); |
217 | 217 | ||
218 | var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; | 218 | var strokeColor = this.options.stroke.webGlColor; |
219 | // for default stroke and fill/no materials | 219 | // for default stroke and fill/no materials |
220 | var strokeMaterial = null; | 220 | var strokeMaterial = null; |
221 | 221 | ||
@@ -234,7 +234,8 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
234 | var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); | 234 | var xOffset = ((left - canvas.offsetLeft + w/2) - canvas.width/2); |
235 | var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); | 235 | var yOffset = (canvas.height/2 - (top - canvas.offsetTop + h/2)); |
236 | 236 | ||
237 | var line = new Line(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); | 237 | var line = Object.create(Line, {}); |
238 | line.init(world, xOffset, yOffset, w, h, slope, strokeSize, strokeColor, strokeMaterial, strokeStyle, xAdj, yAdj); | ||
238 | 239 | ||
239 | world.addObject(line); | 240 | world.addObject(line); |
240 | world.render(); | 241 | world.render(); |
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index 6edec811..ce812398 100755 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js | |||
@@ -39,8 +39,8 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
39 | 39 | ||
40 | var innerRadius = this.options.innerRadius.value / 100; | 40 | var innerRadius = this.options.innerRadius.value / 100; |
41 | 41 | ||
42 | var strokeColor = this.application.ninja.colorController.colorToolbar.stroke.webGlColor; | 42 | var strokeColor = this.options.stroke.webGlColor; |
43 | var fillColor = this.application.ninja.colorController.colorToolbar.fill.webGlColor; | 43 | var fillColor = this.options.fill.webGlColor; |
44 | 44 | ||
45 | // for default stroke and fill/no materials | 45 | // for default stroke and fill/no materials |
46 | var strokeMaterial = null; | 46 | var strokeMaterial = null; |
@@ -68,7 +68,7 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
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 = Object.create(Circle, {}); |
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); |
73 | 73 | ||
74 | world.addObject(oval); | 74 | world.addObject(oval); |
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index ce7606a1..39f89d17 100755 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js | |||
@@ -21,6 +21,9 @@ exports.PanTool = Montage.create(toolBase, | |||
21 | _lastGPt :{value: [0,0], writable:true}, | 21 | _lastGPt :{value: [0,0], writable:true}, |
22 | _lastY :{value: 0, writable:true}, | 22 | _lastY :{value: 0, writable:true}, |
23 | 23 | ||
24 | _maxHorizontalScroll: {value: 0, writable:true}, | ||
25 | _maxVerticalScroll: {value: 0, writable:true}, | ||
26 | |||
24 | Configure: { | 27 | Configure: { |
25 | value: function ( doActivate ) | 28 | value: function ( doActivate ) |
26 | { | 29 | { |
@@ -43,10 +46,19 @@ exports.PanTool = Montage.create(toolBase, | |||
43 | 46 | ||
44 | HandleLeftButtonDown: { | 47 | HandleLeftButtonDown: { |
45 | value : function ( event ) { | 48 | value : function ( event ) { |
46 | this._isDrawing = true; | 49 | // Determine the maximum horizontal and vertical scroll values |
47 | this.isDrawing = true; | 50 | this._maxHorizontalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollWidth - this.application.ninja.stage._canvas.width - 11; |
48 | 51 | this._maxVerticalScroll = this.application.ninja.currentDocument.model.documentRoot.scrollHeight - this.application.ninja.stage._canvas.height - 11; | |
49 | this.mouseDown( event ); | 52 | if((this._maxHorizontalScroll > 0) || (this._maxVerticalScroll > 0) || this._altKeyDown) |
53 | { | ||
54 | this._isDrawing = true; | ||
55 | this.isDrawing = true; | ||
56 | this.mouseDown( event ); | ||
57 | } | ||
58 | // else | ||
59 | // { | ||
60 | // console.log("nothing to scroll"); | ||
61 | // } | ||
50 | } | 62 | } |
51 | }, | 63 | }, |
52 | 64 | ||
@@ -109,7 +121,7 @@ exports.PanTool = Montage.create(toolBase, | |||
109 | { | 121 | { |
110 | value: function () | 122 | value: function () |
111 | { | 123 | { |
112 | var uc = this.application.ninja.currentDocument.documentRoot; | 124 | var uc = this.application.ninja.currentDocument.model.documentRoot; |
113 | //var uc = documentManagerModule.DocumentManager.activeDocument | 125 | //var uc = documentManagerModule.DocumentManager.activeDocument |
114 | var ucMat = viewUtils.getMatrixFromElement(uc); | 126 | var ucMat = viewUtils.getMatrixFromElement(uc); |
115 | 127 | ||
@@ -136,12 +148,11 @@ exports.PanTool = Montage.create(toolBase, | |||
136 | delta = 10*event.wheelDelta/120; | 148 | delta = 10*event.wheelDelta/120; |
137 | //console.log( "delta: " + delta ); | 149 | //console.log( "delta: " + delta ); |
138 | 150 | ||
139 | this.application.ninja.stage._iframeContainer.scrollLeft += delta; | 151 | this.application.ninja.currentDocument.model.views.design.document.body.scrollLeft += delta; |
140 | this.application.ninja.stage._scrollLeft += delta; | ||
141 | 152 | ||
142 | delta *= zoom; | 153 | delta *= zoom; |
143 | 154 | ||
144 | var uc = this.application.ninja.currentDocument.documentRoot; | 155 | var uc = this.application.ninja.currentDocument.model.documentRoot; |
145 | var ucMat = viewUtils.getMatrixFromElement(uc); | 156 | var ucMat = viewUtils.getMatrixFromElement(uc); |
146 | var offset = viewUtils.getElementOffset( uc ); | 157 | var offset = viewUtils.getElementOffset( uc ); |
147 | //console.log( "uc offset: " + offset[0] ); | 158 | //console.log( "uc offset: " + offset[0] ); |
@@ -213,7 +224,7 @@ exports.PanTool = Montage.create(toolBase, | |||
213 | if (elt) | 224 | if (elt) |
214 | { | 225 | { |
215 | // get the userContent object (stage) and its matrix | 226 | // get the userContent object (stage) and its matrix |
216 | var userContent = this.application.ninja.currentDocument.documentRoot; | 227 | var userContent = this.application.ninja.currentDocument.model.documentRoot; |
217 | var ucMat = viewUtils.getMatrixFromElement(userContent); | 228 | var ucMat = viewUtils.getMatrixFromElement(userContent); |
218 | 229 | ||
219 | var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); | 230 | var localToGlobalMat = viewUtils.getLocalToGlobalMatrix( elt ); |
@@ -291,17 +302,19 @@ exports.PanTool = Montage.create(toolBase, | |||
291 | if (this._isDrawing) | 302 | if (this._isDrawing) |
292 | { | 303 | { |
293 | // get the global screen point | 304 | // get the global screen point |
294 | var gPt = [point.x, point.y, this._globalPt[2 |