Skip to content
Snippets Groups Projects
Commit 7a1c4086 authored by DD Liu's avatar DD Liu
Browse files

Fix on Mac Chrome

parent b6796889
No related branches found
No related tags found
No related merge requests found
......@@ -47,23 +47,27 @@ class GUI extends React.Component {
this.audioEngine = new AudioEngine();
this.props.vm.attachAudioEngine(this.audioEngine);
this.props.vm.initialized = true;
const fontPromises = [];
if (document.fonts &&
typeof document.fonts.values === 'function' &&
typeof document.fonts.values()[Symbol.iterator] === 'function') {
for (const fontFace of document.fonts.values()) {
fontPromises.push(fontFace.loaded);
fontFace.load();
const getFontPromises = () => {
const fontPromises = [];
if (document.fonts &&
typeof document.fonts.values === 'function' &&
typeof document.fonts.values()[Symbol.iterator] === 'function') {
for (const fontFace of document.fonts.values()) {
fontPromises.push(fontFace.loaded);
fontFace.load();
}
}
}
return fontPromises;
};
if (document.readyState === 'complete') {
Promise.all(fontPromises).then(this.loadProject);
Promise.all(getFontPromises()).then(this.loadProject);
} else {
document.onreadystatechange = () => {
if (document.readyState !== 'complete') return;
document.onreadystatechange = null;
Promise.all(fontPromises).then(this.loadProject);
Promise.all(getFontPromises()).then(this.loadProject);
};
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment