forked from 0x2620/oxjs
fix a bug where anyclick would fire on dragend
This commit is contained in:
parent
745aac2609
commit
609f834cd3
4 changed files with 5 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue