aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
authorJohn Mayhew2012-05-10 15:27:40 -0700
committerJohn Mayhew2012-05-10 15:27:40 -0700
commitd5995fd5dfcc0cb0cb2361b1099911fa4fc51189 (patch)
tree3a683ac5ddcb3fc7fa4111e7769c15abb31c1ec4 /js/tools
parentba64dfa1d64969e290f15459a826171468fe3550 (diff)
parent632a53278826a33506b302b573ee0681840f2d6c (diff)
downloadninja-d5995fd5dfcc0cb0cb2361b1099911fa4fc51189.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/SelectionTool.js2
-rwxr-xr-xjs/tools/TextTool.js40
-rwxr-xr-xjs/tools/TranslateObject3DTool.js9
-rwxr-xr-xjs/tools/drawing-tool-base.js5
4 files changed, 22 insertions, 34 deletions
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 855c7b8c..07c26b8c 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -504,7 +504,7 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
504 delta = vecUtils.vecSubtract( 3, data.pt1, data.pt0 ); 504 delta = vecUtils.vecSubtract( 3, data.pt1, data.pt0 );
505 delta[0] = ~~delta[0]; 505 delta[0] = ~~delta[0];
506 delta[1] = ~~delta[1]; 506 delta[1] = ~~delta[1];
507 delta[2] = 0; 507 //delta[2] = 0;
508 var transMat = Matrix.Translation( delta ); 508 var transMat = Matrix.Translation( delta );
509 this._moveElements(transMat); 509 this._moveElements(transMat);
510 } 510 }
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) {
diff --git a/js/tools/TranslateObject3DTool.js b/js/tools/TranslateObject3DTool.js
index b4f55bd9..f8b32d23 100755
--- a/js/tools/TranslateObject3DTool.js
+++ b/js/tools/TranslateObject3DTool.js
@@ -54,10 +54,10 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
54 else 54 else
55 { 55 {
56 this._delta = null; 56 this._delta = null;
57 // special case for z-translation 57 //if(this._handleMode === 2)
58 if(this._handleMode === 2)
59 { 58 {
60 this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target); 59 this._dragPlane = viewUtils.getNormalToUnprojectedElementPlane(this._target, this._handleMode, this._inLocalMode);
60 //console.log( "dragPlane: " + this._dragPlane );
61 snapManager.setupDragPlaneFromPlane(this._dragPlane); 61 snapManager.setupDragPlaneFromPlane(this._dragPlane);
62 do3DSnap = false; 62 do3DSnap = false;
63 63
@@ -86,7 +86,8 @@ exports.TranslateObject3DTool = Montage.create(Translate3DToolBase, {
86 var elt = this.application.ninja.stage.getElement(event, true); 86 var elt = this.application.ninja.stage.getElement(event, true);
87 if(elt && (elt !== hitRec.getElement())) 87 if(elt && (elt !== hitRec.getElement()))
88 { 88 {
89 hitRec = snapManager.findHitRecordForElement(elt); 89 var otherSnap = snapManager.findHitRecordForElement(elt);
90 if (otherSnap) hitRec = otherSnap;
90 } 91 }
91 if(elt === this.application.ninja.currentSelectedContainer) 92 if(elt === this.application.ninja.currentSelectedContainer)
92 { 93 {
diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js
index 376b3a27..84641754 100755
--- a/js/tools/drawing-tool-base.js
+++ b/js/tools/drawing-tool-base.js
@@ -36,9 +36,8 @@ exports.DrawingToolBase = Montage.create(Montage, {
36 * 2 - Y value converted to screen point 36 * 2 - Y value converted to screen point
37 */ 37 */
38 getInitialSnapPoint: { 38 getInitialSnapPoint: {
39 value: function(x, y, shapeCanvas) { 39 value: function(x, y, shapeCanvas)
40 snapManager.clearDragPlane(); 40 {
41
42 // update the snap settings 41 // update the snap settings
43 snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() ); 42 snapManager.enableSnapAlign( snapManager.snapAlignEnabledAppLevel() );
44 snapManager.enableElementSnap( snapManager.elementSnapEnabledAppLevel() ); 43 snapManager.enableElementSnap( snapManager.elementSnapEnabledAppLevel() );