refactor: move border to screen itself, and use withDefaults

This commit is contained in:
2025-11-09 17:44:29 +01:00
parent 6507c194d5
commit 81a11782f7
3 changed files with 16 additions and 24 deletions

View File

@@ -1,16 +1,6 @@
<template>
<div class="wrapper">
<Screen>
<Background />
<Stats />
</Screen>
</div>
</template>
<style>
.wrapper {
width: fit-content;
height: fit-content;
border: 1px solid red;
}
</style>

View File

@@ -64,7 +64,15 @@ onUnmounted(() => {
</script>
<template>
<canvas ref="canvas" :width="SCREEN_WIDTH" :height="SCREEN_HEIGHT" />
<canvas
ref="canvas"
:width="SCREEN_WIDTH"
:height="SCREEN_HEIGHT"
:style="{
margin: '0',
border: '1px solid red',
}"
/>
<slot v-if="canvas" />
</template>

View File

@@ -1,13 +1,7 @@
<script lang="ts" setup>
const props = defineProps({
x: {
type: Number,
default: 0,
},
y: {
type: Number,
default: 0,
},
const props = withDefaults(defineProps<{ x?: number; y?: number }>(), {
x: 0,
y: 0,
});
const SAMPLES = 60;