fix a regression with regards to dragging/resizing

This commit is contained in:
rlx 2011-10-06 04:06:49 +00:00
parent 609f834cd3
commit 16078f0fbd
2 changed files with 12 additions and 12 deletions

View file

@ -155,15 +155,15 @@ Ox.Element = function(options, self) {
var clientX, clientY,
dragTimeout = 0,
mouseInterval = 0;
if (!self.mouseTimeout) {
if (!self._mouseTimeout) {
// first mousedown
that.triggerEvent('mousedown', e);
self.drag = false;
self.mouseup = false;
self.mouseTimeout = setTimeout(function() {
self._drag = false;
self._mouseup = false;
self._mouseTimeout = setTimeout(function() {
// 250 ms later, no subsequent click
self.mouseTimeout = 0;
if (self.mouseup) {
self._mouseTimeout = 0;
if (self._mouseup) {
// mouse went up, trigger singleclick
that.triggerEvent('singleclick', e);
} else {
@ -200,13 +200,13 @@ Ox.Element = function(options, self) {
// trigger dragend
that.triggerEvent('dragend', extend(e));
});
self.drag = true;
self._drag = true;
}
}, 250);
} else {
// second mousedown within 250 ms, trigger doubleclick
clearTimeout(self.mouseTimeout);
self.mouseTimeout = 0;
clearTimeout(self._mouseTimeout);
self._mouseTimeout = 0;
that.triggerEvent('doubleclick', e);
}
Ox.UI.$window.one('mouseup', mouseup);
@ -235,10 +235,10 @@ Ox.Element = function(options, self) {
that.triggerEvent('mouserepeat', e);
}
function mouseup(e) {
if (!self.mouseup && !self.drag) {
if (!self._mouseup && !self._drag) {
// mouse went up for the first time, trigger anyclick
that.triggerEvent('anyclick', e);
self.mouseup = true;
self._mouseup = true;
}
}
}

View file

@ -36,7 +36,7 @@ Ox.Button = function(options, self) {
selected: false,
size: 'medium',
// fixme: 'default' or ''?
style: 'default', // can be default, checkbox, symbol, or tab
style: 'default',
title: '',
tooltip: '',
type: 'text',