aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/TextTool.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index 7f82855b..aa79b8bc 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -6,7 +6,6 @@ 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 = ("node_modules/labs/rich-text-editor.reel").RichTextEditor,
10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator; 9 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
11 10
12exports.TextTool = Montage.create(DrawingTool, { 11exports.TextTool = Montage.create(DrawingTool, {
@@ -23,22 +22,30 @@ exports.TextTool = Montage.create(DrawingTool, {
23 return this._selectedElement; 22 return this._selectedElement;
24 }, 23 },
25 set: function(val) { 24 set: function(val) {
25 //Set Selected Element
26 if (this._selectedElement !== null) { 26 if (this._selectedElement !== null) {
27 this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value; 27 this.applyStyle();
28 this.application.ninja.stage.textTool.value = "";
29 this.application.ninja.stage.textTool.element.style.display = "none";
30 ElementsMediator.setProperty(this.application.ninja.selectedElements, "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool");
31 } 28 }
32 //Set Selected Element
33 this._selectedElement = val; 29 this._selectedElement = val;
34 if(val !== null) { 30 if(this._selectedElement !== null) {
35 this.drawTextTool(); 31 this.drawTextTool();
36 this.handleScroll(); 32 this.handleScroll();
37 this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); 33 this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false);
38 } else { 34 } else {
39 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); 35 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this);
40 } 36 }
37
38 }
39 },
40
41 applyStyle: {
42 value: function() {
43 this.selectedElement.innerHTML = this.application.ninja.stage.textTool.value;
44 this.application.ninja.stage.textTool.value = "";
45 this.application.ninja.stage.textTool.element.style.display = "none";
46 //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool");
41 } 47 }
48
42 }, 49 },
43 50
44 HandleLeftButtonDown: { 51 HandleLeftButtonDown: {