diff options
author | Armen Kesablyan | 2012-06-23 13:44:49 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-06-23 13:44:49 -0700 |
commit | 23aec4144f9d4352ba6d10367288f51d57ba990f (patch) | |
tree | a91165b50dd61440ecde8d8bdf9acee265445250 /js/tools | |
parent | e604a34a8e4de904e58203215aa1278e91f8197b (diff) | |
download | ninja-23aec4144f9d4352ba6d10367288f51d57ba990f.tar.gz |
Text Tool Fix - Can Not Switch Document when Text Tool Initialized
Signed-off-by: Armen Kesablyan <armen@motorola.com>
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/TextTool.js | 21 |
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 | ||
7 | var Montage = require("montage/core/core").Montage, | 7 | var 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 | ||
12 | exports.TextTool = Montage.create(DrawingTool, { | 11 | exports.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: { |