fix a bug where anyclick would fire on dragend

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

View file

@ -3,7 +3,7 @@
<head>
<title>OxJS ListMap Demo (async)</title
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="../../build/Ox.js"></script>
<script type="text/javascript" src="../../dev/Ox.js"></script>
<script type="text/javascript" src="js/listmap.js"></script>
</head>
<body>

View file

@ -3,7 +3,7 @@
<head>
<title>OxJS Mouse Events Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<script type="text/javascript" src="../../build/Ox.js"></script>
<script type="text/javascript" src="../../dev/Ox.js"></script>
<script type="text/javascript" src="js/mouse.js"></script>
</head>
<body></body>

View file

@ -164,7 +164,6 @@ Ox.DocPanel = function(options, self) {
});
}
}
that.triggerEvent('select', data);
}
function sortByTitle(a, b) {

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;