fix: x/y changes should emit positionChanged
This commit is contained in:
parent
b4e6ed7c77
commit
fc2d873809
|
@ -37,6 +37,25 @@ class PositionedBase extends Trait {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listeners() {
|
||||||
|
return {
|
||||||
|
xChanged: (x, oldX) => {
|
||||||
|
this.entity.emit(
|
||||||
|
'positionChanged',
|
||||||
|
this.entity.position,
|
||||||
|
[oldX, this.entity.y]
|
||||||
|
);
|
||||||
|
},
|
||||||
|
yChanged: (y, oldY) => {
|
||||||
|
this.entity.emit(
|
||||||
|
'positionChanged',
|
||||||
|
this.entity.position,
|
||||||
|
[this.entity.x, oldY]
|
||||||
|
);
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Positioned extends decorate(PositionedBase) {}
|
export class Positioned extends decorate(PositionedBase) {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user