Преглед изворни кода

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();