From 02696ae741ccc229c9a16f021d988d78b85c5e59 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Wed, 18 Apr 2012 07:57:59 +0000 Subject: [PATCH] add 'uncheckItem' method to menus and menubuttons, fix toggleSize in video editor --- source/Ox.UI/js/Menu/Ox.Menu.js | 9 +++++++-- source/Ox.UI/js/Menu/Ox.MenuButton.js | 4 ++++ source/Ox.UI/js/Video/Ox.VideoEditor.js | 4 +++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/Ox.UI/js/Menu/Ox.Menu.js b/source/Ox.UI/js/Menu/Ox.Menu.js index 3f732ed6..8961a6ec 100644 --- a/source/Ox.UI/js/Menu/Ox.Menu.js +++ b/source/Ox.UI/js/Menu/Ox.Menu.js @@ -600,7 +600,7 @@ Ox.Menu = function(options, self) { /*@ checkItem @*/ - that.checkItem = function(id) { + that.checkItem = function(id, checked) { Ox.Log('Menu', 'checkItem id', id) var group, ids = id.split('_'), @@ -608,6 +608,7 @@ Ox.Menu = function(options, self) { offset, position, toggled; + checked = Ox.isUndefined(checked) ? true : checked; if (ids.length == 1) { item = that.getItem(id); group = item.options('group'); @@ -621,7 +622,7 @@ Ox.Menu = function(options, self) { }); } } else { - item.options({checked: true}); + item.options({checked: checked}); } } else { that.submenus[ids.shift()].checkItem(ids.join('_')); @@ -802,6 +803,10 @@ Ox.Menu = function(options, self) { return that.is(':hidden') ? that.showMenu() : that.hideMenu(); }; + that.uncheckItem = function(id) { + that.checkItem(id, false); + }; + return that; }; diff --git a/source/Ox.UI/js/Menu/Ox.MenuButton.js b/source/Ox.UI/js/Menu/Ox.MenuButton.js index 5fda7209..270b91dd 100644 --- a/source/Ox.UI/js/Menu/Ox.MenuButton.js +++ b/source/Ox.UI/js/Menu/Ox.MenuButton.js @@ -150,6 +150,10 @@ Ox.MenuButton = function(options, self) { return that; }; + that.uncheckItem = function(id) { + self.$menu.uncheckItem(id); + }; + return that; }; diff --git a/source/Ox.UI/js/Video/Ox.VideoEditor.js b/source/Ox.UI/js/Video/Ox.VideoEditor.js index dce16fae..d3af7100 100644 --- a/source/Ox.UI/js/Video/Ox.VideoEditor.js +++ b/source/Ox.UI/js/Video/Ox.VideoEditor.js @@ -1300,7 +1300,9 @@ Ox.VideoEditor = function(options, self) { self.options.videoSize = self.options.videoSize == 'small' ? 'large' : 'small'; setSizes(); - self.$menuButton.checkItem(self.options.videoSize); + self.$menuButton[ + self.options.videoSize == 'small' ? 'uncheckItem' : 'checkItem' + ]('size'); self.$player[0].options({ sizeIsLarge: self.options.videoSize == 'large' });