aboutsummaryrefslogtreecommitdiff
path: root/js/panels/color
diff options
context:
space:
mode:
authorArmen Kesablyan2012-06-20 15:00:19 -0700
committerArmen Kesablyan2012-06-20 15:00:19 -0700
commit120e31dcf1e11eed11ee430d77c438e7b073e9f8 (patch)
tree8c07b1203de42f6efdeebfc8663072fffb4a567b /js/panels/color
parentc59eb371559a3061ce53223e249ca97daace5968 (diff)
parent52833c3d8a485944c42acc6ac0ae5139b3427da8 (diff)
downloadninja-120e31dcf1e11eed11ee430d77c438e7b073e9f8.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Diffstat (limited to 'js/panels/color')
-rwxr-xr-xjs/panels/color/colorpopup-manager.js56
1 files changed, 17 insertions, 39 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 ////////////////////////////////////////////////////////////