From f47dace72a81cddfa29d89540629cfdd76d54b18 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Mon, 18 Jun 2012 11:36:20 -0700 Subject: Fixed - IKNINJA-1313 - File menu drop down should close when New File dialog is opened Signed-off-by: Ananya Sen --- js/components/menu/menu-entry.reel/menu-entry.js | 4 ++-- js/components/menu/menu.reel/menu.js | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) (limited to 'js') diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js index b9c546ed..ae3469c6 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js @@ -83,7 +83,7 @@ exports.MenuEntry = Montage.create(Component, { } }, - handleClick: { + captureMousedown: { value: function(event) { // TODO: Hack! Rework this! this.parentComponent.ownerComponent.toggleActivation(this); @@ -105,7 +105,7 @@ exports.MenuEntry = Montage.create(Component, { this.topHeaderText.innerHTML = this.data.header; - this.element.addEventListener("click", this, false); + this.element.addEventListener("mousedown", this, true); Object.defineBinding(this, "menuIsActive", { boundObject: this._menu, diff --git a/js/components/menu/menu.reel/menu.js b/js/components/menu/menu.reel/menu.js index 50d3f0bc..1560100a 100755 --- a/js/components/menu/menu.reel/menu.js +++ b/js/components/menu/menu.reel/menu.js @@ -83,19 +83,12 @@ exports.Menu = Montage.create(Component, { handleMousedown: { value: function(evt) { - if(this.active && (this.getZIndex(evt.target) < 9000 || evt.target.id === "topMenu")) { this._activeEntry.deselect(); this._activeEntry = null; this.active = false; - - //console.log(this.rep.objects[1]); - //this.controller.content[1].header = "BLAH"; + this.element.ownerDocument.removeEventListener('mousedown', this, false); } - -// console.log(evt.target.style['z-index']); -// console.log(this.getZIndex(evt.target)); - } }, -- cgit v1.2.3 From 0f59f00621c371ccee6793c57e17314d0a5a8fbe Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 19 Jun 2012 10:55:36 -0700 Subject: Fix for IKNINJA-1754 (CLONE) - Menu Component: Hovering over another main menu does not work when a main menu drop down is already displayed. Signed-off-by: Ananya Sen --- js/components/menu/menu-entry.reel/menu-entry.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'js') diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js index ae3469c6..b765471b 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js @@ -107,6 +107,9 @@ exports.MenuEntry = Montage.create(Component, { this.element.addEventListener("mousedown", this, true); + this.topHeader.addEventListener("mouseover", this, false);//Todo: check why this listener as not getting added menuIsActive + + //Todo: check this binding Object.defineBinding(this, "menuIsActive", { boundObject: this._menu, boundObjectPropertyPath: "active", -- cgit v1.2.3 From ddeb291801a49b90062510d4e05f8531216cdff9 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 19 Jun 2012 11:30:15 -0700 Subject: IKNINJA 1754 menu not opening on hover Signed-off-by: Valerio Virgillito --- js/components/menu/menu-entry.reel/menu-entry.js | 26 ++++++------------------ js/components/menu/menu-item.reel/menu-item.js | 9 +++----- js/components/menu/menu.reel/menu.html | 3 ++- 3 files changed, 11 insertions(+), 27 deletions(-) (limited to 'js') diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js index b9c546ed..4fea0fe9 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js @@ -9,18 +9,15 @@ var Component = require("montage/ui/component").Component; exports.MenuEntry = Montage.create(Component, { topHeader: { - value: null, - serializable: true + value: null }, topHeaderText: { - value: null, - serializable: true + value: null }, subEntries: { - value: null, - serializable: true + value: null }, // Reference to the parent Menu component @@ -36,8 +33,7 @@ exports.MenuEntry = Montage.create(Component, { if(value !== this._menu) { this._menu = value; } - }, - serializable: true + } }, _data: { @@ -52,8 +48,7 @@ exports.MenuEntry = Montage.create(Component, { if(this._data !== value) { this._data = value; } - }, - serializable: true + } }, select: { @@ -79,7 +74,7 @@ exports.MenuEntry = Montage.create(Component, { return this._menuIsActive; }, set: function(value) { - if(value) this.topHeader.addEventListener("mouseover", this, false); + if(value) this.element.addEventListener("mouseover", this, false); } }, @@ -87,14 +82,12 @@ exports.MenuEntry = Montage.create(Component, { value: function(event) { // TODO: Hack! Rework this! this.parentComponent.ownerComponent.toggleActivation(this); -// this._menu.toggleActivation(this); } }, handleMouseover: { value: function(event) { this.parentComponent.ownerComponent.activeEntry = this; -// this._menu.activeEntry = this; } }, @@ -106,13 +99,6 @@ exports.MenuEntry = Montage.create(Component, { this.topHeaderText.innerHTML = this.data.header; this.element.addEventListener("click", this, false); - - Object.defineBinding(this, "menuIsActive", { - boundObject: this._menu, - boundObjectPropertyPath: "active", - oneway: true - }); - } } }); \ No newline at end of file diff --git a/js/components/menu/menu-item.reel/menu-item.js b/js/components/menu/menu-item.reel/menu-item.js index f9a625a3..3a5bf4ab 100755 --- a/js/components/menu/menu-item.reel/menu-item.js +++ b/js/components/menu/menu-item.reel/menu-item.js @@ -10,18 +10,15 @@ var Component = require("montage/ui/component").Component; exports.MenuItem = Montage.create(Component, { itemBackground: { - value: null, - serializable: true + value: null }, itemText: { - value: null, - serializable: true + value: null }, subMenu: { - value: null, - serializable: true + value: null }, data: { diff --git a/js/components/menu/menu.reel/menu.html b/js/components/menu/menu.reel/menu.html index f18c1a0f..98ffa92c 100755 --- a/js/components/menu/menu.reel/menu.html +++ b/js/components/menu/menu.reel/menu.html @@ -44,7 +44,8 @@ "element": { "#": "menuItem" } }, "bindings": { - "data": {"<-": "@repetition.objectAtCurrentIteration"} + "data": {"<-": "@repetition.objectAtCurrentIteration"}, + "menuIsActive": {"<-": "@owner.active"} } }, -- cgit v1.2.3 From fb553a8054162b2aa0848d86b11d4e27002bffa9 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Tue, 19 Jun 2012 13:50:10 -0700 Subject: Reverting last change since this is is being made in a different pull request. Signed-off-by: Ananya Sen --- js/components/menu/menu-entry.reel/menu-entry.js | 3 --- 1 file changed, 3 deletions(-) (limited to 'js') diff --git a/js/components/menu/menu-entry.reel/menu-entry.js b/js/components/menu/menu-entry.reel/menu-entry.js index b765471b..ae3469c6 100755 --- a/js/components/menu/menu-entry.reel/menu-entry.js +++ b/js/components/menu/menu-entry.reel/menu-entry.js @@ -107,9 +107,6 @@ exports.MenuEntry = Montage.create(Component, { this.element.addEventListener("mousedown", this, true); - this.topHeader.addEventListener("mouseover", this, false);//Todo: check why this listener as not getting added menuIsActive - - //Todo: check this binding Object.defineBinding(this, "menuIsActive", { boundObject: this._menu, boundObjectPropertyPath: "active", -- cgit v1.2.3 From aad41becbc41882abf1558c6b5aa38db6a9e99c8 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 19 Jun 2012 15:06:45 -0700 Subject: Fixing logic to close color panel popup This resolves closing the color panel popup when a user make a click outside the popup area or resizes the Ninja window. This should be tested prior to merging. --- js/panels/color/colorpopup-manager.js | 56 +++++++++++------------------------ 1 file changed, 17 insertions(+), 39 deletions(-) (limited to 'js') 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, { enumerable: false, value: function () { //////////////////////////////////////////////////////////// - //TODO: Improve logic on handling closing the popup - //////////////////////////////////////////////////////////// - //Hiding popup on any panel(s) actions - this.eventManager.addEventListener("panelOrderChanged", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelClose", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelCollapsed", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelSelected", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("togglePanel", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelResizing", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelResizedStart", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // - this.eventManager.addEventListener("panelResizedEnd", function (e) { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); - }.bind(this)); - // + //Closing popups on resize window.addEventListener('resize', function (e) { this.application.ninja.colorController.colorPopupManager.hideColorPopup(); }.bind(this)); - // + //Storing limits of popup + var top, bottom, left, right; + //Closing popups if outside limits document.addEventListener('mousedown', function (e) { - // - if (e._event.srcElement.getAttribute('data-montage-id') === 'stageCanvas' || e._event.srcElement.id === 'mainContainer' || e._event.srcElement.getAttribute('data-montage-id') === 'drawingCanvas') { - this.application.ninja.colorController.colorPopupManager.hideColorPopup(); + //Checking for popup to be opened otherwise nothing happens + if (this._popupPanel.opened && this._popupPanel.popup && this._popupPanel.popup.element && !e._event.srcElement.inputType) { + //Getting horizontal limits + left = parseInt(this._popupPanel.popup.element.style.left) + parseInt(this._popupPanel.popup.element.style.marginLeft); + right = left + parseInt(this._popupPanel.popup.element.offsetWidth); + //Getting vertical limits + top = parseInt(this._popupPanel.popup.element.style.top) + parseInt(this._popupPanel.popup.element.style.marginTop); + bottom = left + parseInt(this._popupPanel.popup.element.offsetHeight); + //Checking click position in relation to limits + if ((e._event.clientX < left || e._event.clientX > right) || (e._event.clientY < top || e._event.clientY > bottom)) { + //Hides popups since click is outside limits + this.application.ninja.colorController.colorPopupManager.hideColorPopup(); + } } }.bind(this)); //////////////////////////////////////////////////////////// -- cgit v1.2.3