fix zorder system
This commit is contained in:
parent
89920e0b8e
commit
3f730301fe
1 changed files with 3 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ import { PixiRepresentation } from "../../Components/rendering/pixiRepresentatio
|
||||||
import { Entity, System } from "ecsy";
|
import { Entity, System } from "ecsy";
|
||||||
import { Position } from "../../Components/position";
|
import { Position } from "../../Components/position";
|
||||||
import { OrderZ } from "../../Components/rendering/orderZ";
|
import { OrderZ } from "../../Components/rendering/orderZ";
|
||||||
|
import globals from "../../globals";
|
||||||
|
|
||||||
|
|
||||||
export class ZOrderSystem extends System {
|
export class ZOrderSystem extends System {
|
||||||
|
|
@ -24,6 +25,8 @@ export class ZOrderSystem extends System {
|
||||||
let pos = entity.getComponent(Position).value
|
let pos = entity.getComponent(Position).value
|
||||||
representation.zIndex = pos.y + order.offset
|
representation.zIndex = pos.y + order.offset
|
||||||
});
|
});
|
||||||
|
if(this.queries.objects.changed.length > 0)
|
||||||
|
globals.app.stage.sortChildren()
|
||||||
}
|
}
|
||||||
|
|
||||||
static queries = {
|
static queries = {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue