소스 검색

Modify the panel

customisations
alemart 1 년 전
부모
커밋
d13bf1e20a
1개의 변경된 파일47개의 추가작업 그리고 14개의 파일을 삭제
  1. 47
    14
      src/core/stats-panel.ts

+ 47
- 14
src/core/stats-panel.ts 파일 보기

181
      */
181
      */
182
     private _createContainer(): HTMLDivElement
182
     private _createContainer(): HTMLDivElement
183
     {
183
     {
184
-        const container = document.createElement('div') as HTMLDivElement;
185
-        const print = (html: string) => container.insertAdjacentHTML('beforeend', html);
184
+        const container = document.createElement('div');
186
 
185
 
187
         container.style.position = 'absolute';
186
         container.style.position = 'absolute';
188
         container.style.left = container.style.top = '0px';
187
         container.style.left = container.style.top = '0px';
189
         container.style.zIndex = '1000000';
188
         container.style.zIndex = '1000000';
190
-        container.style.padding = '4px';
191
-        container.style.whiteSpace = 'pre-line';
192
-        container.style.backgroundColor = 'rgba(0,0,0,0.5)';
193
-        container.style.color = 'white';
194
-        container.style.fontFamily = 'monospace';
195
-        container.style.fontSize = '14px';
189
+        container.style.padding = '0px';
196
 
190
 
197
-        // all sanitized
198
-        container.innerText = 'encantAR.js ' + AR.version;
191
+        container.appendChild(this._createTitle());
192
+        container.appendChild(this._createContent());
199
 
193
 
200
-        print('<br>');
194
+        return container;
195
+    }
196
+
197
+    /**
198
+     * Create a title
199
+     * @returns a title
200
+     */
201
+    private _createTitle(): HTMLElement
202
+    {
203
+        const title = document.createElement('div');
204
+
205
+        title.style.backgroundColor = '#7e56c2';
206
+        title.style.color = 'white';
207
+        title.style.fontFamily = 'monospace';
208
+        title.style.fontSize = '14px';
209
+        title.style.fontWeight = 'bold';
210
+        title.style.padding = '2px';
211
+        title.innerHTML = '&#x2728;';
212
+        title.innerText += 'encantAR.js ' + AR.version;
213
+
214
+        return title;
215
+    }
216
+
217
+    /**
218
+     * Create a content container
219
+     * @returns a content container
220
+     */
221
+    private _createContent(): HTMLElement
222
+    {
223
+        const content = document.createElement('div');
224
+        const print = (html: string): void => content.insertAdjacentHTML('beforeend', html);
225
+
226
+        content.style.backgroundColor = 'rgba(0,0,0,0.5)';
227
+        content.style.color = 'white';
228
+        content.style.fontFamily = 'monospace';
229
+        content.style.fontSize = '14px';
230
+        content.style.padding = '2px';
231
+        content.style.whiteSpace = 'pre-line';
232
+
233
+        // all sanitized
201
         print('FPS: <span class="_ar_fps"></span> | ');
234
         print('FPS: <span class="_ar_fps"></span> | ');
202
         print('GPU: <span class="_ar_gpu"></span> ');
235
         print('GPU: <span class="_ar_gpu"></span> ');
203
         print('<span class="_ar_power"></span>');
236
         print('<span class="_ar_power"></span>');
210
 
243
 
211
         if(this._viewport.fullscreenAvailable) {
244
         if(this._viewport.fullscreenAvailable) {
212
             print('<br>');
245
             print('<br>');
213
-            container.appendChild(this._createFullscreenToggle());
246
+            content.appendChild(this._createFullscreenToggle());
214
         }
247
         }
215
 
248
 
216
-        return container;
249
+        return content;
217
     }
250
     }
218
 
251
 
219
     /**
252
     /**
222
      */
255
      */
223
     private _createFullscreenToggle(): HTMLElement
256
     private _createFullscreenToggle(): HTMLElement
224
     {
257
     {
225
-        const toggle = document.createElement('a') as HTMLAnchorElement;
258
+        const toggle = document.createElement('a');
226
 
259
 
227
         Utils.assert(this._viewport != null);
260
         Utils.assert(this._viewport != null);
228
 
261
 

Loading…
취소
저장