Increase wheel step threshold
The previous value made the detection too sensitive and it was very difficult to scroll precisely. A value of 50 pixels should give similar behaviour to systems that don't do fine grained scrolling.
This commit is contained in:
parent
f84bc57bda
commit
88589a44f7
|
@ -42,7 +42,7 @@ const DEFAULT_BACKGROUND = 'rgb(40, 40, 40)';
|
|||
const MOUSE_MOVE_DELAY = 17;
|
||||
|
||||
// Wheel thresholds
|
||||
const WHEEL_STEP = 10; // Pixels needed for one step
|
||||
const WHEEL_STEP = 50; // Pixels needed for one step
|
||||
const WHEEL_LINE_HEIGHT = 19; // Assumed pixels for one line step
|
||||
|
||||
// Gesture thresholds
|
||||
|
@ -981,7 +981,7 @@ export default class RFB extends EventTargetMixin {
|
|||
|
||||
// Generate a mouse wheel step event when the accumulated delta
|
||||
// for one of the axes is large enough.
|
||||
if (Math.abs(this._accumulatedWheelDeltaX) > WHEEL_STEP) {
|
||||
if (Math.abs(this._accumulatedWheelDeltaX) >= WHEEL_STEP) {
|
||||
if (this._accumulatedWheelDeltaX < 0) {
|
||||
this._handleMouseButton(pos.x, pos.y, true, 1 << 5);
|
||||
this._handleMouseButton(pos.x, pos.y, false, 1 << 5);
|
||||
|
@ -992,7 +992,7 @@ export default class RFB extends EventTargetMixin {
|
|||
|
||||
this._accumulatedWheelDeltaX = 0;
|
||||
}
|
||||
if (Math.abs(this._accumulatedWheelDeltaY) > WHEEL_STEP) {
|
||||
if (Math.abs(this._accumulatedWheelDeltaY) >= WHEEL_STEP) {
|
||||
if (this._accumulatedWheelDeltaY < 0) {
|
||||
this._handleMouseButton(pos.x, pos.y, true, 1 << 3);
|
||||
this._handleMouseButton(pos.x, pos.y, false, 1 << 3);
|
||||
|
|
|
@ -2978,12 +2978,12 @@ describe('Remote Frame Buffer Protocol Client', function () {
|
|||
});
|
||||
|
||||
it('should accumulate wheel events if small enough', function () {
|
||||
sendWheelEvent(10, 10, 0, 4);
|
||||
sendWheelEvent(10, 10, 0, 4);
|
||||
sendWheelEvent(10, 10, 0, 20);
|
||||
sendWheelEvent(10, 10, 0, 20);
|
||||
|
||||
expect(pointerEvent).to.not.have.been.called;
|
||||
|
||||
sendWheelEvent(10, 10, 0, 4);
|
||||
sendWheelEvent(10, 10, 0, 20);
|
||||
|
||||
expect(pointerEvent).to.have.been.calledTwice;
|
||||
expect(pointerEvent.firstCall).to.have.been.calledWith(client._sock,
|
||||
|
@ -3003,7 +3003,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
|
|||
});
|
||||
|
||||
it('should handle line based wheel event', function () {
|
||||
sendWheelEvent(10, 10, 0, 1, 1);
|
||||
sendWheelEvent(10, 10, 0, 3, 1);
|
||||
|
||||
expect(pointerEvent).to.have.been.calledTwice;
|
||||
expect(pointerEvent.firstCall).to.have.been.calledWith(client._sock,
|
||||
|
@ -3013,7 +3013,7 @@ describe('Remote Frame Buffer Protocol Client', function () {
|
|||
});
|
||||
|
||||
it('should handle page based wheel event', function () {
|
||||
sendWheelEvent(10, 10, 0, 1, 2);
|
||||
sendWheelEvent(10, 10, 0, 3, 2);
|
||||
|
||||
expect(pointerEvent).to.have.been.calledTwice;
|
||||
expect(pointerEvent.firstCall).to.have.been.calledWith(client._sock,
|
||||
|
|
Loading…
Reference in New Issue