chore: clean up listener creation
This commit is contained in:
parent
d250d94f3b
commit
654a9b4dd8
|
@ -28,23 +28,22 @@ class GraphicalBase extends Trait {
|
|||
}
|
||||
|
||||
listeners() {
|
||||
const listeners = {};
|
||||
const trackPosition = this.params.get('trackPosition');
|
||||
if (!trackPosition || !this._container.isValid) {
|
||||
return {};
|
||||
}
|
||||
return {
|
||||
traitAdded: (trait) => {
|
||||
if (trackPosition && this._container.isValid) {
|
||||
listeners.traitAdded = (trait) => {
|
||||
if ('positioned' === trait.constructor.type()) {
|
||||
this._container.position = this.entity.position;
|
||||
}
|
||||
},
|
||||
xChanged: (x) => {
|
||||
};
|
||||
listeners.xChanged = (x) => {
|
||||
this._container.x = x;
|
||||
},
|
||||
yChanged: (y) => {
|
||||
};
|
||||
listeners.yChanged = (y) => {
|
||||
this._container.y = y;
|
||||
},
|
||||
};
|
||||
}
|
||||
return listeners;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user