aboutsummaryrefslogtreecommitdiff
path: root/js/tools
diff options
context:
space:
mode:
Diffstat (limited to 'js/tools')
-rwxr-xr-xjs/tools/RotateStage3DTool.js20
-rwxr-xr-xjs/tools/SelectionTool.js5
-rwxr-xr-xjs/tools/ZoomTool.js4
-rw-r--r--js/tools/bindingTool.js51
4 files changed, 59 insertions, 21 deletions
diff --git a/js/tools/RotateStage3DTool.js b/js/tools/RotateStage3DTool.js
index 2a9c63db..c8818021 100755
--- a/js/tools/RotateStage3DTool.js
+++ b/js/tools/RotateStage3DTool.js
@@ -96,12 +96,6 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
96 viewUtils.pushViewportObj( stage ); 96 viewUtils.pushViewportObj( stage );
97 var eltCtr = viewUtils.getCenterOfProjection(); 97 var eltCtr = viewUtils.getCenterOfProjection();
98 viewUtils.popViewportObj(); 98 viewUtils.popViewportObj();
99// if(this.application.ninja.documentController.webTemplate)
100 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent")
101 {
102 eltCtr[0] = stage.scrollWidth/2;
103 eltCtr[1] = stage.scrollHeight/2;
104 }
105 99
106 var curMat = viewUtils.getMatrixFromElement(stage); 100 var curMat = viewUtils.getMatrixFromElement(stage);
107 var curMatInv = glmat4.inverse(curMat, []); 101 var curMatInv = glmat4.inverse(curMat, []);
@@ -118,17 +112,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
118 } 112 }
119 113
120 this._origin = viewUtils.localToGlobal(eltCtr, stage); 114 this._origin = viewUtils.localToGlobal(eltCtr, stage);
121 115 this._setTransformOrigin(false);
122// if(this.application.ninja.documentController.webTemplate)
123 if(this.application.ninja.currentDocument.documentRoot.id !== "UserContent")
124 {
125 this._startOriginArray = [];
126 this._startOriginArray.push(this._origin.slice());
127 }
128 else
129 {
130 this._setTransformOrigin(false);
131 }
132 this.DrawHandles(); 116 this.DrawHandles();
133 } 117 }
134 }, 118 },
@@ -155,7 +139,7 @@ exports.RotateStage3DTool = Montage.create(Rotate3DToolBase, {
155 // let the document and stage manager know about the zoom change 139 // let the document and stage manager know about the zoom change
156 this.application.ninja.stage._firstDraw = true; 140 this.application.ninja.stage._firstDraw = true;
157 this.application.ninja.documentBar.zoomFactor = 100; 141 this.application.ninja.documentBar.zoomFactor = 100;
158 this.application.ninja.currentDocument.iframe.style.zoom = 1.0; 142 this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = 1.0;
159 this.application.ninja.stage._firstDraw = false; 143 this.application.ninja.stage._firstDraw = false;
160 144
161 // TODO - Any updates to the stage should redraw stage's children. Move this to mediator? 145 // TODO - Any updates to the stage should redraw stage's children. Move this to mediator?
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 07c26b8c..5c8b15ae 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -165,10 +165,11 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
165 box[3] = point.y; 165 box[3] = point.y;
166 166
167 //selectionManagerModule.selectionManager.marqueeSelection(box); 167 //selectionManagerModule.selectionManager.marqueeSelection(box);
168 var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes; 168 var childNodes = this.application.ninja.currentDocument.documentRoot.childNodes,
169 selectionController = this.application.ninja.selectionController;
169 childNodes = Array.prototype.slice.call(childNodes, 0); 170 childNodes = Array.prototype.slice.call(childNodes, 0);
170 childNodes.forEach(function(item) { 171 childNodes.forEach(function(item) {
171 if(item.nodeType == 1 && SelectionTool._complicatedCollisionDetection(item, box)) { 172 if(selectionController.isNodeTraversable(item) && SelectionTool._complicatedCollisionDetection(item, box)) {
172 selectedItems.push(item); 173 selectedItems.push(item);
173 } 174 }
174 }); 175 });
diff --git a/js/tools/ZoomTool.js b/js/tools/ZoomTool.js
index 93caf984..17301262 100755
--- a/js/tools/ZoomTool.js
+++ b/js/tools/ZoomTool.js
@@ -280,7 +280,9 @@ exports.ZoomTool = Montage.create(DrawingTool, {
280 this.application.ninja.documentBar.zoomFactor = zoomFactor*100; 280 this.application.ninja.documentBar.zoomFactor = zoomFactor*100;
281 //this.application.ninja.stage.zoomFactor = zoomFactor; 281 //this.application.ninja.stage.zoomFactor = zoomFactor;
282 if (zoomFactor >= 1) 282 if (zoomFactor >= 1)
283 this.application.ninja.currentDocument.iframe.style.zoom = zoomFactor; 283 {
284 this.application.ninja.currentDocument.model.views.design.iframe.style.zoom = zoomFactor;
285 }
284 this.application.ninja.stage._firstDraw = false; 286 this.application.ninja.stage._firstDraw = false;
285 //tmp3 = viewUtils.localToGlobal( localPt, userContent ); // DEBUG - remove this line 287 //tmp3 = viewUtils.localToGlobal( localPt, userContent ); // DEBUG - remove this line
286 288
diff --git a/js/tools/bindingTool.js b/js/tools/bindingTool.js
new file mode 100644
index 00000000..282e3408
--- /dev/null
+++ b/js/tools/bindingTool.js
@@ -0,0 +1,51 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 DrawingTool = require("js/tools/drawing-tool").DrawingTool,
9ModifierToolBase = require("js/tools/modifier-tool-base").ModifierToolBase;
10
11
12exports.BindingTool = Montage.create(ModifierToolBase, {
13 drawingFeedback: { value: { mode: "Draw2D", type: "" } },
14
15 Configure: {
16 value: function (doActivate)
17 {
18 if (doActivate)
19 {
20 NJevent("enableStageMove");
21 document.body.classList.add("ws-binding");
22
23 }
24 else
25 {
26 NJevent("disableStageMove");
27 document.body.classList.remove("ws-binding");
28 }
29 }
30 },
31
32 HandleLeftButtonDown: {
33 value: function(event) {
34 NJevent("enableStageMove");
35
36 }
37 },
38
39 HandleMouseMove: {
40 value: function(event) {
41 this.doDraw(event);
42 }
43 },
44
45 HandleLeftButtonUp: {
46 value: function(event) {
47 this.endDraw(event);
48 NJevent("disableStageMove");
49 }
50 }
51}); \ No newline at end of file