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