Przeglądaj źródła

Make HUD.visible obsolete

customisations
alemart 5 miesięcy temu
rodzic
commit
4c7474d1c0
2 zmienionych plików z 28 dodań i 6 usunięć
  1. 6
    2
      docs/api/hud.md
  2. 22
    4
      src/core/hud.ts

+ 6
- 2
docs/api/hud.md Wyświetl plik

12
 
12
 
13
 ### visible
13
 ### visible
14
 
14
 
15
-`hud.visible: boolean`
15
+<span style="text-decoration: line-through">`hud.visible: boolean, read-only`</span>
16
 
16
 
17
-Whether or not the HUD is visible.
17
+Whether or not the HUD is visible.
18
+
19
+*Deprecated since:* 0.4.3
20
+
21
+*Note:* this property is read-only since 0.4.3

+ 22
- 4
src/core/hud.ts Wyświetl plik

92
 
92
 
93
     /**
93
     /**
94
      * Whether or not the HUD is visible
94
      * Whether or not the HUD is visible
95
+     * @deprecated what's the purpose of this being public?
95
      */
96
      */
96
     get visible(): boolean
97
     get visible(): boolean
97
     {
98
     {
98
-        return !this._container.hidden;
99
+        return this._visible;
99
     }
100
     }
100
 
101
 
101
     /**
102
     /**
102
      * Whether or not the HUD is visible
103
      * Whether or not the HUD is visible
104
+     * @deprecated what's the purpose of this being public?
103
      */
105
      */
104
     set visible(visible: boolean)
106
     set visible(visible: boolean)
105
     {
107
     {
106
-        this._container.hidden = !visible;
108
+        // this setter does nothing since 0.4.3
107
     }
109
     }
108
 
110
 
109
     /**
111
     /**
136
         container.style.zIndex = String(zIndex);
138
         container.style.zIndex = String(zIndex);
137
         container.style.userSelect = 'none';
139
         container.style.userSelect = 'none';
138
 
140
 
139
-        this.visible = true;
141
+        this._visible = true;
140
     }
142
     }
141
 
143
 
142
     /**
144
     /**
145
      */
147
      */
146
     _release(): void
148
     _release(): void
147
     {
149
     {
148
-        this.visible = false;
150
+        this._visible = false;
149
 
151
 
150
         this.#fullscreenButton.release();
152
         this.#fullscreenButton.release();
151
         this.#statsPanel.release();
153
         this.#statsPanel.release();
170
 
172
 
171
         return node;
173
         return node;
172
     }
174
     }
175
+
176
+    /**
177
+     * Whether or not the HUD is visible
178
+     */
179
+    private get _visible(): boolean
180
+    {
181
+        return !this._container.hidden;
182
+    }
183
+
184
+    /**
185
+     * Whether or not the HUD is visible
186
+     */
187
+    private set _visible(visible: boolean)
188
+    {
189
+        this._container.hidden = !visible;
190
+    }
173
 }
191
 }

Ładowanie…
Anuluj
Zapisz