refactor: React container

This commit is contained in:
cha0s 2019-04-18 21:59:23 -05:00
parent f6d7833243
commit 74924f97ea

View File

@ -308,7 +308,16 @@ const UiComponent = <Ui
socket={socket}
worldTime={worldTime}
/>;
ReactDOM.render(UiComponent, stage.ui);
// Create UI layer for react.
const reactContainer = window.document.createElement('div');
reactContainer.className = 'react';
stage.on('displaySizeChanged', () => {
const displaySize = stage.displaySize;
reactContainer.style.width = '100%';
reactContainer.style.height = '100%';
})
stage.ui.appendChild(reactContainer);
ReactDOM.render(UiComponent, reactContainer);
// Debug UI.
const debugUiNode = document.querySelector('.debug-container');
const DebugUiComponent = <DebugUi