diff options
author | Jon Reid | 2012-06-20 15:05:26 -0700 |
---|---|---|
committer | Jon Reid | 2012-06-20 15:05:26 -0700 |
commit | 6e6c146f6e59c3942076b5d2f46b2962cc709926 (patch) | |
tree | aa6becc1e97aecbe6fb43aa33770def3c3de227d /js/panels/color | |
parent | f887a74a7d03a2008a2c43d455a2b3e9223028af (diff) | |
parent | c9852665eadc1acb9c1c881d207c4bd9ef88805f (diff) | |
download | ninja-6e6c146f6e59c3942076b5d2f46b2962cc709926.tar.gz |
Merge remote-tracking branch 'ninja-internal/master' into timeline-local
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 | //////////////////////////////////////////////////////////// |