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, var clientX, clientY,
dragTimeout = 0, dragTimeout = 0,
mouseInterval = 0; mouseInterval = 0;
if (!self.mouseTimeout) { if (!self._mouseTimeout) {
// first mousedown // first mousedown
that.triggerEvent('mousedown', e); that.triggerEvent('mousedown', e);
self.drag = false; 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
self.mouseTimeout = 0; self._mouseTimeout = 0;
if (self.mouseup) { if (self._mouseup) {
// mouse went up, trigger singleclick // mouse went up, trigger singleclick
that.triggerEvent('singleclick', e); that.triggerEvent('singleclick', e);
} else { } else {
@ -200,13 +200,13 @@ Ox.Element = function(options, self) {
// trigger dragend // trigger dragend
that.triggerEvent('dragend', extend(e)); that.triggerEvent('dragend', extend(e));
}); });
self.drag = true; self._drag = true;
} }
}, 250); }, 250);
} else { } else {
// second mousedown within 250 ms, trigger doubleclick // second mousedown within 250 ms, trigger doubleclick
clearTimeout(self.mouseTimeout); clearTimeout(self._mouseTimeout);
self.mouseTimeout = 0; self._mouseTimeout = 0;
that.triggerEvent('doubleclick', e); that.triggerEvent('doubleclick', e);
} }
Ox.UI.$window.one('mouseup', mouseup); Ox.UI.$window.one('mouseup', mouseup);
@ -235,10 +235,10 @@ Ox.Element = function(options, self) {
that.triggerEvent('mouserepeat', e); that.triggerEvent('mouserepeat', e);
} }
function mouseup(e) { function mouseup(e) {
if (!self.mouseup && !self.drag) { 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;
} }
} }
} }

View file

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