File size: 1,345 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 63 |
<template>
<div class="shape-pool">
<div class="category" v-for="item in SHAPE_LIST" :key="item.type">
<div class="category-name">{{item.type}}</div>
<div class="shape-list">
<ShapeItemThumbnail
class="shape-item"
v-for="(shape, index) in item.children"
:key="index"
:shape="shape"
@click="selectShape(shape)"
/>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { SHAPE_LIST, type ShapePoolItem } from '@/configs/shapes'
import ShapeItemThumbnail from './ShapeItemThumbnail.vue'
const emit = defineEmits<{
(event: 'select', payload: ShapePoolItem): void
}>()
const selectShape = (shape: ShapePoolItem) => {
emit('select', shape)
}
</script>
<style lang="scss" scoped>
.shape-pool {
width: 340px;
max-height: 520px;
overflow: auto;
margin-top: -8px;
margin-bottom: -8px;
margin-right: -10px;
padding-right: 10px;
padding-top: 10px;
}
.category-name {
width: 100%;
font-size: 12px;
margin-bottom: 10px;
border-left: 4px solid #bbb;
background-color: #f1f1f1;
padding: 3px 0 3px 8px;
color: #555;
}
.shape-list {
@include flex-grid-layout();
margin-bottom: 10px;
}
.shape-item {
@include flex-grid-layout-children(10, 8%);
height: 0;
padding-bottom: 8%;
flex-shrink: 0;
}
</style> |