aboutsummaryrefslogtreecommitdiff
path: root/js/tools/TextTool.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools/TextTool.js')
-rwxr-xr-xjs/tools/TextTool.js27
1 files changed, 26 insertions, 1 deletions
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index d04254b0..61985d88 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -37,6 +37,30 @@ exports.TextTool = Montage.create(DrawingTool, {
37 value: { mode: "Draw3D", type: "rectangle" } 37 value: { mode: "Draw3D", type: "rectangle" }
38 }, 38 },
39 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
40 _selectedElement: { 64 _selectedElement: {
41 value : null 65 value : null
42 }, 66 },
@@ -55,8 +79,10 @@ exports.TextTool = Montage.create(DrawingTool, {
55 this.drawTextTool(); 79 this.drawTextTool();
56 this.handleScroll(); 80 this.handleScroll();
57 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);
58 } else { 83 } else {
59 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); 84 this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this);
85 document.body.removeEventListener("mousedown", this, true);
60 } 86 }
61 87
62 } 88 }
@@ -69,7 +95,6 @@ exports.TextTool = Montage.create(DrawingTool, {
69 this.application.ninja.stage.textTool.element.style.display = "none"; 95 this.application.ninja.stage.textTool.element.style.display = "none";
70 //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");
71 } 97 }
72
73 }, 98 },
74 99
75 HandleLeftButtonDown: { 100 HandleLeftButtonDown: {