diff options
Diffstat (limited to 'js/tools')
-rw-r--r-- | js/tools/FillTool.js | 20 | ||||
-rw-r--r-- | js/tools/LineTool.js | 5 | ||||
-rw-r--r-- | js/tools/OvalTool.js | 8 | ||||
-rw-r--r-- | js/tools/PanTool.js | 2 | ||||
-rw-r--r-- | js/tools/RectTool.js | 8 | ||||
-rw-r--r-- | js/tools/ShapeTool.js | 1 | ||||
-rw-r--r-- | js/tools/ZoomTool.js | 8 |
7 files changed, 44 insertions, 8 deletions
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 477966da..fabcec69 100644 --- 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..17157f23 100644 --- 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); |
@@ -225,6 +226,10 @@ 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; | 235 | canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex; |
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js index e0f1f03f..2fa5411b 100644 --- a/js/tools/OvalTool.js +++ b/js/tools/OvalTool.js | |||
@@ -75,6 +75,14 @@ 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 | ||
diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index 55a03674..71301d46 100644 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js | |||
@@ -80,7 +80,6 @@ exports.PanTool = Montage.create(toolBase, | |||
80 | if(event.altKey) | 80 | if(event.altKey) |
81 | { | 81 | { |
82 | this._altKeyDown = true; | 82 | this._altKeyDown = true; |
83 | //console.log( "altKeyDown" ); | ||
84 | } | 83 | } |
85 | } | 84 | } |
86 | }, | 85 | }, |
@@ -90,7 +89,6 @@ exports.PanTool = Montage.create(toolBase, | |||
90 | if(event.keyCode === Keyboard.ALT) | 89 | if(event.keyCode === Keyboard.ALT) |
91 | { | 90 | { |
92 | this._altKeyDown = false; | 91 | this._altKeyDown = false; |
93 | console.log( "altKeyUp" ); | ||
94 | } | 92 | } |
95 | } | 93 | } |
96 | }, | 94 | }, |
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js index fbf1693e..94d80b53 100644 --- a/js/tools/RectTool.js +++ b/js/tools/RectTool.js | |||
@@ -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; |
diff --git a/js/tools/ShapeTool.js b/js/tools/ShapeTool.js index 9a4399b4..4ccb7a8d 100644 --- 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 | this.endDraw(event); | 89 | this.endDraw(event); |
diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js index 73297d16..4b6705c1 100644 --- a/js/tools/ZoomTool.js +++ b/js/tools/ZoomTool.js | |||
@@ -140,9 +140,11 @@ exports.ZoomTool = Montage.create(DrawingTool, { | |||
140 | { | 140 | { |
141 | value : function (event) | 141 | value : function (event) |
142 | { | 142 | { |
143 | // check for some reasonable amount of mouse movement | 143 | var point = webkitConvertPointFromPageToNode(this.application.ninja.stage.canvas, |
144 | var dx = Math.abs(event.layerX - this.downPoint.x), | 144 | new WebKitPoint(event.pageX, event.pageY)); |
145 | dy = Math.abs(event.layerY - this.downPoint.y); | 145 | // check for some reasonable amount of mouse movement |
146 | var dx = Math.abs(point.x - this.downPoint.x), | ||
147 | dy = Math.abs(point.y - this.downPoint.y); | ||
146 | 148 | ||
147 | if ((dx >= 4) || (dy >= 4)) | 149 | if ((dx >= 4) || (dy >= 4)) |
148 | { | 150 | { |