highlight player dot/spec on hover

This commit is contained in:
Robin Appelman 2024-12-22 15:54:14 +01:00
commit 3644dbda6e
7 changed files with 355 additions and 298 deletions

View file

@ -16,6 +16,8 @@ export interface MapRenderProps {
},
world: WorldBoundaries;
scale: number;
onHover: (userId: number) => void;
highlighted: number;
}
const map_root = document.querySelector('[data-maps]').getAttribute('data-maps');
@ -30,7 +32,10 @@ export function MapRender(props: MapRenderProps) {
style={{"background-image": background}}>
<For each={props.players}>{(player) =>
<Show when={player.health}>
<PlayerDot player={player} mapBoundary={props.world} targetSize={props.size} scale={props.scale}/>
<PlayerDot player={player} mapBoundary={props.world} targetSize={props.size} scale={props.scale}
onHover={props.onHover}
highlighted={props.highlighted === player.info.userId}
/>
</Show>
}</For>
<For each={props.buildings}>{(building) =>