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