diff options
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/FillTool.js | 20 | ||||
-rwxr-xr-x | js/tools/LineTool.js | 13 | ||||
-rwxr-xr-x | js/tools/OvalTool.js | 23 | ||||
-rwxr-xr-x | js/tools/RectTool.js | 23 | ||||
-rwxr-xr-x | js/tools/ShapeTool.js | 1 | ||||
-rwxr-xr-x | js/tools/TagTool.js | 12 |
6 files changed, 62 insertions, 30 deletions
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 477966da..fabcec69 100755 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js | |||
@@ -54,10 +54,24 @@ exports.FillTool = Montage.create(ModifierToolBase, { | |||
54 | value: function(event) { | 54 | value: function(event) { |
55 | this.isDrawing = true; | 55 | this.isDrawing = true; |
56 | 56 | ||
57 | if(this._canColor) | 57 | if(this._canColor && this.application.ninja.selectedElements.length) |
58 | { | 58 | { |
59 | var color = this.application.ninja.colorController.colorToolbar.fill; | 59 | var color = this.application.ninja.colorController.colorToolbar.fill, |
60 | ElementsMediator.setColor(this.application.ninja.selectedElements, color, true, "Change", "fillTool"); | 60 | colorInfo; |
61 | if(color && color.color) | ||
62 | { | ||
63 | colorInfo = { mode:color.colorMode, | ||
64 | color:color.color | ||
65 | }; | ||
66 | ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | colorInfo = { mode:"nocolor", | ||
71 | color:color.color | ||
72 | }; | ||
73 | ElementsMediator.setColor(this.application.ninja.selectedElements, colorInfo, true, "Change", "fillTool"); | ||
74 | } | ||
61 | } | 75 | } |
62 | } | 76 | } |
63 | } | 77 | } |
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js index 042ba0b2..99c374a7 100755 --- a/js/tools/LineTool.js +++ b/js/tools/LineTool.js | |||
@@ -99,6 +99,7 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
99 | } | 99 | } |
100 | this.RenderShape(w, h, drawData.planeMat, drawData.midPt, | 100 | this.RenderShape(w, h, drawData.planeMat, drawData.midPt, |
101 | canvas, slope, xAdj, yAdj); | 101 | canvas, slope, xAdj, yAdj); |
102 | NJevent("elementAdded", canvas); | ||
102 | } | 103 | } |
103 | 104 | ||
104 | this.endDraw(event); | 105 | this.endDraw(event); |
@@ -202,10 +203,10 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
202 | // for default stroke and fill/no materials | 203 | // for default stroke and fill/no materials |
203 | var strokeMaterial = null; | 204 | var strokeMaterial = null; |
204 | 205 | ||
205 | var strokeIndex = parseInt(this.options.strokeMaterial); | 206 | var strokeM = this.options.strokeMaterial; |
206 | if(strokeIndex > 0) | 207 | if(strokeM) |
207 | { | 208 | { |
208 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 209 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
209 | } | 210 | } |
210 | 211 | ||
211 | var world = this.getGLWorld(canvas, this.options.use3D); | 212 | var world = this.getGLWorld(canvas, this.options.use3D); |
@@ -225,14 +226,18 @@ exports.LineTool = Montage.create(ShapeTool, { | |||
225 | canvas.elementModel.pi = "LinePi"; | 226 | canvas.elementModel.pi = "LinePi"; |
226 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; | 227 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; |
227 | canvas.elementModel.shapeModel.stroke = strokeColor; | 228 | canvas.elementModel.shapeModel.stroke = strokeColor; |
229 | if(strokeColor) | ||
230 | { | ||
231 | canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; | ||
232 | } | ||
228 | 233 | ||
229 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 234 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
230 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
231 | 235 | ||
232 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 236 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
233 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 237 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |
234 | 238 | ||
235 | canvas.elementModel.shapeModel.GLGeomObj = line; | 239 | canvas.elementModel.shapeModel.GLGeomObj = line; |
240 | canvas.elementModel.shapeModel.useWebGl = this.options.use3D; | ||
236 | } | 241 | } |
237 | else | 242 | else |
238 | { | 243 | { |
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index e0f1f03f..14655312 100755 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js | |||
@@ -43,16 +43,16 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
43 | var strokeMaterial = null; | 43 | var strokeMaterial = null; |
44 | var fillMaterial = null; | 44 | var fillMaterial = null; |
45 | 45 | ||
46 | var strokeIndex = parseInt(this.options.strokeMaterial); | 46 | var strokeM = this.options.strokeMaterial; |
47 | if(strokeIndex > 0) | 47 | if(strokeM) |
48 | { | 48 | { |
49 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 49 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
50 | } | 50 | } |
51 | 51 | ||
52 | var fillIndex = parseInt(this.options.fillMaterial); | 52 | var fillM = this.options.fillMaterial; |
53 | if(fillIndex > 0) | 53 | if(fillM) |
54 | { | 54 | { |
55 | fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); | 55 | fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
@@ -75,18 +75,25 @@ exports.OvalTool = Montage.create(ShapeTool, { | |||
75 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; | 75 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; |
76 | canvas.elementModel.shapeModel.stroke = strokeColor; | 76 | canvas.elementModel.shapeModel.stroke = strokeColor; |
77 | canvas.elementModel.shapeModel.fill = fillColor; | 77 | canvas.elementModel.shapeModel.fill = fillColor; |
78 | if(strokeColor) | ||
79 | { | ||
80 | canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; | ||
81 | } | ||
82 | if(fillColor) | ||
83 | { | ||
84 | canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; | ||
85 | } | ||
78 | 86 | ||
79 | canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units; | 87 | canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units; |
80 | 88 | ||
81 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 89 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
82 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; | 90 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; |
83 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
84 | canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; | ||
85 | 91 | ||
86 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 92 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
87 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 93 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |
88 | 94 | ||
89 | canvas.elementModel.shapeModel.GLGeomObj = oval; | 95 | canvas.elementModel.shapeModel.GLGeomObj = oval; |
96 | canvas.elementModel.shapeModel.useWebGl = this.options.use3D; | ||
90 | } | 97 | } |
91 | else | 98 | else |
92 | { | 99 | { |
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index fbf1693e..31ac7faa 100755 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js | |||
@@ -62,16 +62,16 @@ exports.RectTool = Montage.create(ShapeTool, { | |||
62 | var strokeMaterial = null; | 62 | var strokeMaterial = null; |
63 | var fillMaterial = null; | 63 | var fillMaterial = null; |
64 | 64 | ||
65 | var strokeIndex = parseInt(this.options.strokeMaterial); | 65 | var strokeM = this.options.strokeMaterial; |
66 | if(strokeIndex > 0) | 66 | if(strokeM) |
67 | { | 67 | { |
68 | strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); | 68 | strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM)); |
69 | } | 69 | } |
70 | 70 | ||
71 | var fillIndex = parseInt(this.options.fillMaterial); | 71 | var fillM = this.options.fillMaterial; |
72 | if(fillIndex > 0) | 72 | if(fillM) |
73 | { | 73 | { |
74 | fillMaterial = Object.create(MaterialsLibrary.getMaterialAt(fillIndex-1)); | 74 | fillMaterial = Object.create(MaterialsLibrary.getMaterial(fillM)); |
75 | } | 75 | } |
76 | 76 | ||
77 | var world = this.getGLWorld(canvas, this.options.use3D); | 77 | var world = this.getGLWorld(canvas, this.options.use3D); |
@@ -94,6 +94,14 @@ exports.RectTool = Montage.create(ShapeTool, { | |||
94 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; | 94 | canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; |
95 | canvas.elementModel.shapeModel.stroke = strokeColor; | 95 | canvas.elementModel.shapeModel.stroke = strokeColor; |
96 | canvas.elementModel.shapeModel.fill = fillColor; | 96 | canvas.elementModel.shapeModel.fill = fillColor; |
97 | if(strokeColor) | ||
98 | { | ||
99 | canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke; | ||
100 | } | ||
101 | if(fillColor) | ||
102 | { | ||
103 | canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill; | ||
104 | } | ||
97 | 105 | ||
98 | canvas.elementModel.shapeModel.tlRadius = this.options.TLRadiusControl.value + " " + this.options.TLRadiusControl.units; | 106 | canvas.elementModel.shapeModel.tlRadius = this.options.TLRadiusControl.value + " " + this.options.TLRadiusControl.units; |
99 | canvas.elementModel.shapeModel.trRadius = this.options.TRRadiusControl.value + " " + this.options.TRRadiusControl.units; | 107 | canvas.elementModel.shapeModel.trRadius = this.options.TRRadiusControl.value + " " + this.options.TRRadiusControl.units; |
@@ -102,13 +110,12 @@ exports.RectTool = Montage.create(ShapeTool, { | |||
102 | 110 | ||
103 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; | 111 | canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; |
104 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; | 112 | canvas.elementModel.shapeModel.fillMaterial = fillMaterial; |
105 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; | ||
106 | canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex; | ||
107 | 113 | ||
108 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; | 114 | canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; |
109 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; | 115 | canvas.elementModel.shapeModel.strokeStyle = strokeStyle; |
110 | 116 | ||
111 | canvas.elementModel.shapeModel.GLGeomObj = rect; | 117 | canvas.elementModel.shapeModel.GLGeomObj = rect; |
118 | canvas.elementModel.shapeModel.useWebGl = this.options.use3D; | ||
112 | } | 119 | } |
113 | else | 120 | else |
114 | { | 121 | { |
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 9a4399b4..4ccb7a8d 100755 --- a/js/tools/ShapeTool.js +++ b/js/tools/ShapeTool.js | |||
@@ -83,6 +83,7 @@ exports.ShapeTool = Montage.create(DrawingTool, { | |||
83 | } | 83 | } |
84 | } | 84 | } |
85 | this.RenderShape(drawData.width, drawData.height, drawData.planeMat, drawData.midPt, canvas); | 85 | this.RenderShape(drawData.width, drawData.height, drawData.planeMat, drawData.midPt, canvas); |
86 | NJevent("elementAdded", canvas); | ||
86 | } | 87 | } |
87 | 88 | ||
88 |