Move common board node CSS to class

This commit is contained in:
thepaperpilot 2024-03-09 20:52:02 -06:00
parent e0da9588d2
commit 99227a2cb2
2 changed files with 10 additions and 11 deletions

View file

@ -26,7 +26,7 @@ import type { PanZoom } from "panzoom";
import type { ComponentPublicInstance } from "vue"; import type { ComponentPublicInstance } from "vue";
import { computed, ref } from "vue"; import { computed, ref } from "vue";
// Required to make sure panzoom component gets registered: // Required to make sure panzoom component gets registered:
import "features/boards/board"; import "./board";
defineExpose({ defineExpose({
panZoomInstance: computed(() => stage.value?.panZoomInstance) panZoomInstance: computed(() => stage.value?.panZoomInstance)
@ -90,5 +90,12 @@ function onInit(panzoomInstance: PanZoom) {
height: calc(100% + 100px); height: calc(100% + 100px);
margin: -50px -10px; margin: -50px -10px;
} }
.board-node {
position: absolute;
top: 0;
left: 50%;
transition-duration: 0s;
}
</style> </style>
game/boards/board game/boards/board

View file

@ -1,5 +1,6 @@
<template> <template>
<div <div
class="board-node"
:style="`transform: translate(calc(${unref(position).x}px - 50%), ${unref(position).y}px);`" :style="`transform: translate(calc(${unref(position).x}px - 50%), ${unref(position).y}px);`"
@mousedown="e => mouseDown(e)" @mousedown="e => mouseDown(e)"
@touchstart.passive="e => mouseDown(e)" @touchstart.passive="e => mouseDown(e)"
@ -26,12 +27,3 @@ const props = defineProps<{
const comp = shallowRef(coerceComponent(jsx(() => renderJSX(props.element)))); const comp = shallowRef(coerceComponent(jsx(() => renderJSX(props.element))));
</script> </script>
<style scoped>
div {
position: absolute;
top: 0;
left: 50%;
transition-duration: 0s;
}
</style>