refactor: events
This commit is contained in:
parent
a0a3180eb9
commit
5f5f998543
|
@ -45,6 +45,11 @@ export default class InputNormalizer extends decorate(Class) {
|
||||||
this.stopListening();
|
this.stopListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit(...args) {
|
||||||
|
super.emit(...['*', ...args]);
|
||||||
|
super.emit(...args);
|
||||||
|
}
|
||||||
|
|
||||||
listen(target = window.document, targetForKeyUp = window.document) {
|
listen(target = window.document, targetForKeyUp = window.document) {
|
||||||
// Only listen once.
|
// Only listen once.
|
||||||
if (this.target) {
|
if (this.target) {
|
||||||
|
|
|
@ -76,11 +76,8 @@ export default () => class Controllable extends decorate(Trait) {
|
||||||
},
|
},
|
||||||
|
|
||||||
listenForInput: (inputNormalizer) => {
|
listenForInput: (inputNormalizer) => {
|
||||||
|
inputNormalizer.on('*', (...args) => this.entity.emit(...args));
|
||||||
this.$$actionRegistry.listen(inputNormalizer);
|
this.$$actionRegistry.listen(inputNormalizer);
|
||||||
// @todo leak
|
|
||||||
inputNormalizer.on('pointerMove', (event) => {
|
|
||||||
this.entity.emit('pointerMove', event);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user