aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-27 09:35:12 -0700
committerNivesh Rajbhandari2012-03-27 09:35:12 -0700
commit71b2d1f4ece0f0760bc15900ee0b1f937a9b9431 (patch)
tree4c0da519620ecb318640e201a7f503952025b3bf /js/tools
parent406bbfc63f8ed42d7da105dbd068a49ff8fb5f09 (diff)
parent2d94104653667e93e0f7e5f8d12bc4f7b82e64fa (diff)
downloadninja-71b2d1f4ece0f0760bc15900ee0b1f937a9b9431.tar.gz
Merge branch 'refs/heads/WebGLFileIO' into WebGLMaterials
Diffstat (limited to 'js/tools')
-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();