diff options
author | Valerio Virgillito | 2012-07-24 14:05:30 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-24 14:05:30 -0700 |
commit | 6577cc5584316ecff0eff04873be8666cca1b0ec (patch) | |
tree | 1dd990a8bafe9159ae00ba2b763091052978858b /js/tools | |
parent | 2e86072a159c4bc270c6e897a7e1a81a492ed886 (diff) | |
parent | ce770f06e8dac6f59c7beb4e51a53587a4c6517e (diff) | |
download | ninja-6577cc5584316ecff0eff04873be8666cca1b0ec.tar.gz |
Merge branch 'TextTool-Color' of https://github.com/dhg637/ninja into v0.7.1
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: { |