aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-06-20 15:03:38 -0700
committerValerio Virgillito2012-06-20 15:03:38 -0700
commitc9852665eadc1acb9c1c881d207c4bd9ef88805f (patch)
tree363dcc94fdd76ebea4888183fff354d4ec013478
parent97e00c4ea4d6651af9c08e14c9146f5b64e6b9ca (diff)
parent52833c3d8a485944c42acc6ac0ae5139b3427da8 (diff)
downloadninja-c9852665eadc1acb9c1c881d207c4bd9ef88805f.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
-rwxr-xr-xjs/panels/color/colorpopup-manager.js56
-rwxr-xr-xjs/tools/SelectionTool.js7
-rwxr-xr-xjs/tools/ToolBase.js2
-rwxr-xr-xjs/tools/drawing-tool-base.js11
-rwxr-xr-xjs/tools/modifier-tool-base.js17
5 files changed, 38 insertions, 55 deletions
diff --git a/js/panels/color/colorpopup-manager.js b/js/panels/color/colorpopup-manager.js
index 529ec1c8..4667f2b4 100755
--- a/js/panels/color/colorpopup-manager.js
+++ b/js/panels/color/colorpopup-manager.js
@@ -29,49 +29,27 @@ exports.ColorPopupManager = Montage.create(Component, {
29 enumerable: false, 29 enumerable: false,
30 value: function () { 30 value: function () {
31 //////////////////////////////////////////////////////////// 31 ////////////////////////////////////////////////////////////
32 //TODO: Improve logic on handling closing the popup 32 //Closing popups on resize
33 ////////////////////////////////////////////////////////////
34 //Hiding popup on any panel(s) actions
35 this.eventManager.addEventListener("panelOrderChanged", function (e) {
36 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
37 }.bind(this));
38 //
39 this.eventManager.addEventListener("panelClose", function (e) {
40 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
41 }.bind(this));
42 //
43 this.eventManager.addEventListener("panelCollapsed", function (e) {
44 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
45 }.bind(this));
46 //
47 this.eventManager.addEventListener("panelSelected", function (e) {
48 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
49 }.bind(this));
50 //
51 this.eventManager.addEventListener("togglePanel", function (e) {
52 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
53 }.bind(this));
54 //
55 this.eventManager.addEventListener("panelResizing", function (e) {
56 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
57 }.bind(this));
58 //
59 this.eventManager.addEventListener("panelResizedStart", function (e) {
60 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
61 }.bind(this));
62 //
63 this.eventManager.addEventListener("panelResizedEnd", function (e) {
64 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
65 }.bind(this));
66 //
67 window.addEventListener('resize', function (e) { 33 window.addEventListener('resize', function (e) {
68 this.application.ninja.colorController.colorPopupManager.hideColorPopup(); 34 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
69 }.bind(this)); 35 }.bind(this));
70 // 36 //Storing limits of popup
37 var top, bottom, left, right;
38 //Closing popups if outside limits
71 document.addEventListener('mousedown', function (e) { 39 document.addEventListener('mousedown', function (e) {
72 // 40 //Checking for popup to be opened otherwise nothing happens
73 if (e._event.srcElement.getAttribute('data-montage-id') === 'stageCanvas' || e._event.srcElement.id === 'mainContainer' || e._event.srcElement.getAttribute('data-montage-id') === 'drawingCanvas') { 41 if (this._popupPanel.opened && this._popupPanel.popup && this._popupPanel.popup.element && !e._event.srcElement.inputType) {
74 this.application.ninja.colorController.colorPopupManager.hideColorPopup(); 42 //Getting horizontal limits
43 left = parseInt(this._popupPanel.popup.element.style.left) + parseInt(this._popupPanel.popup.element.style.marginLeft);
44 right = left + parseInt(this._popupPanel.popup.element.offsetWidth);
45 //Getting vertical limits
46 top = parseInt(this._popupPanel.popup.element.style.top) + parseInt(this._popupPanel.popup.element.style.marginTop);
47 bottom = left + parseInt(this._popupPanel.popup.element.offsetHeight);
48 //Checking click position in relation to limits
49 if ((e._event.clientX < left || e._event.clientX > right) || (e._event.clientY < top || e._event.clientY > bottom)) {
50 //Hides popups since click is outside limits
51 this.application.ninja.colorController.colorPopupManager.hideColorPopup();
52 }
75 } 53 }
76 }.bind(this)); 54 }.bind(this));
77 //////////////////////////////////////////////////////////// 55 ////////////////////////////////////////////////////////////
diff --git a/js/tools/SelectionTool.js b/js/tools/SelectionTool.js
index 8b644d4a..9bd885a4 100755
--- a/js/tools/SelectionTool.js
+++ b/js/tools/SelectionTool.js
@@ -583,11 +583,8 @@ var SelectionTool = exports.SelectionTool = Montage.create(ModifierToolBase, {
583 this.mouseUpHitRec = DrawingToolBase.getUpdatedSnapPoint(point.x, point.y, do3DSnap, this.mouseDownHitRec); 583 this.mouseUpHitRec = DrawingToolBase.getUpdatedSnapPoint(point.x, point.y, do3DSnap, this.mouseDownHitRec);
584 if (this._mouseDownHitRec && this._mouseUpHitRec) 584 if (this._mouseDownHitRec && this._mouseUpHitRec)
585 { 585 {
586 data = this.getDrawingData(event); 586 this.modifyElements({pt0:this._mouseDownHitRec.calculateElementScreenPoint(),
587 if(data) 587 pt1:this._mouseUpHitRec.calculateElementScreenPoint()}, event);
588 {
589 this.modifyElements({pt0:data.mouseDownPos, pt1:data.mouseUpPos}, event);
590 }
591 } 588 }
592 } 589 }
593 } 590 }
diff --git a/js/tools/ToolBase.js b/js/tools/ToolBase.js
index f43b1b58..88333c74 100755
--- a/js/tools/ToolBase.js
+++ b/js/tools/ToolBase.js
@@ -35,6 +35,8 @@ exports.toolBase = Montage.create(Component, {
35 _currentX: {value: 0, writable: true}, 35 _currentX: {value: 0, writable: true},
36 _currentY: {value: 0, writable: true}, 36 _currentY: {value: 0, writable: true},
37 37
38 _dragPlane: { value: null },
39
38 /** 40 /**
39 * This function is for specifying custom feedback routine 41 * This function is for specifying custom feedback routine
40 * upon mouse over. 42 * upon mouse over.
diff --git a/js/tools/drawing-tool-base.js b/js/tools/drawing-tool-base.js
index a752ad65..b5416a65 100755
--- a/js/tools/drawing-tool-base.js
+++ b/js/tools/drawing-tool-base.js
@@ -14,9 +14,16 @@ var drawUtils = require("js/helper-classes/3D/draw-utils").DrawUtils;
14 14
15exports.DrawingToolBase = Montage.create(Component, { 15exports.DrawingToolBase = Montage.create(Component, {
16 16
17 dragPlane: { 17 dragPlane:
18 value: null 18 {
19 get: function () {
20 return this.application.ninja.toolsData.selectedToolInstance._dragPlane;
21 },
22 set: function (value) {
23 this.application.ninja.toolsData.selectedToolInstance._dragPlane = value;
24 }
19 }, 25 },
26
20 /** 27 /**
21 * Used on the initial MouseDown for Drawing Tools 28 * Used on the initial MouseDown for Drawing Tools
22 * 29 *
diff --git a/js/tools/modifier-tool-base.js b/js/tools/modifier-tool-base.js
index 6c569f0a..14a7e619 100755
--- a/js/tools/modifier-tool-base.js
+++ b/js/tools/modifier-tool-base.js
@@ -21,7 +21,6 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
21 //------------------------------------------------------------------------- 21 //-------------------------------------------------------------------------
22 // Snapping-specific properties 22 // Snapping-specific properties
23 _canSnap: { value: true }, 23 _canSnap: { value: true },
24 _dragPlane: { value: null },
25 _snapParam: { value: null }, 24 _snapParam: { value: null },
26 _snapIndex: { value: -1 }, 25 _snapIndex: { value: -1 },
27 _useQuadPt: { value: false }, 26 _useQuadPt: { value: false },
@@ -163,15 +162,15 @@ exports.ModifierToolBase = Montage.create(DrawingTool, {
163 162
164 if(!this._dragPlane) 163 if(!this._dragPlane)
165 { 164 {
166// if( this._inLocalMode && (this._startMatArray.length === 1) ) 165 if((this._handleMode !== null) && (this.application.ninja.toolsData.selectedTool.action === "SelectionTool"))
167// { 166 {
168// this._dragPlane = viewUtils.getUnprojectedElementPlane(this._clickedObject); 167 this._dragPlane = viewUtils.getUnprojectedElementPlane(this.application.ninja.selectedElements[0]);
169// snapManager.setupDragPlaneFromPlane(this._dragPlane); 168 snapManager.setupDragPlaneFromPlane(this._dragPlane);
170// } 169 }
171// else 170 else
172// { 171 {
173 this._dragPlane = snapManager.setupDragPlanes( hitRec, true ); 172 this._dragPlane = snapManager.setupDragPlanes( hitRec, true );
174// } 173 }
175 } 174 }
176 175
177 // only do quadrant snapping if the 4 corners of the element are in the drag plane 176 // only do quadrant snapping if the 4 corners of the element are in the drag plane