@@ -7,15 +7,18 @@ const props = defineProps<{
|
||||
hMargin: number;
|
||||
imageWidth: number;
|
||||
imageHeight: number;
|
||||
imageBackgroundColor: string;
|
||||
}>();
|
||||
|
||||
const ctx = ref<null | CanvasRenderingContext2D>(null);
|
||||
|
||||
const clearCanvas = () => {
|
||||
const { imageWidth, imageHeight } = props;
|
||||
const { imageWidth, imageHeight, imageBackgroundColor } = props;
|
||||
|
||||
if (ctx.value) {
|
||||
ctx.value.clearRect(0, 0, imageWidth * ONE_MM, imageHeight * ONE_MM);
|
||||
ctx.value.shadowColor
|
||||
ctx.value.fillStyle = imageBackgroundColor;
|
||||
ctx.value.fillRect(0, 0, imageWidth * ONE_MM, imageHeight * ONE_MM);
|
||||
ctx.value.beginPath();
|
||||
}
|
||||
};
|
||||
@@ -58,11 +61,7 @@ onUpdated(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<canvas
|
||||
id="canvas"
|
||||
:width="imageWidth * ONE_MM"
|
||||
:height="imageHeight * ONE_MM"
|
||||
/>
|
||||
<canvas id="canvas" :width="imageWidth * ONE_MM" :height="imageHeight * ONE_MM" />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user