aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-24 14:08:25 -0700
committerValerio Virgillito2012-07-24 14:08:25 -0700
commit247d380642f016dcdc7cc9ec99e8fb00073bc900 (patch)
tree62fd021481060094f55684c57481710d8cf1f9db /js/tools
parent98ff98171c1f4a551760a01109ce8f0a80f0c922 (diff)
parentce770f06e8dac6f59c7beb4e51a53587a4c6517e (diff)
downloadninja-247d380642f016dcdc7cc9ec99e8fb00073bc900.tar.gz
Merge branch 'TextTool-Color' of https://github.com/dhg637/ninja
Diffstat (limited to 'js/tools')
-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: {