aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TextTool.js
diff options
context:
space:
mode:
authorJohn Mayhew2012-07-24 15:46:16 -0700
committerJohn Mayhew2012-07-24 15:46:16 -0700
commit9f240b8b9b1f5fb0f145c343ca5e533e25e81374 (patch)
tree407564eaa6466e8d4cf2eeee0c56dc623243586f /js/tools/TextTool.js
parentd25359c75089215ee48838db081fd3d51cbbd85f (diff)
parent21d74af1e9fc57cc25cea8aa7408beabf79ff2f3 (diff)
downloadninja-9f240b8b9b1f5fb0f145c343ca5e533e25e81374.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja
Diffstat (limited to 'js/tools/TextTool.js')
-rwxr-xr-xjs/tools/TextTool.js33
1 files changed, 28 insertions, 5 deletions
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index b98da3e6..61985d88 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -30,14 +30,37 @@ POSSIBILITY OF SUCH DAMAGE.
30</copyright> */ 30</copyright> */
31 31
32var Montage = require("montage/core/core").Montage, 32var Montage = require("montage/core/core").Montage,
33 DrawingTool = require("js/tools/drawing-tool").DrawingTool, 33 DrawingTool = require("js/tools/drawing-tool").DrawingTool;
34 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
35 34
36exports.TextTool = Montage.create(DrawingTool, { 35exports.TextTool = Montage.create(DrawingTool, {
37 drawingFeedback: { 36 drawingFeedback: {
38 value: { mode: "Draw3D", type: "rectangle" } 37 value: { mode: "Draw3D", type: "rectangle" }
39 }, 38 },
40 39
40 _containsElement : {
41 value: function(target) {
42 var doc = this.application.ninja.stage.textTool.element.ownerDocument,
43 didFindElement = false;
44
45 while(!didFindElement && target !== doc) {
46 didFindElement = (target === this.application.ninja.stage.textTool.element);
47 target = target.parentNode;
48 }
49
50 return didFindElement;
51 }
52 },
53
54 captureMousedown: {
55 value: function(e) {
56// if (!this._containsElement(e.target)) {
57// this.application.ninja.stage.textTool.activeElementClicked = true;
58// } else {
59// this.application.ninja.stage.textTool.activeElementClicked = false;
60// }
61 }
62 },
63
41 _selectedElement: { 64 _selectedElement: {
42 value : null 65 value : null
43 }, 66 },
@@ -56,8 +79,10 @@ exports.TextTool = Montage.create(DrawingTool, {
56 this.drawTextTool(); 79 this.drawTextTool();
57 this.handleScroll(); 80 this.handleScroll();
58 this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); 81 this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false);
82 document.body.addEventListener("mousedown", this, true);
59 } else { 83 } else {
60 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); 84 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this);
85 document.body.removeEventListener("mousedown", this, true);
61 } 86 }
62 87
63 } 88 }
@@ -70,7 +95,6 @@ exports.TextTool = Montage.create(DrawingTool, {
70 this.application.ninja.stage.textTool.element.style.display = "none"; 95 this.application.ninja.stage.textTool.element.style.display = "none";
71 //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool"); 96 //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool");
72 } 97 }
73
74 }, 98 },
75 99
76 HandleLeftButtonDown: { 100 HandleLeftButtonDown: {
@@ -175,8 +199,7 @@ exports.TextTool = Montage.create(DrawingTool, {
175 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]); 199 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]);
176 this.selectAll(); 200 this.selectAll();
177 this.didDraw = function() {}; 201 this.didDraw = function() {};
178 } 202 };
179
180 } 203 }
181 }, 204 },
182 205