1
0
Fork 0
forked from 0x2620/oxjs

fix a bug where anyclick would fire on dragend

This commit is contained in:
rolux 2011-10-07 17:51:05 +02:00
commit 609f834cd3
4 changed files with 5 additions and 4 deletions

View file

@ -158,6 +158,7 @@ Ox.Element = function(options, self) {
if (!self.mouseTimeout) {
// first mousedown
that.triggerEvent('mousedown', e);
self.drag = false;
self.mouseup = false;
self.mouseTimeout = setTimeout(function() {
// 250 ms later, no subsequent click
@ -199,6 +200,7 @@ Ox.Element = function(options, self) {
// trigger dragend
that.triggerEvent('dragend', extend(e));
});
self.drag = true;
}
}, 250);
} else {
@ -233,7 +235,7 @@ Ox.Element = function(options, self) {
that.triggerEvent('mouserepeat', e);
}
function mouseup(e) {
if (!self.mouseup) {
if (!self.mouseup && !self.drag) {
// mouse went up for the first time, trigger anyclick
that.triggerEvent('anyclick', e);
self.mouseup = true;