UNPKG

whs-cube-spheres

Version:

This plugin has a container with multiple spheres.

35 lines (30 loc) 697 B
export class EventsPatchModule { manager(manager) { this.element = manager.get('renderer').domElement; } patchEvents(originObject, destObject, events = []) { events.forEach(event => originObject.addEventListener(event, e => destObject.emit(event, e)) ); } integrate(self) { const {element, patchEvents} = self; patchEvents(element, this, [ 'mousemove', 'mouseup', 'contextmenu', 'mousedown', 'click', 'wheel', 'touchstart', 'touchend', 'touchmove', 'keydown' ]); patchEvents(element, this, [ 'keydown', 'keyup', 'keypress' ]); } }