diff options
author | Nivesh Rajbhandari | 2012-03-26 21:59:21 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-26 21:59:21 -0700 |
commit | 2d94104653667e93e0f7e5f8d12bc4f7b82e64fa (patch) | |
tree | 89b0ae1c6d49916544f5003f7c6d08d19b2a4fb1 /js/tools | |
parent | 309dde5a8c4599cef6a1052c1ff9ee1ad8ec5858 (diff) | |
parent | 723ea402b74efa0424b96c7e125c8ebb2b72410c (diff) | |
download | ninja-2d94104653667e93e0f7e5f8d12bc4f7b82e64fa.tar.gz |
Merge branch 'refs/heads/montage-integration' into WebGLFileIO
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/EyedropperTool.js | 19 |
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(); |