Переглянути джерело

Changed to an optional chaining operator

Switching this undefined check to use the shorter optional chaining operator
Jordan Kintzle 4 роки тому
батько
коміт
3d77721182
1 змінених файлів з 2 додано та 6 видалено
  1. 2 6
      gui/src/2D/controls/toggleButton.ts

+ 2 - 6
gui/src/2D/controls/toggleButton.ts

@@ -109,13 +109,9 @@ export class ToggleButton extends Rectangle {
 
         // Update the visual state based on the new value
         if (this._isActive) {
-            if (this.toActiveAnimation) {
-                this.toActiveAnimation();
-            }
+            this.toActiveAnimation?.();
         } else {
-            if (this.toInactiveAnimation) {
-                this.toInactiveAnimation?.();
-            }
+            this.toInactiveAnimation?.();
         }
 
         this._markAsDirty();