aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-04-04 16:47:51 -0700
committerNivesh Rajbhandari2012-04-04 16:47:51 -0700
commit13368ca6ebbc13adeafccd898dfffd7ce37cb28a (patch)
treefb45f74ede82a32d686a38e71f2c42c5d2ff9370 /js/tools
parent488afcf1604df3d611eca5253d57cc5a79ed80c3 (diff)
parent8b60a68f0152c609ad94a931472680f313678d8d (diff)
downloadninja-13368ca6ebbc13adeafccd898dfffd7ce37cb28a.tar.gz
Merge branch 'refs/heads/WebGLFileIO' into ToolFixes
Conflicts: assets/canvas-runtime.js js/controllers/elements/shapes-controller.js js/lib/drawing/world.js js/lib/geom/geom-obj.js js/lib/geom/line.js js/mediators/element-mediator.js js/panels/presets/animations-presets.reel/animations-presets.js js/panels/presets/style-presets.reel/style-presets.js js/panels/presets/transitions-presets.reel/transitions-presets.js Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/FillTool.js20
-rwxr-xr-xjs/tools/InkBottleTool.js21
-rwxr-xr-xjs/tools/LineTool.js9
-rwxr-xr-xjs/tools/OvalTool.js15
-rwxr-xr-xjs/tools/RectTool.js15
-rwxr-xr-xjs/tools/SelectionTool.js1
-rwxr-xr-xjs/tools/ShapeTool.js13
-rwxr-xr-xjs/tools/Translate3DToolBase.js25
-rwxr-xr-xjs/tools/TranslateObject3DTool.js23
-rwxr-xr-xjs/tools/modifier-tool-base.js26
10 files changed, 102 insertions, 66 deletions
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..e6e05b04 100755
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -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.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
81 canvas.elementModel.shapeModel.stroke = strokeColor;
82 canvas.elementModel.shapeModel.fill = fillColor;
83 if(strokeColor)
84 {
85 canvas.elementModel.shapeModel.border = this.application.ninja.colorController.colorToolbar.stroke;
86 }
87 if(fillColor)
88 {
89 canvas.elementModel.shapeModel.background = this.application.ninja.colorController.colorToolbar.fill;
90 }
91 83
92 canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units; 84 canvas.elementModel.shapeModel.innerRadius = this.options.innerRadius.value + " " + this.options.innerRadius.units;
93 85
94 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial;
95 canvas.elementModel.shapeModel.fillMaterial = fillMaterial;
96
97 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; 86 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex;
98 canvas.elementModel.shapeModel.strokeStyle = strokeStyle; 87 canvas.elementModel.shapeModel.strokeStyle = strokeStyle;
99 88
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 957afea9..0c14a559 100755
--- a/js/tools/RectTool.js
+++ b/js/tools/RectTool.js
@@ -72,12 +72,14 @@ exports.RectTool = Montage.create(ShapeTool, {
72 { 72 {
73 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM)); 73 strokeMaterial = Object.create(MaterialsModel.getMaterial(strokeM));
74 } 74 }
75 strokeColor = ShapesController.getMaterialColor(strokeM) || strokeColor;
75 76
76 var fillM = this.options.fillMaterial; 77 var fillM = this.options.fillMaterial;
77 if(fillM) 78 if(fillM)
78 { 79 {
79 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM)); 80 fillMaterial = Object.create(MaterialsModel.getMaterial(fillM));
80 } 81 }
82 fillColor = ShapesController.getMaterialColor(fillM) || fillColor;
81 } 83 }
82 84
83 var world = this.getGLWorld(canvas, this.options.use3D); 85 var world = this.getGLWorld(canvas, this.options.use3D);
@@ -98,25 +100,12 @@ exports.RectTool = Montage.create(ShapeTool, {
98 canvas.elementModel.selection = "Rectangle"; 100 canvas.elementModel.selection = "Rectangle";
99 canvas.elementModel.pi = "RectanglePi"; 101 canvas.elementModel.pi = "RectanglePi";
100 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units; 102 canvas.elementModel.shapeModel.strokeSize = this.options.strokeSize.value + " " + this.options.strokeSize.units;
101 canvas.elementModel.shapeModel.stroke = strokeColor;
102 canvas.elementModel.shapeModel.fill = fillColor;
103 if(strokeColor)
104 {