diff --git a/src/mobile-hud.js b/src/mobile-hud.js index 1cbbc68..d549d7b 100644 --- a/src/mobile-hud.js +++ b/src/mobile-hud.js @@ -3,8 +3,8 @@ import topHudSrc from './assets/controller/top-hud.js'; import leftStatusSrc from './assets/controller/left-status.js'; import rightControlsSrc from './assets/controller/right-controls.js'; import cannonRoundelSrc from './assets/controller/cannon-roundel.js'; - -const helmSpriteSheetSrc = '/assets/controller/helm-sheet.webp'; +import helmFrameSrc from './assets/controller/helm-frame.js'; +import helmKnobSrc from './assets/controller/helm-knob.js'; const isDesktopPointer = window.matchMedia('(hover: hover) and (pointer: fine)'); @@ -162,22 +162,27 @@ if (!isDesktopPointer.matches) { aspect-ratio: 1; } - .steam-helm-frame, - .steam-helm-inner { + .steam-helm-frame { position: absolute; inset: 0; - background-repeat: no-repeat; - background-size: 300% 300%; + width: 100%; + height: 100%; + object-fit: contain; pointer-events: none; + z-index: 1; } - .steam-helm-frame { - background-position: 50% 50%; - } - - .steam-helm-inner { - background-position: 50% 50%; - clip-path: circle(36% at 50% 48%); + .steam-helm-knob { + position: absolute; + left: 50%; + top: 46%; + width: 32%; + height: auto; + object-fit: contain; + transform: translate(-50%, -50%); + pointer-events: none; + z-index: 3; + will-change: transform; } .steam-helm-label { @@ -201,6 +206,7 @@ if (!isDesktopPointer.matches) { height: 69%; border-radius: 50%; overflow: hidden; + z-index: 2; } .steam-radar-player, @@ -442,15 +448,19 @@ if (!isDesktopPointer.matches) { const radarPiece = document.createElement('div'); radarPiece.className = 'steam-piece steam-radar-wrap'; - const helmFrame = document.createElement('div'); + const helmFrame = document.createElement('img'); helmFrame.className = 'steam-helm-frame'; - helmFrame.style.backgroundImage = `url("${helmSpriteSheetSrc}")`; + helmFrame.src = helmFrameSrc; + helmFrame.alt = ''; + helmFrame.draggable = false; radarPiece.appendChild(helmFrame); - const helmInner = document.createElement('div'); - helmInner.className = 'steam-helm-inner'; - helmInner.style.backgroundImage = `url("${helmSpriteSheetSrc}")`; - radarPiece.appendChild(helmInner); + const helmKnob = document.createElement('img'); + helmKnob.className = 'steam-helm-knob'; + helmKnob.src = helmKnobSrc; + helmKnob.alt = ''; + helmKnob.draggable = false; + radarPiece.appendChild(helmKnob); radarPiece.insertAdjacentHTML('beforeend', `