mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-01-09 18:45:51 +00:00
fix: make mousewheel work for gpm
This commit is contained in:
parent
efe4e475a6
commit
d8eff3fa55
@ -130,11 +130,11 @@ function GpmClient(options) {
|
|||||||
switch(evnt.type & 15) {
|
switch(evnt.type & 15) {
|
||||||
case GPM_MOVE:
|
case GPM_MOVE:
|
||||||
if (evnt.dx || evnt.dy) self.emit('move', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
if (evnt.dx || evnt.dy) self.emit('move', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
||||||
if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.wdx, evnt.wdy)
|
if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy)
|
||||||
break;
|
break;
|
||||||
case GPM_DRAG:
|
case GPM_DRAG:
|
||||||
if (evnt.dx || evnt.dy) self.emit('drag', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
if (evnt.dx || evnt.dy) self.emit('drag', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
||||||
if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.wdx, evnt.wdy)
|
if (evnt.wdx || evnt.wdy) self.emit('mousewheel', evnt.buttons, evnt.modifiers, evnt.x, evnt.y, evnt.wdx, evnt.wdy)
|
||||||
break;
|
break;
|
||||||
case GPM_DOWN:
|
case GPM_DOWN:
|
||||||
self.emit('btndown', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
self.emit('btndown', evnt.buttons, evnt.modifiers, evnt.x, evnt.y)
|
||||||
|
@ -679,13 +679,12 @@ Program.prototype.enableGpm = function() {
|
|||||||
self.emit('keypress', null, key);
|
self.emit('keypress', null, key);
|
||||||
self.emit('mouse', key);
|
self.emit('mouse', key);
|
||||||
});
|
});
|
||||||
this.gpm.on('nousewheel', function(btn,modifier, dx, dy) {
|
this.gpm.on('mousewheel', function(btn,modifier, x, y, dx, dy) {
|
||||||
x--, y--;
|
|
||||||
var key={
|
var key={
|
||||||
name: 'mouse', type: 'GPM',
|
name: 'mouse', type: 'GPM',
|
||||||
action: dy>0? 'wheelup':'wheeldown',
|
action: dy>0? 'wheelup':'wheeldown',
|
||||||
button: self.gpm.ButtonName(btn),
|
button: self.gpm.ButtonName(btn),
|
||||||
raw: [btn,modifier, x, y],
|
raw: [btn,modifier, x, y, dx, dy],
|
||||||
x: x, y: y,
|
x: x, y: y,
|
||||||
shift: self.gpm.hasShiftKey(modifier),
|
shift: self.gpm.hasShiftKey(modifier),
|
||||||
meta: self.gpm.hasMetaKey(modifier),
|
meta: self.gpm.hasMetaKey(modifier),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user