소스 검색

Raise event in SelectionGrid when appropriate

SelectionGrid would raise events even when the selection hasn't changed
habeebweeb 4 년 전
부모
커밋
ef1dcf7749
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/SelectionGrid.cs

+ 5 - 1
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/GUI/Controls/SelectionGrid.cs

@@ -34,7 +34,11 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             {
                 SimpleToggle toggle = new SimpleToggle(items[i], i == SelectedItem);
                 toggle.toggleIndex = i;
-                toggle.ControlEvent += (s, a) => this.SelectedItem = (s as SimpleToggle).toggleIndex;
+                toggle.ControlEvent += (s, a) =>
+                {
+                    int value = (s as SimpleToggle).toggleIndex;
+                    if (value != this.SelectedItem) this.SelectedItem = value;
+                };
                 toggles[i] = toggle;
             }
             return toggles;