From d7ac9e834defd2a7f2ef7bb7082c504f4f498444 Mon Sep 17 00:00:00 2001 From: themancalledjakob Date: Mon, 1 Apr 2024 15:44:26 +0200 Subject: [PATCH] fix loader waits too long when project loads superfast dependencies hashes: openFrameworks d78075f4bca6be2a2533c6e51a75cc1f18404501 ofxMsdfgen e14da13d02c4dff04fb69d7923469f606924e6c3 ofxGPUFont d482bb7cbdf6b296fa4ab5abcf73fb5ff8c8b239 ofxVariableLab 0b5f9bdebc1e5550621957e73c040c258ec6317b ofxProfiler a868e34fa1a79189dd4fbdede2938e308535e5e8 theatre 86d3e07f6f2c75fd6e08fca8c97e3617c9e23b18 --- bin/em/variabletime/web/js/audio.js | 6 +++++- bin/em/variabletime/web/js/main.js | 14 +++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/em/variabletime/web/js/audio.js b/bin/em/variabletime/web/js/audio.js index 03fd88d..a4a079e 100644 --- a/bin/em/variabletime/web/js/audio.js +++ b/bin/em/variabletime/web/js/audio.js @@ -807,7 +807,11 @@ const Audio = function(tp, record) { addAudioButton(layer, propTitle, isActive); } }); - return props.length > 1 && props[0] !== 'dummy'; + const good = props.length > 1 && props[0] !== 'dummy'; + if (good) { + this.injectedPanelAtLeastOnce = true; + } + return good; }; const audioSourceCombos = {}; const readAudioFiles = () => { diff --git a/bin/em/variabletime/web/js/main.js b/bin/em/variabletime/web/js/main.js index b27164c..4c31f84 100644 --- a/bin/em/variabletime/web/js/main.js +++ b/bin/em/variabletime/web/js/main.js @@ -330,12 +330,16 @@ const setLoadingDoneHook = () => { if (!addedListener) { const panel = tp.getPanel(); if (panel !== null) { - addedListener = true; - const injectedAll = () => { + if (audio.injectedPanelAtLeastOnce) { window.setLoadingDone(); - tp.getPanel().removeEventListener('injectedAll', injectedAll); - }; - tp.getPanel().addEventListener('injectedAll', injectedAll); + } else { + addedListener = true; + const injectedAll = () => { + window.setLoadingDone(); + tp.getPanel().removeEventListener('injectedAll', injectedAll); + }; + tp.getPanel().addEventListener('injectedAll', injectedAll); + } clearInterval(loadingInjectInterval); } }