aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorhwc4872012-05-10 16:53:53 -0700
committerhwc4872012-05-10 16:53:53 -0700
commitd1bcb47ba34f2f2b8db5fa310a9e9a9bd7973988 (patch)
treefe0e80aa7ca2a48b7e54873346c642221267f76a /js/tools
parentbabfa5f1ca4f702920d81d7e12a90b12ffbf42d8 (diff)
parent632a53278826a33506b302b573ee0681840f2d6c (diff)
downloadninja-d1bcb47ba34f2f2b8db5fa310a9e9a9bd7973988.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into 3DBugs
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/TextTool.js40
1 files changed, 14 insertions, 26 deletions
diff --git a/js/tools/TextTool.js b/js/tools/TextTool.js
index a58aacc6..024a92ce 100755
--- a/js/tools/TextTool.js
+++ b/js/tools/TextTool.js
@@ -5,13 +5,18 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
5</copyright> */ 5</copyright> */
6 6
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool; 8 DrawingTool = require("js/tools/drawing-tool").DrawingTool,
9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor, 9 RichTextEditor = require("node_modules/labs/rich-text-editor.reel").RichTextEditor,
10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator; 10 ElementsMediator = require("js/mediators/element-mediator").ElementMediator;
11 11
12exports.TextTool = Montage.create(DrawingTool, { 12exports.TextTool = Montage.create(DrawingTool, {
13 drawingFeedback: {
14 value: { mode: "Draw3D", type: "rectangle" }
15 },
13 16
14 _selectedElement: { value : null }, 17 _selectedElement: {
18 value : null
19 },
15 20
16 selectedElement: { 21 selectedElement: {
17 get: function() { 22 get: function() {
@@ -35,9 +40,6 @@ exports.TextTool = Montage.create(DrawingTool, {
35 } 40 }
36 } 41 }
37 }, 42 },
38
39
40 drawingFeedback: { value: { mode: "Draw3D", type: "rectangle" } },
41 43
42 HandleLeftButtonDown: { 44 HandleLeftButtonDown: {
43 value: function(event) { 45 value: function(event) {
@@ -81,15 +83,7 @@ exports.TextTool = Montage.create(DrawingTool, {
81 return; 83 return;
82 } 84 }
83 85
84 var drawData, selectedItem;
85
86 if(this._hasDraw) { 86 if(this._hasDraw) {
87 drawData = this.getDrawingData();
88
89 if(drawData) {
90 //this.insertElement(drawData);
91 }
92
93 this._hasDraw = false; 87 this._hasDraw = false;
94 this.endDraw(event); 88 this.endDraw(event);
95 } else { 89 } else {
@@ -113,6 +107,8 @@ exports.TextTool = Montage.create(DrawingTool, {
113 107
114 drawTextTool: { 108 drawTextTool: {
115 value: function() { 109 value: function() {
110 var self = this;
111
116 this.application.ninja.stage.textTool.value = this.selectedElement.innerHTML; 112 this.application.ninja.stage.textTool.value = this.selectedElement.innerHTML;
117 if(this.application.ninja.stage.textTool.value === "") { this.application.ninja.stage.textTool.value = " "; } 113 if(this.application.ninja.stage.textTool.value === "") { this.application.ninja.stage.textTool.value = " "; }
118 this.selectedElement.innerHTML = ""; 114 this.selectedElement.innerHTML = "";
@@ -125,35 +121,27 @@ exports.TextTool = Montage.create(DrawingTool, {
125 this.application.ninja.stage.textTool.element.style.width = this.selectedElement.offsetWidth + "px"; 121 this.application.ninja.stage.textTool.element.style.width = this.selectedElement.offsetWidth + "px";
126 this.application.ninja.stage.textTool.element.style.height = this.selectedElement.offsetHeight + "px"; 122 this.application.ninja.stage.textTool.element.style.height = this.selectedElement.offsetHeight + "px";
127 123
128
129 // Set font styling (Size, Style, Weight) 124 // Set font styling (Size, Style, Weight)
130
131 me = this;
132 this.application.ninja.stage.textTool.didDraw = function() { 125 this.application.ninja.stage.textTool.didDraw = function() {
133 me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element, ["overflow"]); 126 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element, ["overflow"]);
134 me.applyElementStyles(me.selectedElement, me.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]); 127 self.applyElementStyles(self.selectedElement, self.application.ninja.stage.textTool.element.firstChild, ["font","padding-left","padding-top","padding-right","padding-bottom", "color"]);
135 var range = document.createRange(), 128 var range = document.createRange(),
136 sel = window.getSelection(); 129 sel = window.getSelection();
137 sel.removeAllRanges(); 130 sel.removeAllRanges();
138 range.selectNodeContents(this.application.ninja.stage.textTool.element.firstChild); 131 range.selectNodeContents(self.application.ninja.stage.textTool.element.firstChild);
139 sel.addRange(range); 132 sel.addRange(range);
140 this.didDraw = function() {}; 133 this.didDraw = function() {};
141 } 134 }
142 } 135 }
143 }, 136 },
144 137
138 /*
145 HandleDoubleClick: { 139 HandleDoubleClick: {
146 value: function(e) { 140 value: function(e) {
147 //this.application.ninja.selectedElements[0].setAttribute("contenteditable", true); 141 //this.application.ninja.selectedElements[0].setAttribute("contenteditable", true);
148
149 //if (!this.application.ninja.textTool) {
150
151 //}
152
153
154
155 } 142 }
156 }, 143 },
144 */
157 145
158 Configure: { 146 Configure: {
159 value: function(wasSelected) { 147 value: function(wasSelected) {