hippofish/packages/client/src/components/page/page.canvas.vue
ThatOneCalculator 5d06aa5f13
chore: 🚨 lint
2023-09-01 16:27:33 -07:00

49 lines
910 B
Vue

<template>
<div class="ysrxegms">
<canvas ref="canvas" :width="block.width" :height="block.height" />
</div>
</template>
<script lang="ts">
import type { PropType, Ref } from "vue";
import { defineComponent, onMounted, ref } from "vue";
import type { CanvasBlock } from "@/scripts/hpml/block";
import type { Hpml } from "@/scripts/hpml/evaluator";
export default defineComponent({
props: {
block: {
type: Object as PropType<CanvasBlock>,
required: true,
},
hpml: {
type: Object as PropType<Hpml>,
required: true,
},
},
setup(props, ctx) {
const canvas: Ref<any> = ref(null);
onMounted(() => {
props.hpml.registerCanvas(props.block.name, canvas.value);
});
return {
canvas,
};
},
});
</script>
<style lang="scss" scoped>
.ysrxegms {
display: inline-block;
vertical-align: bottom;
overflow: auto;
max-width: 100%;
> canvas {
display: block;
}
}
</style>