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> <head>
<title>OxJS ListMap Demo (async)</title <title>OxJS ListMap Demo (async)</title
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <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> <script type="text/javascript" src="js/listmap.js"></script>
</head> </head>
<body> <body>

View file

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

View file

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

View file

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