diff options
Diffstat (limited to 'js/tools')
-rwxr-xr-x | js/tools/TextTool.js | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js index b98da3e6..39e09cd2 100755 --- a/js/tools/TextTool.js +++ b/js/tools/TextTool.js | |||
@@ -38,6 +38,30 @@ exports.TextTool = Montage.create(DrawingTool, { | |||
38 | value: { mode: "Draw3D", type: "rectangle" } | 38 | value: { mode: "Draw3D", type: "rectangle" } |
39 | }, | 39 | }, |
40 | 40 | ||
41 | _containsElement : { | ||
42 | value: function(target) { | ||
43 | var doc = this.application.ninja.stage.textTool.element.ownerDocument, | ||
44 | didFindElement = false; | ||
45 | |||
46 | while(!didFindElement && target !== doc) { | ||
47 | didFindElement = (target === this.application.ninja.stage.textTool.element); | ||
48 | target = target.parentNode; | ||
49 | } | ||
50 | |||
51 | return didFindElement; | ||
52 | } | ||
53 | }, | ||
54 | |||
55 | captureMousedown: { | ||
56 | value: function(e) { | ||
57 | // if (!this._containsElement(e.target)) { | ||
58 | // this.application.ninja.stage.textTool.activeElementClicked = true; | ||
59 | // } else { | ||
60 | // this.application.ninja.stage.textTool.activeElementClicked = false; | ||
61 | // } | ||
62 | } | ||
63 | }, | ||
64 | |||
41 | _selectedElement: { | 65 | _selectedElement: { |
42 | value : null | 66 | value : null |
43 | }, | 67 | }, |
@@ -56,8 +80,10 @@ exports.TextTool = Montage.create(DrawingTool, { | |||
56 | this.drawTextTool(); | 80 | this.drawTextTool(); |
57 | this.handleScroll(); | 81 | this.handleScroll(); |
58 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); | 82 | this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); |
83 | document.body.addEventListener("mousedown", this, true); | ||
59 | } else { | 84 | } else { |
60 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); | 85 | this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); |
86 | document.body.removeEventListener("mousedown", this, true); | ||
61 | } | 87 | } |
62 | 88 | ||
63 | } | 89 | } |
@@ -70,7 +96,6 @@ exports.TextTool = Montage.create(DrawingTool, { | |||
70 | this.application.ninja.stage.textTool.element.style.display = "none"; | 96 | 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"); | 97 | //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool"); |
72 | } | 98 | } |
73 | |||
74 | }, | 99 | }, |
75 | 100 | ||
76 | HandleLeftButtonDown: { | 101 | HandleLeftButtonDown: { |