diff options
author | Jose Antonio Marquez | 2012-07-24 14:38:35 -0700 |
---|---|---|
committer | Jose Antonio Marquez | 2012-07-24 14:38:35 -0700 |
commit | 8765e8fe23985171c88aaa6f39f4d63b3c03fb71 (patch) | |
tree | 136f1c9ce8002644900d42dd0e5b7fd55c36903b /js/tools | |
parent | 5454cc462903c83a8c3651065b03cc1855db125e (diff) | |
parent | 21d74af1e9fc57cc25cea8aa7408beabf79ff2f3 (diff) | |
download | ninja-8765e8fe23985171c88aaa6f39f4d63b3c03fb71.tar.gz |
Merge branch 'refs/heads/Ninja-Master' into Document
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 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: { |