File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
engine/modules/entities/src/main/resources/view/entity-module Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -11,17 +11,28 @@ export class BufferedGroup extends Group {
1111 flagForDestructionOnReinit ( this . gameTexture )
1212 this . graphics = new PIXI . Sprite ( this . gameTexture )
1313 this . buffer = new PIXI . Container ( )
14+ this . needsRender = true
1415 }
1516
1617 updateDisplay ( state , changed , globalData ) {
1718 super . updateDisplay ( state , changed , globalData )
1819 }
1920
2021 postUpdate ( ) {
21- getRenderer ( ) . render ( this . buffer , this . gameTexture )
22+ if ( this . needsRender ) {
23+ getRenderer ( ) . render ( this . buffer , this . gameTexture )
24+ this . needsRender = false
25+ }
2226 }
2327
2428 get childrenContainer ( ) {
2529 return this . buffer
2630 }
31+
32+ notifyChange ( ) {
33+ this . needsRender = true
34+ if ( this . parent ) {
35+ this . parent . notifyChange ( )
36+ }
37+ }
2738}
Original file line number Diff line number Diff line change @@ -110,12 +110,21 @@ export class Entity {
110110 if ( changed . mask ) {
111111 globalData . maskUpdates [ this . id ] = state . mask
112112 }
113+ if ( Object . keys ( changed ) . length !== 0 && this . parent ) {
114+ this . parent . notifyChange ( )
115+ }
113116 }
114117 } else {
115118 Object . assign ( this . currentState , this . defaultState )
116119 }
117120 }
118121
122+ notifyChange ( ) {
123+ if ( this . parent ) {
124+ this . parent . notifyChange ( )
125+ }
126+ }
127+
119128 initDisplay ( ) {
120129 this . container = new PIXI . Container ( )
121130 this . container . zIndex = this . defaultState . zIndex
Original file line number Diff line number Diff line change @@ -173,7 +173,9 @@ export class GraphicEntityModule {
173173 if ( e instanceof Group ) {
174174 e . childrenContainer . removeChildren ( )
175175 e . currentState . children . forEach ( id => {
176- e . childrenContainer . addChild ( this . entities . get ( id ) . container )
176+ const child = this . entities . get ( id )
177+ e . childrenContainer . addChild ( child . container )
178+ child . parent = e
177179 } )
178180 }
179181 } )
You can’t perform that action at this time.
0 commit comments