mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +01:00
normalize mouse wheel
This commit is contained in:
parent
83113e65b2
commit
b674769ef8
5
package-lock.json
generated
5
package-lock.json
generated
@ -8438,6 +8438,11 @@
|
||||
"sort-keys": "1.1.2"
|
||||
}
|
||||
},
|
||||
"normalize-wheel": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz",
|
||||
"integrity": "sha1-rsiGr/2wRQcNhWRH32Ls+GFG7EU="
|
||||
},
|
||||
"npm": {
|
||||
"version": "2.15.12",
|
||||
"resolved": "https://registry.npmjs.org/npm/-/npm-2.15.12.tgz",
|
||||
|
@ -33,6 +33,7 @@
|
||||
"keycode": "^2.1.9",
|
||||
"lodash": "^4.17.4",
|
||||
"memoizee": "^0.3.9",
|
||||
"normalize-wheel": "^1.0.1",
|
||||
"pouchdb": "^6.3.4",
|
||||
"proptypes": "^1.1.0",
|
||||
"raf": "^3.4.0",
|
||||
|
@ -2,6 +2,7 @@ import { Group, Utils } from 'cal';
|
||||
import createListener from 'touch-events';
|
||||
import bowser from 'bowser';
|
||||
import { convertEvent, isMouseEvent } from '../utils/pointerUtils.js';
|
||||
import normalizeWheel from 'normalize-wheel';
|
||||
|
||||
const events = [
|
||||
'wheel', 'tap',
|
||||
@ -64,7 +65,7 @@ export default class EventGroup extends Group {
|
||||
if (event.event) gestureEvent.position = _convertEvent(event.event);
|
||||
if (event.events) gestureEvent.positions = event.events.map(_convertEvent);
|
||||
if (event.preEvents) gestureEvent.preDrags = event.preEvents.map(_convertEvent);
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = event.event.deltaY;
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
|
||||
this.onEvent(gestureEvent);
|
||||
}
|
||||
|
3
src/d3/EventScene.js
vendored
3
src/d3/EventScene.js
vendored
@ -3,6 +3,7 @@ import { Utils } from 'cal';
|
||||
import createListener from 'touch-events';
|
||||
import bowser from 'bowser';
|
||||
import { convertEvent, isMouseEvent } from '../utils/pointerUtils.js';
|
||||
import normalizeWheel from 'normalize-wheel';
|
||||
|
||||
const events = ['wheel', 'tap', 'dragstart', 'drag', 'dragend', 'seconddragstart', 'seconddrag',
|
||||
'seconddragend', 'multitouchstart', 'multitouch', 'multitouchend'];
|
||||
@ -41,7 +42,7 @@ export class EventScene extends THREE.Scene {
|
||||
if (event.event) gestureEvent.position = _convertEvent(event.event);
|
||||
if (event.events) gestureEvent.positions = event.events.map(_convertEvent);
|
||||
if (event.preEvents) gestureEvent.preDrags = event.preEvents.map(_convertEvent);
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = event.event.deltaY;
|
||||
if (event.event && event.event.deltaY !== undefined) gestureEvent.wheelDelta = normalizeWheel(event.event).pixelY;
|
||||
|
||||
this.onEvent(gestureEvent);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user