feat: wheel

This commit is contained in:
cha0s 2019-05-23 05:38:54 -05:00
parent f3395d0e54
commit 4566bafae5

View File

@ -49,6 +49,7 @@ export class Stage extends decorate(Container) {
this.inputNormalizer.on('pointerDown', this.onPointerDown, this); this.inputNormalizer.on('pointerDown', this.onPointerDown, this);
this.inputNormalizer.on('pointerMove', this.onPointerMove, this); this.inputNormalizer.on('pointerMove', this.onPointerMove, this);
this.inputNormalizer.on('pointerUp', this.onPointerUp, this); this.inputNormalizer.on('pointerUp', this.onPointerUp, this);
this.inputNormalizer.on('wheel', this.onWheel, this);
// Put the renderer and UI in the container element, and mark it // Put the renderer and UI in the container element, and mark it
// focusable. // focusable.
this.element.appendChild(this.renderer.element); this.element.appendChild(this.renderer.element);
@ -93,6 +94,7 @@ export class Stage extends decorate(Container) {
this.inputNormalizer.off('pointerDown', this.onPointerDown); this.inputNormalizer.off('pointerDown', this.onPointerDown);
this.inputNormalizer.off('pointerMove', this.onPointerMove); this.inputNormalizer.off('pointerMove', this.onPointerMove);
this.inputNormalizer.off('pointerUp', this.onPointerUp); this.inputNormalizer.off('pointerUp', this.onPointerUp);
this.inputNormalizer.off('wheel', this.onWheel);
this.inputNormalizer.destroy(); this.inputNormalizer.destroy();
} }
@ -155,6 +157,10 @@ export class Stage extends decorate(Container) {
this.emit('pointerUp', event); this.emit('pointerUp', event);
} }
onWheel(event) {
this.emit('wheel', event);
}
onWindowResize() { onWindowResize() {
if (!this.parent) { if (!this.parent) {
return; return;