Merge pull request #63 from beardtree/click-fix

Fixes clicking when mousedown element != mouseup element
This commit is contained in:
Christopher Jeffrey 2014-06-05 01:24:04 -05:00
commit a1ea57eaf0
1 changed files with 5 additions and 2 deletions

View File

@ -480,8 +480,11 @@ Screen.prototype._listenMouse = function(el) {
if (data.x >= pos.xi && data.x < pos.xl if (data.x >= pos.xi && data.x < pos.xl
&& data.y >= pos.yi && data.y < pos.yl) { && data.y >= pos.yi && data.y < pos.yl) {
el.emit('mouse', data); el.emit('mouse', data);
if (data.action === 'mouseup') { if (data.action === 'mousedown') {
el.emit('click', data); self.mouseDown = el;
} else if (data.action === 'mouseup') {
(self.mouseDown || el).emit('click', data);
self.mouseDown = null;
} else if (data.action === 'mousemove') { } else if (data.action === 'mousemove') {
if (self.hover && el.index > self.hover.index) { if (self.hover && el.index > self.hover.index) {
set = false; set = false;