aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorJonathan Duran2012-04-10 08:13:00 -0700
committerJonathan Duran2012-04-10 08:13:00 -0700
commit58e049b68e03abbacde93206d2666361022c0858 (patch)
treef1ce6b8a378674d4abcac68acd0bcca93b838a39 /js/tools
parenta9050f96d814469f420bcf3630d16d576b62258e (diff)
parentbd43ce383b050d03b0f92cc923c517febc66ca28 (diff)
downloadninja-58e049b68e03abbacde93206d2666361022c0858.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/BrushTool.js8
-rwxr-xr-xjs/tools/FillTool.js20
-rwxr-xr-xjs/tools/InkBottleTool.js21
-rwxr-xr-xjs/tools/LineTool.js11
-rwxr-xr-xjs/tools/OvalTool.js15
-rwxr-xr-xjs/tools/PenTool.js8
-rwxr-xr-xjs/tools/RectTool.js15
-rwxr-xr-xjs/tools/Rotate3DToolBase.js15
-rwxr-xr-xjs/tools/RotateObject3DTool.js1
-rwxr-xr-xjs/tools/RotateStage3DTool.js5
-rwxr-xr-xjs/tools/SelectionTool.js62
-rwxr-xr-xjs/tools/ShapeTool.js18
-rwxr-xr-xjs/tools/TagTool.js19
-rwxr-xr-xjs/tools/Translate3DToolBase.js38
-rwxr-xr-xjs/tools/TranslateObject3DTool.js33
-rwxr-xr-xjs/tools/drawing-tool-base.js2
-rwxr-xr-xjs/tools/modifier-tool-base.js26
17 files changed, 180 insertions, 137 deletions
diff --git a/js/tools/BrushTool.js b/js/tools/BrushTool.js
index 2171d2c6..4347658a 100644
--- a/js/tools/BrushTool.js
+++ b/js/tools/BrushTool.js
@@ -305,7 +305,7 @@ exports.BrushTool = Montage.create(ShapeTool, {
305 305
306 if (!canvas) { 306 if (!canvas) {
307 var newCanvas = NJUtils.makeNJElement("canvas", "Brushstroke", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); 307 var newCanvas = NJUtils.makeNJElement("canvas", "Brushstroke", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true);
308 var elementModel = TagTool.makeElement(w, h, planeMat, midPt, newCanvas); 308 var elementModel = TagTool.makeElement(w, h, planeMat, midPt, newCanvas, true);
309 ElementMediator.addElements(newCanvas, elementModel.data, false); 309 ElementMediator.addElements(newCanvas, elementModel.data, false);
310 310
311 // create all the GL stuff 311 // create all the GL stuff
@@ -334,12 +334,6 @@ exports.BrushTool = Montage.create(ShapeTool, {
334 newCanvas.elementModel.selection = "BrushStroke"; 334 newCanvas.elementModel.selection = "BrushStroke";
335 newCanvas.elementModel.pi = "BrushStrokePi"; 335 newCanvas.elementModel.pi = "BrushStrokePi";
336 newCanvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; 336 newCanvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
337 var strokeColor = this._selectedBrushStroke.getStrokeColor();
338 newCanvas.elementModel.shapeModel.stroke = strokeColor;
339 if(strokeColor) {
340 newCanvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke;
341 }
342 newCanvas.elementModel.shapeModel.strokeMaterial = this._selectedBrushStroke.getStrokeMaterial();
343 337
344 newCanvas.elementModel.shapeModel.GLGeomObj = brushStroke; 338 newCanvas.elementModel.shapeModel.GLGeomObj = brushStroke;
345 newCanvas.elementModel.shapeModel.useWebGl = this.options.use3D; 339 newCanvas.elementModel.shapeModel.useWebGl = this.options.use3D;
diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js
index 4b07ae83..746f20cf 100755
--- a/js/tools/FillTool.js
+++ b/js/tools/FillTool.js
@@ -17,11 +17,12 @@ var Montage = require("montage/core/core").Montage,
17exports.FillTool = Montage.create(ModifierToolBase, { 17exports.FillTool = Montage.create(ModifierToolBase, {
18 _canSnap: { value: false }, 18 _canSnap: { value: false },
19 _canColor: { value: true }, 19 _canColor: { value: true },
20 _targetedElement: { value: null },
20 21
21 HandleMouseMove: { 22 HandleMouseMove: {
22 value : function (event) 23 value : function (event)
23 { 24 {
24 var obj = this.application.ninja.stage.GetElement(event); 25 var obj = this.application.ninja.stage.GetSelectableElement(event);
25 var cursor = "url('images/cursors/fill.png') 14 14, default"; 26 var cursor = "url('images/cursors/fill.png') 14 14, default";
26 var canColor = true; 27 var canColor = true;
27 if (obj) 28 if (obj)
@@ -31,6 +32,23 @@ exports.FillTool = Montage.create(ModifierToolBase, {
31 { 32 {
32 cursor = "url('images/cursors/nofill.png') 14 14, default"; 33 cursor = "url('images/cursors/nofill.png') 14 14, default";
33 canColor = false; 34 canColor = false;
35 if(this._targetedElement)
36 {
37 this._targetedElement.classList.remove("active-element-outline");
38 this._targetedElement = null;
39 }
40 }
41 else
42 {
43 if (obj !== this._targetedElement)
44 {
45 if(this._targetedElement)
46 {
47 this._targetedElement.classList.remove("active-element-outline");
48 }
49 }
50 this._targetedElement = obj;
51 this._targetedElement.classList.add("active-element-outline");
34 } 52 }
35 } 53 }
36 this.application.ninja.stage.drawingCanvas.style.cursor = cursor; 54 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
diff --git a/js/tools/InkBottleTool.js b/js/tools/InkBottleTool.js
index 8340ef50..95c2e71d 100755
--- a/js/tools/InkBottleTool.js
+++ b/js/tools/InkBottleTool.js
@@ -11,11 +11,12 @@ var Montage = require("montage/core/core").Montage,
11exports.InkBottleTool = Montage.create(ModifierToolBase, { 11exports.InkBottleTool = Montage.create(ModifierToolBase, {
12 _canSnap: { value: false }, 12 _canSnap: { value: false },
13 _canColor: { value: true }, 13 _canColor: { value: true },
14 _targetedElement: { value: null },
14 15
15 HandleMouseMove: { 16 HandleMouseMove: {
16 value : function (event) 17 value : function (event)
17 { 18 {
18 var obj = this.application.ninja.stage.GetElement(event); 19 var obj = this.application.ninja.stage.GetSelectableElement(event);
19 var cursor = "url('images/cursors/ink.png') 6 11, default"; 20 var cursor = "url('images/cursors/ink.png') 6 11, default";
20 var canColor = true; 21 var canColor = true;
21 if (obj) 22 if (obj)
@@ -25,7 +26,25 @@ exports.InkBottleTool = Montage.create(ModifierToolBase, {
25 { 26 {
26 cursor = "url('images/cursors/ink_no.png') 6 11, default"; 27 cursor = "url('images/cursors/ink_no.png') 6 11, default";
27 canColor = false; 28 canColor = false;
29 if(this._targetedElement)
30 {
31 this._targetedElement.classList.remove("active-element-outline");
32 this._targetedElement = null;
33 }
28 } 34 }
35 else
36 {
37 if (obj !== this._targetedElement)
38 {
39 if(this._targetedElement)
40 {
41 this._targetedElement.classList.remove("active-element-outline");
42 }
43 }
44 this._targetedElement = obj;
45 this._targetedElement.classList.add("active-element-outline");
46 }
47
29 } 48 }
30 this.application.ninja.stage.drawingCanvas.style.cursor = cursor; 49 this.application.ninja.stage.drawingCanvas.style.cursor = cursor;
31 this._canColor = canColor; 50 this._canColor = canColor;
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 455f519e..3e9167fd 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -78,7 +78,7 @@ exports.LineTool = Montage.create(ShapeTool, {
78 } 78 }
79 79
80 canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true); 80 canvas = NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": NJUtils.generateRandom()}, true);
81 var elementModel = TagTool.makeElement(w, h, drawData.planeMat, drawData.midPt, canvas); 81 var elementModel = TagTool.makeElement(w, h, drawData.planeMat, drawData.midPt, canvas, true);
82 canvas.elementModel.isShape = true; 82 canvas.elementModel.isShape = true;
83 this.application.ninja.elementMediator.addElements(canvas, elementModel.data); 83 this.application.ninja.elementMediator.addElements(canvas, elementModel.data);
84 } else { 84 } else {
@@ -225,6 +225,7 @@ exports.LineTool = Montage.create(ShapeTool, {
225 { 225 {
226 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 226 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
227 } 227 }
228 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor;
228 } 229 }
229 230
230 var world = this.getGLWorld(canvas, this.options.use3D); 231 var world = this.getGLWorld(canvas, this.options.use3D);
@@ -243,19 +244,13 @@ exports.LineTool = Montage.create(ShapeTool, {
243 canvas.elementModel.selection = "Line"; 244 canvas.elementModel.selection = "Line";
244 canvas.elementModel.pi = "LinePi"; 245 canvas.elementModel.pi = "LinePi";
245 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; 246 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
246 canvas.elementModel.shapeModel.stroke = strokeColor;
247 if(strokeColor)
248 {
249 canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke;
250 }
251
252 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial;
253 247
254 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; 248 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex;
255 canvas.elementModel.shapeModel.strokeStyle = strokeStyle; 249 canvas.elementModel.shapeModel.strokeStyle = strokeStyle;
256 250
257 canvas.elementModel.shapeModel.GLGeomObj = line; 251 canvas.elementModel.shapeModel.GLGeomObj = line;
258 canvas.elementModel.shapeModel.useWebGl = this.options.use3D; 252 canvas.elementModel.shapeModel.useWebGl = this.options.use3D;
253 canvas.elementModel.shapeModel.slope = slope;
259 } 254 }
260 else 255 else
261 { 256 {
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index a10e0bb5..e8e88d1d 100755
--- a/js/tools/OvalTool.js
+++ b/js/tools/OvalTool.js
@@ -53,12 +53,14 @@ exports.OvalTool = Montage.create(ShapeTool, {
53 { 53 {
54 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 54 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
55 } 55 }
56 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor;
56 57
57 var fillM = this.options.fillMaterial; 58 var fillM = this.options.fillMaterial;
58 if(fillM) 59 if(fillM)
59 { 60 {
60 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 61 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
61 } 62 }
63 fillColor = ShapesController.getMaterialColor(fillM) || fillColor;
62 } 64 }
63 65
64 var world = this.getGLWorld(canvas, this.options.use3D); 66 var world = this.getGLWorld(canvas, this.options.use3D);
@@ -78,22 +80,9 @@ exports.OvalTool = Montage.create(ShapeTool, {
78 canvas.elementModel.selection = "Oval"; 80 canvas.elementModel.selection = "Oval";
79 canvas.elementModel.pi = "OvalPi"; 81 canvas.elementModel.pi = "OvalPi";
80 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; 82 canvas.elementMo