<script>
- export let x;
- export let y;
+ import { coordinateLength } from '$lib/config';
+ import { canvas } from '$lib/stores/canvas';
- const kCoordinateLength = 6;
const kSeparatorRegex = /([0-9a-z]{2})/g;
const formatCoordinate = function formatCoordinate(coordinate) {
return coordinate
.toString(16)
- .padStart(kCoordinateLength, 0)
+ .padStart(coordinateLength, 0)
.replace(kSeparatorRegex, '$1 ');
}
</script>
<div class="hud">
- { formatCoordinate(x) } × { formatCoordinate(y) }
+ { formatCoordinate($canvas.x) } × { formatCoordinate($canvas.y) }
</div>
<style>