aboutsummaryrefslogtreecommitdiff
path: root/js/tools/EyedropperTool.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-03-27 11:30:17 -0700
committerValerio Virgillito2012-03-27 11:30:17 -0700
commit73ae65902d355fcb75bcdb486eaa27c0d79125c8 (patch)
tree89b0ae1c6d49916544f5003f7c6d08d19b2a4fb1 /js/tools/EyedropperTool.js
parent309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff)
parent2d94104653667e93e0f7e5f8d12bc4f7b82e64fa (diff)
downloadninja-73ae65902d355fcb75bcdb486eaa27c0d79125c8.tar.gz
Merge pull request #144 from mqg734/WebGLFileIO
WebGL Fixes and Minor EyeDropper Tool Fixes.
Diffstat (limited to 'js/tools/EyedropperTool.js')
-rwxr-xr-xjs/tools/EyedropperTool.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/js/tools/EyedropperTool.js b/js/tools/EyedropperTool.js
index 927b86cf..7458a9e8 100755
--- a/js/tools/EyedropperTool.js
+++ b/js/tools/EyedropperTool.js
@@ -148,7 +148,11 @@ exports.EyedropperTool = Montage.create(toolBase, {
148 c = this._getColorFromElement(obj, event); 148 c = this._getColorFromElement(obj, event);
149 } 149 }
150 150
151 if(typeof(c) === "string") 151 if(!c)
152 {
153 color = null;
154 }
155 else if(typeof(c) === "string")
152 { 156 {
153 color = this.application.ninja.colorController.getColorObjFromCss(c); 157 color = this.application.ninja.colorController.getColorObjFromCss(c);
154 } 158 }
@@ -368,7 +372,7 @@ exports.EyedropperTool = Montage.create(toolBase, {
368 this._imageDataContext = this._imageDataCanvas.getContext("2d"); 372 this._imageDataContext = this._imageDataCanvas.getContext("2d");
369 if(isWebGl) 373 if(isWebGl)
370 { 374 {
371 var worldData = elt.elementModel.shapeModel.GLWorld.export(); 375 var worldData = elt.elementModel.shapeModel.GLWorld.exportJSON();
372 if(worldData) 376 if(worldData)
373 { 377 {
374 this._webGlDataCanvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": njModule.NJUtils.generateRandom()}, true); 378 this._webGlDataCanvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": njModule.NJUtils.generateRandom()}, true);
@@ -379,7 +383,16 @@ exports.EyedropperTool = Montage.create(toolBase, {
379 this._webGlDataCanvas.width = w; 383 this._webGlDataCanvas.width = w;
380 this._webGlDataCanvas.height = h; 384 this._webGlDataCanvas.height = h;
381 this._webGlWorld = new World(this._webGlDataCanvas, true, true); 385 this._webGlWorld = new World(this._webGlDataCanvas, true, true);
382 this._webGlWorld.import(worldData); 386
387 var index = worldData.indexOf( ';' );
388 if ((worldData[0] === 'v') && (index < 24))
389 {
390 // JSON format. separate the version info from the JSON info
391 var jStr = worldData.substr( index+1 );
392 worldData = JSON.parse( jStr );
393 }
394
395 this._webGlWorld.importJSON(worldData);
383 this._webGlWorld.render(); 396 this._webGlWorld.render();
384 setTimeout(function() { 397 setTimeout(function() {
385 this._webGlWorld.draw(); 398 this._webGlWorld.draw();