From a9c026f6dbf93a0dab2a900e8635a948d5f662e5 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 29 Dec 2012 02:18:50 +0100 Subject: [PATCH] fix for MenuButton and Select double button toggle --- source/Ox.UI/js/Form/Select.js | 8 +++++--- source/Ox.UI/js/Menu/MenuButton.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source/Ox.UI/js/Form/Select.js b/source/Ox.UI/js/Form/Select.js index 09edc2c5..830bd3bd 100644 --- a/source/Ox.UI/js/Form/Select.js +++ b/source/Ox.UI/js/Form/Select.js @@ -90,7 +90,9 @@ Ox.Select = function(options, self) { width: self.options.width - 2 + 'px' }) .bindEvent({ - anyclick: showMenu, + anyclick: function(e) { + showMenu($(e.target).is('.OxButton') ? 'button' : null); + }, key_escape: loseFocus, key_down: showMenu }); @@ -214,10 +216,10 @@ Ox.Select = function(options, self) { } - function showMenu() { + function showMenu(from) { that.gainFocus(); that.addClass('OxSelected'); - self.$button.options({value: true}); + from != 'button' && self.$button.options({value: true}); self.options.tooltip && that.$tooltip.hide(); self.$menu.showMenu(); } diff --git a/source/Ox.UI/js/Menu/MenuButton.js b/source/Ox.UI/js/Menu/MenuButton.js index 69067f5d..178b4706 100644 --- a/source/Ox.UI/js/Menu/MenuButton.js +++ b/source/Ox.UI/js/Menu/MenuButton.js @@ -60,7 +60,9 @@ Ox.MenuButton = function(options, self) { width: self.options.width - 2 + 'px' }) .bindEvent({ - anyclick: showMenu + anyclick: function(e) { + showMenu($(e.target).is('.OxButton') ? 'button' : null); + }, }); if (self.options.type == 'text') { @@ -112,10 +114,10 @@ Ox.MenuButton = function(options, self) { that.triggerEvent('hide'); } - function showMenu() { + function showMenu(from) { that.gainFocus(); that.addClass('OxSelected'); - self.$button.options({value: true}); + from != 'button' && self.$button.options({value: true}); self.options.tooltip && that.$tooltip.hide(); self.$menu.showMenu(); that.triggerEvent('show');