Bladeren bron

Fix effect pane activating effect unexpectedly

A bit of a logic error when I tried to make the pane "better."
habeebweeb 4 jaren geleden
bovenliggende
commit
6bb4f9cb42

+ 2 - 6
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectPane.cs

@@ -14,6 +14,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             set
             {
                 enabled = value;
+                if (updating) return;
                 EffectManager.SetEffectActive(enabled);
             }
         }
@@ -24,11 +25,7 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             resetEffectButton = new Button(Translation.Get("effectsPane", "reset"));
             resetEffectButton.ControlEvent += (s, a) => ResetEffect();
             effectToggle = new Toggle(Translation.Get("effectsPane", "onToggle"));
-            effectToggle.ControlEvent += (s, a) =>
-            {
-                if (updating) return;
-                Enabled = effectToggle.Value;
-            };
+            effectToggle.ControlEvent += (s, a) => Enabled = effectToggle.Value;
         }
 
         protected override void ReloadTranslation()
@@ -45,7 +42,6 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
         public override void UpdatePane()
         {
             if (!EffectManager.Ready) return;
-            if (EffectManager.Active != effectToggle.Value) EffectManager.SetEffectActive(effectToggle.Value);
             updating = true;
             effectToggle.Value = EffectManager.Active;
             UpdateControls();

+ 1 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Panes/BackgroundWindowPanes/EffectsPanes/EffectsPane.cs

@@ -5,8 +5,8 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
     internal class EffectsPane : BasePane
     {
         private readonly Dictionary<string, BasePane> effectPanes = new Dictionary<string, BasePane>();
-        private readonly SelectionGrid effectToggles;
         private readonly List<string> effectList = new List<string>();
+        private readonly SelectionGrid effectToggles;
         private BasePane currentEffectPane;
 
         public BasePane this[string effectUI]