From ce770f06e8dac6f59c7beb4e51a53587a4c6517e Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Tue, 24 Jul 2012 12:35:19 -0700 Subject: Text Tool Color Change Fix Signed-off-by: Armen Kesablyan --- js/tools/TextTool.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'js/tools') 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, { value: { mode: "Draw3D", type: "rectangle" } }, + _containsElement : { + value: function(target) { + var doc = this.application.ninja.stage.textTool.element.ownerDocument, + didFindElement = false; + + while(!didFindElement && target !== doc) { + didFindElement = (target === this.application.ninja.stage.textTool.element); + target = target.parentNode; + } + + return didFindElement; + } + }, + + captureMousedown: { + value: function(e) { +// if (!this._containsElement(e.target)) { +// this.application.ninja.stage.textTool.activeElementClicked = true; +// } else { +// this.application.ninja.stage.textTool.activeElementClicked = false; +// } + } + }, + _selectedElement: { value : null }, @@ -56,8 +80,10 @@ exports.TextTool = Montage.create(DrawingTool, { this.drawTextTool(); this.handleScroll(); this.application.ninja.stage._iframeContainer.addEventListener("scroll", this, false); + document.body.addEventListener("mousedown", this, true); } else { this.application.ninja.stage._iframeContainer.removeEventListener("scroll", this); + document.body.removeEventListener("mousedown", this, true); } } @@ -70,7 +96,6 @@ exports.TextTool = Montage.create(DrawingTool, { this.application.ninja.stage.textTool.element.style.display = "none"; //ElementsMediator.setProperty([this.selectedElement], "color", [window.getComputedStyle(this.application.ninja.stage.textTool.element)["color"]], "Change", "textTool"); } - }, HandleLeftButtonDown: { -- cgit v1.2.3