Compare commits
No commits in common. "2e853ba316bcd52502aa8c93e2e6acaa4083750e" and "41020bb3e5713e86b7bcba2778e16a8b2f9e11e4" have entirely different histories.
2e853ba316
...
41020bb3e5
1 changed files with 31 additions and 32 deletions
|
@ -62,10 +62,10 @@ Ox.Menu = function(options, self) {
|
||||||
' Ox' + Ox.toTitleCase(self.options.size)
|
' Ox' + Ox.toTitleCase(self.options.size)
|
||||||
)
|
)
|
||||||
.on({
|
.on({
|
||||||
|
click: click,
|
||||||
mouseenter: mouseenter,
|
mouseenter: mouseenter,
|
||||||
mouseleave: mouseleave,
|
mouseleave: mouseleave,
|
||||||
mousemove: mousemove,
|
mousemove: mousemove,
|
||||||
mouseup: mouseup,
|
|
||||||
mousewheel: mousewheel
|
mousewheel: mousewheel
|
||||||
})
|
})
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
|
@ -103,6 +103,29 @@ Ox.Menu = function(options, self) {
|
||||||
.addClass('OxBottom')
|
.addClass('OxBottom')
|
||||||
.appendTo(that);
|
.appendTo(that);
|
||||||
|
|
||||||
|
function click(event) {
|
||||||
|
var item,
|
||||||
|
position,
|
||||||
|
$target = $(event.target),
|
||||||
|
$parent = $target.parent();
|
||||||
|
// necessary for highlight
|
||||||
|
if ($parent.is('.OxCell')) {
|
||||||
|
$target = $parent;
|
||||||
|
$parent = $target.parent();
|
||||||
|
}
|
||||||
|
if ($target.is('.OxCell')) {
|
||||||
|
position = $parent.data('position');
|
||||||
|
item = that.items[position];
|
||||||
|
if (!item.options('disabled')) {
|
||||||
|
clickItem(position);
|
||||||
|
} else {
|
||||||
|
that.hideMenu();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
that.hideMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function clickItem(position, files) {
|
function clickItem(position, files) {
|
||||||
var item = that.items[position],
|
var item = that.items[position],
|
||||||
group = item.options('group'),
|
group = item.options('group'),
|
||||||
|
@ -245,41 +268,14 @@ Ox.Menu = function(options, self) {
|
||||||
if ($target.is('.OxCell')) {
|
if ($target.is('.OxCell')) {
|
||||||
position = $parent.data('position');
|
position = $parent.data('position');
|
||||||
item = that.items[position];
|
item = that.items[position];
|
||||||
if (position != self.options.selected) {
|
if (!item.options('disabled') && position != self.options.selected) {
|
||||||
if (!item.options('disabled')) {
|
selectItem(position);
|
||||||
selectItem(position);
|
|
||||||
} else {
|
|
||||||
mouseleave();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mouseleave();
|
mouseleave();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseup(event) {
|
|
||||||
var item,
|
|
||||||
position,
|
|
||||||
$target = $(event.target),
|
|
||||||
$parent = $target.parent();
|
|
||||||
// necessary for highlight
|
|
||||||
if ($parent.is('.OxCell')) {
|
|
||||||
$target = $parent;
|
|
||||||
$parent = $target.parent();
|
|
||||||
}
|
|
||||||
if ($target.is('.OxCell')) {
|
|
||||||
position = $parent.data('position');
|
|
||||||
item = that.items[position];
|
|
||||||
if (!item.options('disabled')) {
|
|
||||||
clickItem(position);
|
|
||||||
} else {
|
|
||||||
that.hideMenu();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
that.hideMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function mousewheel(e, delta, deltaX, deltaY) {
|
function mousewheel(e, delta, deltaX, deltaY) {
|
||||||
var $scrollbar;
|
var $scrollbar;
|
||||||
if (deltaY && !$(e.target).is('.OxScrollbar')) {
|
if (deltaY && !$(e.target).is('.OxScrollbar')) {
|
||||||
|
@ -380,6 +376,9 @@ Ox.Menu = function(options, self) {
|
||||||
return $('<div/>', {
|
return $('<div/>', {
|
||||||
'class': 'OxScrollbar Ox' + Ox.toTitleCase(direction),
|
'class': 'OxScrollbar Ox' + Ox.toTitleCase(direction),
|
||||||
html: Ox.SYMBOLS['triangle_' + direction],
|
html: Ox.SYMBOLS['triangle_' + direction],
|
||||||
|
click: function() { // fixme: do we need to listen to click event?
|
||||||
|
return false;
|
||||||
|
},
|
||||||
mousedown: function() {
|
mousedown: function() {
|
||||||
self.scrollSpeed = 2;
|
self.scrollSpeed = 2;
|
||||||
return false;
|
return false;
|
||||||
|
@ -809,7 +808,7 @@ Ox.Menu = function(options, self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/*@
|
/*@
|
||||||
setItemTitle <f> setItemTitle
|
setItemTitle <f> setItemTitle
|
||||||
(id, title) -> <o> set item title
|
(id, title) -> <o> set item title
|
||||||
@*/
|
@*/
|
||||||
that.setItemTitle = function(id, title) {
|
that.setItemTitle = function(id, title) {
|
||||||
|
@ -836,7 +835,7 @@ Ox.Menu = function(options, self) {
|
||||||
that.gainFocus();
|
that.gainFocus();
|
||||||
that.$layer = Ox.Layer({type: 'menu'})
|
that.$layer = Ox.Layer({type: 'menu'})
|
||||||
.css({top: self.options.mainmenu ? '20px' : 0})
|
.css({top: self.options.mainmenu ? '20px' : 0})
|
||||||
.on({mouseup: clickLayer})
|
.bindEvent({click: clickLayer})
|
||||||
.show();
|
.show();
|
||||||
}
|
}
|
||||||
return that;
|
return that;
|
||||||
|
|
Loading…
Reference in a new issue