]> git.r.bdr.sh - rbdr/canvas/blame - src/lib/components/hud.svelte
Save WIP
[rbdr/canvas] / src / lib / components / hud.svelte
CommitLineData
3717f7fb 1<script>
587d8fe6
RBR
2 import { coordinateLength } from '$lib/config';
3 import { canvas } from '$lib/stores/canvas';
3717f7fb 4
587d8fe6 5 const kSeparatorRegex = /([0-9a-z]{2})/g;
3717f7fb 6
587d8fe6
RBR
7 const formatCoordinate = function formatCoordinate(coordinate) {
8 return coordinate.toString(16).padStart(coordinateLength, 0).replace(kSeparatorRegex, '$1 ');
9 };
3717f7fb
RBR
10</script>
11
12<div class="hud">
587d8fe6 13 {formatCoordinate($canvas.x)} × {formatCoordinate($canvas.y)}
3717f7fb
RBR
14</div>
15
16<style>
587d8fe6
RBR
17 .hud {
18 background-color: #fff;
19 padding: 4px;
20 position: fixed;
21 bottom: 2px;
22 right: 2px;
23 font-smooth: never;
24 -webkit-font-smoothing: none;
25 }
3717f7fb 26</style>