aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorJonathan Duran2012-03-29 07:27:27 -0700
committerJonathan Duran2012-03-29 07:27:27 -0700
commitab730848419a0b72c4c2747a3c928f2c8cc763e7 (patch)
tree6b48b82604e194016ca048ad912f8015de719999 /js/tools
parent06f247d881f4cfd790d635c6e310ae7f97724339 (diff)
parent3fd2cdb59027b3f973b9165db9db4fdd22026941 (diff)
downloadninja-ab730848419a0b72c4c2747a3c928f2c8cc763e7.tar.gz
Merge branch 'refs/heads/NINJAmaster' into TimelineUber
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/EyedropperTool.js28
-rwxr-xr-xjs/tools/TextTool.js5
2 files changed, 25 insertions, 8 deletions
diff --git a/js/tools/EyedropperTool.js b/js/tools/EyedropperTool.js
index 927b86cf..d627f03b 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,12 +383,24 @@ 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 if(this._webGlWorld)
386 this._imageDataContext.drawImage(this._webGlDataCanvas, 0, 0); 399 {
387 return this._getColorFromCanvas(this._imageDataContext, tmpPt, true); 400 this._webGlWorld.draw();
401 this._imageDataContext.drawImage(this._webGlDataCanvas, 0, 0);
402 return this._getColorFromCanvas(this._imageDataContext, tmpPt, true);
403 }
388 }.bind(this), 250); 404 }.bind(this), 250);
389 } 405 }
390 } 406 }
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index 4c464173..d27a32bb 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -6,7 +6,8 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool; 8 DrawingTool = require("js/tools/drawing-tool").DrawingTool;
9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor; 9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor,
10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
10 11
11exports.TextTool = Montage.create(DrawingTool, { 12exports.TextTool = Montage.create(DrawingTool, {
12 13
@@ -21,7 +22,7 @@ exports.TextTool = Montage.create(DrawingTool, {
21 this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value; 22 this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value;
22 this.application.ninja.stage.textTool.value = ""; 23 this.application.ninja.stage.textTool.value = "";
23 this.application.ninja.stage.textTool.element.style.display = "none"; 24 this.application.ninja.stage.textTool.element.style.display = "none";
24 this.applyElementStyles(this.application.ninja.stage.textTool.element.firstChild, this.selectedElement, ["color"]); 25 ElementsMediator.setProperty(this.application.ninja.selectedElements, "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element.firstChild)["color"]], "Change", "textTool");
25 } 26 }
26 //Set Selected Element 27 //Set Selected Element
27 this._selectedElement = val; 28 this._selectedElement = val;