aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-03-26 11:43:06 -0700
committerNivesh Rajbhandari2012-03-26 11:43:06 -0700
commit53d83f9515c1d6edd35bf16a94e022730ccafbe9 (patch)
treef316bcce717f34efd92aaab770451009751f76f5
parent63f0cab872879f72021692f064b044a0cde2459a (diff)
downloadninja-53d83f9515c1d6edd35bf16a94e022730ccafbe9.tar.gz
Updating EyeDropper tool to support new JSON data format for WebGL.
Signed-off-by: Nivesh Rajbhandari <mqg734@motorola.com>
-rwxr-xr-xjs/tools/EyedropperTool.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/js/tools/EyedropperTool.js b/js/tools/EyedropperTool.js
index 927b86cf..6d6937e3 100755
--- a/js/tools/EyedropperTool.js
+++ b/js/tools/EyedropperTool.js
@@ -368,7 +368,7 @@ exports.EyedropperTool = Montage.create(toolBase, {
368 this._imageDataContext = this._imageDataCanvas.getContext("2d"); 368 this._imageDataContext = this._imageDataCanvas.getContext("2d");
369 if(isWebGl) 369 if(isWebGl)
370 { 370 {
371 var worldData = elt.elementModel.shapeModel.GLWorld.export(); 371 var worldData = elt.elementModel.shapeModel.GLWorld.exportJSON();
372 if(worldData) 372 if(worldData)
373 { 373 {
374 this._webGlDataCanvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": njModule.NJUtils.generateRandom()}, true); 374 this._webGlDataCanvas = njModule.NJUtils.makeNJElement("canvas", "Canvas", "shape", {"data-RDGE-id": njModule.NJUtils.generateRandom()}, true);
@@ -379,7 +379,16 @@ exports.EyedropperTool = Montage.create(toolBase, {
379 this._webGlDataCanvas.width = w; 379 this._webGlDataCanvas.width = w;
380 this._webGlDataCanvas.height = h; 380 this._webGlDataCanvas.height = h;
381 this._webGlWorld = new World(this._webGlDataCanvas, true, true); 381 this._webGlWorld = new World(this._webGlDataCanvas, true, true);
382 this._webGlWorld.import(worldData); 382
383 var index = worldData.indexOf( ';' );
384 if ((worldData[0] === 'v') && (index < 24))
385 {
386 // JSON format. separate the version info from the JSON info
387 var jStr = worldData.substr( index+1 );
388 worldData = JSON.parse( jStr );
389 }
390
391 this._webGlWorld.importJSON(worldData);
383 this._webGlWorld.render(); 392 this._webGlWorld.render();
384 setTimeout(function() { 393 setTimeout(function() {
385 this._webGlWorld.draw(); 394 this._webGlWorld.draw();