| 11 | } |
| 12 | |
| 13 | private createDisplayElement() { |
| 14 | this.displayElement = document.createElement('div'); |
| 15 | this.displayElement.style.position = 'fixed'; |
| 16 | this.displayElement.style.bottom = '10px'; |
| 17 | this.displayElement.style.right = '10px'; |
| 18 | this.displayElement.style.backgroundColor = 'black'; |
| 19 | this.displayElement.style.color = 'green'; |
| 20 | this.displayElement.style.padding = '5px 10px'; |
| 21 | this.displayElement.style.fontFamily = 'Arial, sans-serif'; |
| 22 | this.displayElement.style.fontSize = '16px'; |
| 23 | this.displayElement.style.zIndex = '1000'; |
| 24 | this.displayElement.setAttribute('data-fps', '0'); // Додаємо data-attribute |
| 25 | document.body.appendChild(this.displayElement); |
| 26 | |
| 27 | // Додаємо стилі для псевдоелемента ::after |
| 28 | const style = document.createElement('style'); |
| 29 | style.innerHTML = ` |
| 30 | [data-fps]::after { |
| 31 | content: attr(data-fps) ' FPS'; |
| 32 | position: absolute; |
| 33 | bottom: 0; |
| 34 | right: 0; |
| 35 | background-color: black; |
| 36 | color: green; |
| 37 | padding: 5px 10px; |
| 38 | font-family: Arial, sans-serif; |
| 39 | font-size: 16px; |
| 40 | z-index: 1000; |
| 41 | } |
| 42 | `; |
| 43 | document.head.appendChild(style); |
| 44 | } |
| 45 | |
| 46 | private startTracking() { |
| 47 | this.intervalId = setInterval(() => { |