aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-23 13:44:49 -0700
committerArmen Kesablyan2012-06-23 13:44:49 -0700
commit23aec4144f9d4352ba6d10367288f51d57ba990f (patch)
treea91165b50dd61440ecde8d8bdf9acee265445250 /js
parente604a34a8e4de904e58203215aa1278e91f8197b (diff)
downloadninja-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')
-rwxr-xr-xjs/components/tools-properties/text-properties.reel/text-properties.js8
-rwxr-xr-xjs/tools/TextTool.js21
2 files changed, 20 insertions, 9 deletions
diff --git a/js/components/tools-properties/text-properties.reel/text-properties.js b/js/components/tools-properties/text-properties.reel/text-properties.js
index 72a6f034..c5729e98 100755
--- a/js/components/tools-properties/text-properties.reel/text-properties.js
+++ b/js/components/tools-properties/text-properties.reel/text-properties.js
@@ -296,14 +296,18 @@ exports.TextProperties = Montage.create(ToolProperties, {
296 296
297 handleFontSelectionChange: { 297 handleFontSelectionChange: {
298 value: function(e) { 298 value: function(e) {
299 this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value);
300 this.application.ninja.stage.textTool.element.focus(); 299 this.application.ninja.stage.textTool.element.focus();
300 this.application.ninja.stage.textTool.doAction("fontname", this.fontSelection.value);
301
302 //Note: Set Font Color on selection to ColorChip Component;
303 //this.this.application.ninja.stage.textTool.foreColor
304
301 } 305 }
302 }, 306 },
303 307
304 handleFontColorChange: { 308 handleFontColorChange: {
305 value: function(e) { 309 value: function(e) {
306 this.application.ninja.stage.textTool.element.style.color = e._event.color.css; 310 this.application.ninja.stage.textTool.foreColor = e._event.color.css;
307 this.application.ninja.stage.textTool.element.focus(); 311 this.application.ninja.stage.textTool.element.focus();
308 //this.application.ninja.stage.textTool.doAction("forecolor",e._event.color.css); 312 //this.application.ninja.stage.textTool.doAction("forecolor",e._event.color.css);
309 313
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: {