diff options
author | Kruti Shah | 2012-06-20 15:12:48 -0700 |
---|---|---|
committer | Kruti Shah | 2012-06-20 15:12:48 -0700 |
commit | 1fe1202ba87d6de9b0f0d8efee78f955c5350210 (patch) | |
tree | 26ff4c6c5a94accfd5801f124244d3eef152a5c7 /js/panels/color | |
parent | 1ce4bd7033a413c7697888e5712f278219d6d095 (diff) | |
parent | 782b66c783df4a9c36fa240cc77900e69b9130cf (diff) | |
download | ninja-1fe1202ba87d6de9b0f0d8efee78f955c5350210.tar.gz |
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/panels/color')
-rwxr-xr-x | js/panels/color/colorpopup-manager.js | 56 |
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 | //////////////////////////////////////////////////////////// |