fix popup blur and dropshadow counts

This commit is contained in:
woodser 2025-05-28 10:03:18 -04:00
parent c3c8487682
commit f71e38c87d
No known key found for this signature in database
GPG key ID: 55A10DD48ADEE5EF

View file

@ -139,6 +139,7 @@ public abstract class Overlay<T extends Overlay<T>> {
} }
private static int numOverlays = 0; private static int numOverlays = 0;
private static int numBlurEffects = 0;
protected final static double DEFAULT_WIDTH = 668; protected final static double DEFAULT_WIDTH = 668;
protected Stage stage; protected Stage stage;
@ -242,13 +243,13 @@ public abstract class Overlay<T extends Overlay<T>> {
if (gridPane != null) { if (gridPane != null) {
animateHide(); animateHide();
} }
numOverlays--;
isDisplayed = false; isDisplayed = false;
isHiddenProperty.set(true); isHiddenProperty.set(true);
} }
protected void animateHide() { protected void animateHide() {
animateHide(() -> { animateHide(() -> {
numOverlays--;
removeEffectFromBackground(); removeEffectFromBackground();
if (stage != null) if (stage != null)
@ -744,7 +745,8 @@ public abstract class Overlay<T extends Overlay<T>> {
} }
protected void addEffectToBackground() { protected void addEffectToBackground() {
if (numOverlays > 1) return; numBlurEffects++;
if (numBlurEffects > 1) return;
if (type.changeBackgroundType == ChangeBackgroundType.BlurUltraLight) if (type.changeBackgroundType == ChangeBackgroundType.BlurUltraLight)
MainView.blurUltraLight(); MainView.blurUltraLight();
else if (type.changeBackgroundType == ChangeBackgroundType.BlurLight) else if (type.changeBackgroundType == ChangeBackgroundType.BlurLight)
@ -814,7 +816,8 @@ public abstract class Overlay<T extends Overlay<T>> {
} }
protected void removeEffectFromBackground() { protected void removeEffectFromBackground() {
if (numOverlays > 0) return; numBlurEffects--;
if (numBlurEffects > 0) return;
MainView.removeEffect(); MainView.removeEffect();
} }