1
0
Fork 0
forked from 0x2620/oxjs

some bugfixes

This commit is contained in:
rlx 2011-09-17 11:49:29 +00:00
commit ef1fa5fe84
14 changed files with 228 additions and 229 deletions

View file

@ -345,8 +345,8 @@ Ox.List = function(options, self) {
}
}
function dragstart(event, e) {
var $target = $(e.target),
function dragstart(data) {
var $target = $(data.target),
$parent = $target.parent();
if (
$target.is('.OxTarget') // icon lists
@ -360,44 +360,44 @@ Ox.List = function(options, self) {
// automatically passed already, somewhere?
that.triggerEvent('draganddropstart', {
ids: self.drag.ids,
_event: e
_event: data
});
}
}
function drag(event, e) {
function drag(data) {
self.drag && that.triggerEvent('draganddrop', {
ids: self.drag.ids,
_event: e
_event: data
});
}
function dragpause(event, e) {
function dragpause(data) {
self.drag && that.triggerEvent('draganddroppause', {
ids: self.drag.ids,
_event: e
_event: data
});
}
function dragenter(event, e) {
function dragenter(data) {
self.drag && that.triggerEvent('draganddropenter', {
ids: self.drag.ids,
_event: e
_event: data
});
}
function dragleave(event, e) {
function dragleave(data) {
self.drag && that.triggerEvent('draganddropleave', {
ids: self.drag.ids,
_event: e
_event: data
});
}
function dragend(event, e) {
function dragend(data) {
if (self.drag) {
that.triggerEvent('draganddropend', {
ids: self.drag.ids,
_event: e
_event: data
});
delete self.drag;
}
@ -763,12 +763,12 @@ Ox.List = function(options, self) {
loadPage(page + 1, fn);
}
function mousedown(event, e) {
var pos = findItemPosition(e);
function mousedown(data) {
var pos = findItemPosition(data);
self.hadFocus = that.hasFocus();
that.gainFocus();
if (pos > -1) {
if (e.metaKey) {
if (data.metaKey) {
if (!isSelected(pos) && (self.options.max == -1 || self.options.max > self.selected.length)) {
// meta-click on unselected item
addToSelection(pos);
@ -776,7 +776,7 @@ Ox.List = function(options, self) {
// meta-click on selected item
deselect(pos);
}
} else if (e.shiftKey) {
} else if (data.shiftKey) {
if (self.options.max == -1) {
// shift-click on item
addAllToSelection(pos);
@ -785,20 +785,20 @@ Ox.List = function(options, self) {
// click on unselected item
select(pos);
}
} else if (!$(e.target).is('.OxToggle') && self.options.min == 0) {
} else if (!$(data.target).is('.OxToggle') && self.options.min == 0) {
// click on empty area
selectNone();
}
}
function movestart(event, e) {
function movestart(data) {
self.drag = {
pos: findItemPosition(e)
pos: findItemPosition(data)
};
Ox.extend(self.drag, {
id: self.$items[self.drag.pos].options('data')[self.options.unique],
startPos: self.drag.pos,
startY: e.clientY,
startY: data.clientY,
stopPos: self.drag.pos
});
self.$items[self.drag.pos]
@ -808,8 +808,8 @@ Ox.List = function(options, self) {
});
}
function move(event, e) {
var clientY = e.clientY - that.offset()['top'],
function move(data) {
var clientY = data.clientY - that.offset()['top'],
offset = clientY % 16,
position = Ox.limit(parseInt(clientY / 16), 0, self.$items.length - 1);
if (position < self.drag.pos) {
@ -823,7 +823,7 @@ Ox.List = function(options, self) {
}
}
function moveend(event, e) {
function moveend(data) {
var $item = self.$items[self.drag.pos];
$item.removeClass('OxDrag')
.css({
@ -839,10 +839,10 @@ Ox.List = function(options, self) {
delete self.drag;
}
function singleclick(event, e) {
function singleclick(data) {
// these can't trigger on mousedown,
// since it could be a doubleclick
var pos = findItemPosition(e),
var pos = findItemPosition(data),
clickable, editable;
//alert('singleclick')
if (pos > -1) {
@ -867,7 +867,7 @@ Ox.List = function(options, self) {
}
}
function doubleclick(event, e) {
function doubleclick(data) {
open();
}