fix: disconnect UI juggling
This commit is contained in:
parent
30b5f8b4f6
commit
3c03b9558d
|
@ -60,6 +60,8 @@ export class App extends decorate(class {}) {
|
|||
// World time.
|
||||
this.worldTime = new WorldTime();
|
||||
// Graphics.
|
||||
this.debugUiNode = undefined;
|
||||
this.reactContainer = undefined;
|
||||
this.lastIntensity = undefined;
|
||||
this.renderHandle = undefined;
|
||||
this.stage = new Stage(config.visibleSize, config.visibleScale);
|
||||
|
@ -159,6 +161,7 @@ export class App extends decorate(class {}) {
|
|||
parser: this.AugmentedParser,
|
||||
});
|
||||
this.socket.on('connect', () => {
|
||||
this.removeFromDom(document.querySelector('.app'));
|
||||
this.room.layers.destroy();
|
||||
this.selfEntity = undefined;
|
||||
this.selfEntityUuid = undefined;
|
||||
|
@ -170,9 +173,6 @@ export class App extends decorate(class {}) {
|
|||
this.stopRendering();
|
||||
this.stopSimulation();
|
||||
this.stopProcessingInput();
|
||||
setTimeout(() => {
|
||||
this.removeFromDom(document.querySelector('.app'));
|
||||
}, 0);
|
||||
});
|
||||
this.socket.on('packet', this.onPacket, this);
|
||||
}
|
||||
|
@ -357,8 +357,12 @@ export class App extends decorate(class {}) {
|
|||
}
|
||||
|
||||
removeFromDom(node) {
|
||||
ReactDOM.unmountComponentAtNode(this.debugUiNode);
|
||||
ReactDOM.unmountComponentAtNode(this.reactContainer);
|
||||
if (this.debugUiNode) {
|
||||
ReactDOM.unmountComponentAtNode(this.debugUiNode);
|
||||
}
|
||||
if (this.reactContainer) {
|
||||
ReactDOM.unmountComponentAtNode(this.reactContainer);
|
||||
}
|
||||
this.stage.removeFromDom(node);
|
||||
}
|
||||
|
||||
|
@ -366,7 +370,9 @@ export class App extends decorate(class {}) {
|
|||
// Add graphics stage.
|
||||
this.stage.addToDom(node);
|
||||
// UI.
|
||||
this.reactContainer = this.createReactContainer();
|
||||
if (!this.reactContainer) {
|
||||
this.reactContainer = this.createReactContainer();
|
||||
}
|
||||
this.stage.ui.appendChild(this.reactContainer);
|
||||
const UiComponent = <Ui
|
||||
app={this}
|
||||
|
|
|
@ -15,6 +15,7 @@ const decorate = compose(
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
}
|
||||
.menu-inner {
|
||||
transition: transform 0.125s;
|
||||
|
|
Loading…
Reference in New Issue
Block a user