optimize: sepia application
This commit is contained in:
parent
6a93555354
commit
53e1ecc595
|
@ -66,7 +66,14 @@ export class App extends decorate(class {}) {
|
|||
this.roomView = new RoomView(this.room, this.stage.renderer);
|
||||
this.stage.addChild(this.roomView);
|
||||
this.on('darknessChanged', this.applyLighting, this);
|
||||
this.on('isFocusedChanged', this.applyLighting, this);
|
||||
this.on('isFocusedChanged', () => {
|
||||
if (this.isFocused) {
|
||||
this.stage.removeAllFilters();
|
||||
}
|
||||
else {
|
||||
this.stage.sepia();
|
||||
}
|
||||
})
|
||||
// Listen for new entities.
|
||||
this.room.on('entityAdded', this.onRoomEntityAdded, this);
|
||||
// Input.
|
||||
|
@ -100,7 +107,6 @@ export class App extends decorate(class {}) {
|
|||
}
|
||||
|
||||
applyLighting() {
|
||||
this.stage.removeAllFilters();
|
||||
const roomView = this.roomView;
|
||||
if (!roomView) {
|
||||
return;
|
||||
|
@ -128,9 +134,6 @@ export class App extends decorate(class {}) {
|
|||
const layerContainer = layerView.layerContainer;
|
||||
layerContainer.night(this.darkness);
|
||||
}
|
||||
if (!this.isFocused) {
|
||||
this.stage.paused(this.darkness);
|
||||
}
|
||||
}
|
||||
|
||||
calculateDarkness() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user