File size: 1,309 Bytes
89ce340 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
<template>
<div class="shape-item-thumbnail">
<div class="shape-content">
<svg
overflow="visible"
width="18"
height="18"
>
<g
:transform="`scale(${18 / shape.viewBox[0]}, ${18 / shape.viewBox[1]}) translate(0,0) matrix(1,0,0,1,0,0)`"
>
<path
class="shape-path"
:class="{ 'outlined': shape.outlined }"
vector-effect="non-scaling-stroke"
stroke-linecap="butt"
stroke-miterlimit="8"
:fill="shape.outlined ? '#999' : 'transparent'"
:stroke="shape.outlined ? 'transparent' : '#999'"
stroke-width="2"
:d="shape.path"
></path>
</g>
</svg>
</div>
</div>
</template>
<script lang="ts" setup>
import type { ShapePoolItem } from '@/configs/shapes'
defineProps<{
shape: ShapePoolItem
}>()
</script>
<style lang="scss" scoped>
.shape-item-thumbnail {
position: relative;
cursor: pointer;
}
.shape-content {
@include absolute-0();
display: flex;
justify-content: center;
align-items: center;
&:hover .shape-path {
&:not(.outlined) {
stroke: $themeColor;
}
&.outlined {
fill: $themeColor;
}
}
svg:not(:root) {
overflow: visible;
}
}
</style> |