aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-08 22:15:41 -0800
committerValerio Virgillito2012-02-08 22:15:41 -0800
commitc7df002135328edac03e72a1e4b331b2c72667f8 (patch)
treeee50509df494b069d1769b7b54afd83fd0178e64 /js/tools
parent725c54ff4af40f70b7dbd4508da34d2909cea8bd (diff)
parent35ad4d6d2fac4432046141c63c0209cf3d00be5c (diff)
downloadninja-c7df002135328edac03e72a1e4b331b2c72667f8.tar.gz
Merge branch 'refs/heads/master' into components
Diffstat (limited to 'js/tools')
-rw-r--r--js/tools/LineTool.js8
-rw-r--r--js/tools/OvalTool.js15
-rw-r--r--js/tools/RectTool.js15
-rw-r--r--js/tools/TagTool.js12
4 files changed, 23 insertions, 27 deletions
diff --git a/js/tools/LineTool.js b/js/tools/LineTool.js
index 17157f23..99c374a7 100644
--- a/js/tools/LineTool.js
+++ b/js/tools/LineTool.js
@@ -203,10 +203,10 @@ exports.LineTool = Montage.create(ShapeTool, {
203 // for default stroke and fill/no materials 203 // for default stroke and fill/no materials
204 var strokeMaterial = null; 204 var strokeMaterial = null;
205 205
206 var strokeIndex = parseInt(this.options.strokeMaterial); 206 var strokeM = this.options.strokeMaterial;
207 if(strokeIndex > 0) 207 if(strokeM)
208 { 208 {
209 strokeMaterial = Object.create(MaterialsLibrary.getMaterialAt(strokeIndex-1)); 209 strokeMaterial = Object.create(MaterialsLibrary.getMaterial(strokeM));
210 } 210 }
211 211
212 var world = this.getGLWorld(canvas, this.options.use3D); 212 var world = this.getGLWorld(canvas, this.options.use3D);
@@ -232,12 +232,12 @@ exports.LineTool = Montage.create(ShapeTool, {
232 } 232 }
233 233
234 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; 234 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial;
235 canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex;
236 235
237 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; 236 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex;
238 canvas.elementModel.shapeModel.strokeStyle = strokeStyle; 237 canvas.elementModel.shapeModel.strokeStyle = strokeStyle;
239 238
240 canvas.elementModel.shapeModel.GLGeomObj = line; 239 canvas.elementModel.shapeModel.GLGeomObj = line;
240 canvas.elementModel.shapeModel.useWebGl = this.options.use3D;
241 } 241 }
242 else 242 else
243 { 243 {
diff --git a/js/tools/OvalTool.js b/js/tools/OvalTool.js
index 2fa5411b..14655312 100644
--- 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
@@ -88,13 +88,12 @@ exports.OvalTool = Montage.create(ShapeTool, {
88 88
89 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; 89 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial;
90 canvas.elementModel.shapeModel.fillMaterial = fillMaterial; 90 canvas.elementModel.shapeModel.fillMaterial = fillMaterial;
91 canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex;
92 canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex;
93 91
94 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; 92 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex;
95 canvas.elementModel.shapeModel.strokeStyle = strokeStyle; 93 canvas.elementModel.shapeModel.strokeStyle = strokeStyle;
96 94
97 canvas.elementModel.shapeModel.GLGeomObj = oval; 95 canvas.elementModel.shapeModel.GLGeomObj = oval;
96 canvas.elementModel.shapeModel.useWebGl = this.options.use3D;
98 } 97 }
99 else 98 else
100 { 99 {
diff --git a/js/tools/RectTool.js b/js/tools/RectTool.js
index 94d80b53..31ac7faa 100644
--- 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);
@@ -110,13 +110,12 @@ exports.RectTool = Montage.create(ShapeTool, {
110 110
111 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial; 111 canvas.elementModel.shapeModel.strokeMaterial = strokeMaterial;
112 canvas.elementModel.shapeModel.fillMaterial = fillMaterial; 112 canvas.elementModel.shapeModel.fillMaterial = fillMaterial;
113 canvas.elementModel.shapeModel.strokeMaterialIndex = strokeIndex;
114 canvas.elementModel.shapeModel.fillMaterialIndex = fillIndex;
115 113
116 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex; 114 canvas.elementModel.shapeModel.strokeStyleIndex = strokeStyleIndex;
117 canvas.elementModel.shapeModel.strokeStyle = strokeStyle; 115 canvas.elementModel.shapeModel.strokeStyle = strokeStyle;
118 116
119 canvas.elementModel.shapeModel.GLGeomObj = rect; 117 canvas.elementModel.shapeModel.GLGeomObj = rect;
118 canvas.elementModel.shapeModel.useWebGl = this.options.use3D;
120 } 119 }
121 else 120 else
122 { 121 {
diff --git a/js/tools/TagTool.js b/js/tools/TagTool.js
index c527edf3..e3f49bbe 100644
--- a/js/tools/TagTool.js
+++ b/js/tools/TagTool.js
@@ -158,19 +158,17 @@ exports.TagTool = Montage.create(DrawingTool, {
158 selectedTag = this.options.selectedElement; 158 selectedTag = this.options.selectedElement;
159 159
160 if(selectedTag === "divTool") { 160 if(selectedTag === "divTool") {
161 newTag = NJUtils.makeNJElement("div", "Div", "block"); 161 newTag = NJUtils.makeNJElement("div", "div", "block");
162 } else if(selectedTag === "imageTool") { 162 } else if(selectedTag === "imageTool") {
163 newTag = NJUtils.makeNJElement("image", "Image", "image"); 163 newTag = NJUtils.makeNJElement("image", "image", "image");
164 } else if(selectedTag === "videoTool") { 164 } else if(selectedTag === "videoTool") {
165 newTag = NJUtils.makeNJElement("video", "Video", "video", { 165 newTag = NJUtils.makeNJElement("video", "video", "video", {
166 innerHTML: "Your browser does not support the VIDEO element." 166 innerHTML: "Your browser does not support the VIDEO element."
167 }); 167 });
168 } else if(selectedTag === "canvasTool") { 168 } else if(selectedTag === "canvasTool") {
169 newTag = NJUtils.makeNJElement("canvas", "Canvas", "canvas"); 169 newTag = NJUtils.makeNJElement("canvas", "canvas", "canvas");
170 } else if(selectedTag === "customTool") { 170 } else if(selectedTag === "customTool") {
171 newTag = document.createElement(this.options.customName.value); 171 newTag = NJUtils.makeNJElement(this.options.customName.value, this.options.customName.value, "block");
172 newTag.Ninja = {};
173 newTag.Ninja.selectionType = this.options.customName.value;
174 } 172 }
175 /* SWF Tag tool - Not used for now. Will revisit this at a later time. 173 /* SWF Tag tool - Not used for now. Will revisit this at a later time.
176 else if(selectedTag === "flashTool") { 174 else if(selectedTag === "flashTool") {