Skip to content

Commit 2902fe1

Browse files
committed
chore: update
1 parent feac2c8 commit 2902fe1

File tree

5 files changed

+89
-26
lines changed

5 files changed

+89
-26
lines changed

src/components/Graphics.vue

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
<script lang="ts" setup>
2-
import { s8 } from '@meta2d/core'
3-
4-
function dragStart(e: any, elem: any) {
2+
function dragStart(e: DragEvent | MouseEvent, elem: any) {
53
if (!elem)
64
return
75
86
e.stopPropagation()
97
10-
const data = { ...elem.data, id: s8() }
11-
// 拖拽事件
12-
if (e instanceof DragEvent) {
13-
// 设置拖拽数据
8+
const data = elem.data
9+
if (e instanceof DragEvent)
1410
e.dataTransfer?.setData('Meta2d', JSON.stringify(data))
15-
}
16-
else {
17-
// 支持单击添加图元。平板模式
18-
meta2d.canvas.addCaches = [data]
19-
}
2011
}
2112
</script>
2213

@@ -27,18 +18,17 @@ function dragStart(e: any, elem: any) {
2718
<div grid="~ cols-2 gap-5" w-full>
2819
<div
2920
v-for="elem in item.list" :key="elem.name"
30-
flex="~ col" hover:bg="gray/10" col-span-1 border-box px-6px py-10px
21+
flex="~ col " justify-center hover:bg="gray/10" col-span-1 border-box px-6px py-15px cursor-pointer
3122
:draggable="true"
3223
@dragstart="dragStart($event, elem)"
3324
@click.prevent="dragStart($event, elem)"
3425
>
35-
<svg v-if="!elem?.image" class="l-icon" aria-hidden="true" style="height: 28px; width: 100%;">
26+
<svg aria-hidden="true" h-28px w-full fill-primary>
3627
<use :xlink:href="`#${elem.icon}`" />
3728
</svg>
38-
<img v-else :src="elem?.image" h-28px>
39-
<p :title="elem.name" mt-2 text-center>
29+
<div :title="elem.name" mt-4 text-center>
4030
{{ elem.name }}
41-
</p>
31+
</div>
4232
</div>
4333
</div>
4434
</a-collapse-item>

src/components/toolbar/ToolbarFromArrow.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<script setup lang="ts">
22
const { currentFromArrow, fromArrows, changeFromArrow } = getFormArrowInfo()
3+
4+
const svgFillColor = computed(() => ['#232323', '#f3f3f3'][Number(isDark.value)])
35
</script>
46

57
<template>
68
<!-- 左箭头类型 -->
79
<a-dropdown trigger="hover" :popup-max-height="false">
810
<div>
9-
<svg cursor-pointer size-6 op50 hover:op75 aria-hidden="true">
11+
<svg cursor-pointer size-6 op50 hover:op75 aria-hidden="true" :fill="svgFillColor">
1012
<use
1113
:xlink:href="
1214
fromArrows.find((item) => item.value === currentFromArrow)?.icon
@@ -16,8 +18,8 @@ const { currentFromArrow, fromArrows, changeFromArrow } = getFormArrowInfo()
1618
</div>
1719
<template #content>
1820
<a-doption v-for="item in fromArrows" :key="item.value">
19-
<div flex-center @click="changeFromArrow(item.value)">
20-
<svg size-5 aria-hidden="true">
21+
<div flex justify-center items-center px-12px py-8px @click="changeFromArrow(item.value)">
22+
<svg size-5 aria-hidden="true" :fill="svgFillColor">
2123
<use :xlink:href="item.icon" />
2224
</svg>
2325
</div>

src/components/toolbar/ToolbarLineType.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<script setup lang="ts">
22
const { currentLineType, lineTypes, changeLineType } = getLineTypeInfo()
3+
4+
const svgFillColor = computed(() => ['#232323', '#f3f3f3'][Number(isDark.value)])
35
</script>
46

57
<template>
68
<a-dropdown trigger="hover">
79
<div>
8-
<svg cursor-pointer size-5 aria-hidden="true" op50 hover:op75>
10+
<svg cursor-pointer size-5 aria-hidden="true" op50 hover:op75 :fill="svgFillColor">
911
<use
1012
:xlink:href="
1113
lineTypes.find((item) => item.value === currentLineType)?.icon
@@ -19,7 +21,7 @@ const { currentLineType, lineTypes, changeLineType } = getLineTypeInfo()
1921
<span>
2022
{{ item.name }}
2123
</span>
22-
<svg size-5 aria-hidden="true">
24+
<svg size-5 aria-hidden="true" :fill="svgFillColor">
2325
<use :xlink:href="item.icon" />
2426
</svg>
2527
</div>

src/components/toolbar/ToolbarToArrow.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<script setup lang="ts">
22
const { currentToArrow, toArrows, changeToArrow } = getToArrowInfo()
3+
4+
const svgFillColor = computed(() => ['#232323', '#f3f3f3'][Number(isDark.value)])
35
</script>
46

57
<template>
68
<a-dropdown trigger="hover" :popup-max-height="false">
79
<div>
8-
<svg cursor-pointer size-6 color-red op50 hover:op75 aria-hidden="true">
10+
<svg cursor-pointer size-6 color-red op50 hover:op75 aria-hidden="true" :fill="svgFillColor">
911
<use
1012
:xlink:href="
1113
toArrows.find((item) => item.value === currentToArrow)?.icon
@@ -15,8 +17,8 @@ const { currentToArrow, toArrows, changeToArrow } = getToArrowInfo()
1517
</div>
1618
<template #content>
1719
<a-doption v-for="item in toArrows" :key="item.value">
18-
<div flex-center @click="changeToArrow(item.value)">
19-
<svg size-5 aria-hidden="true">
20+
<div flex justify-center items-center px-12px py-8px @click="changeToArrow(item.value)">
21+
<svg size-5 aria-hidden="true" :fill="svgFillColor">
2022
<use :xlink:href="item.icon" />
2123
</svg>
2224
</div>

src/main.css

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,39 @@ html.dark {
1414
color-scheme: dark;
1515
}
1616

17+
:root, :root::selection {
18+
--c-bg-base: #ffffff;
19+
--c-scrollbar: #c1c1c1;
20+
--c-scrollbar-hover: #7d7d7d;
21+
}
22+
23+
.dark {
24+
--c-bg-base: #101828;
25+
--c-scrollbar: rgba(255, 255, 255, .3);
26+
--c-scrollbar-hover: rgba(255, 255, 255, .4);
27+
}
28+
29+
::-webkit-scrollbar {
30+
width: 6px;
31+
}
32+
33+
::-webkit-scrollbar:horizontal {
34+
height: 6px;
35+
}
36+
37+
::-webkit-scrollbar-track {
38+
background: var(--c-bg-base);
39+
border-radius: 10px;
40+
}
41+
42+
::-webkit-scrollbar-thumb {
43+
background: var(--c-scrollbar);
44+
border-radius: 10px;
45+
}
46+
47+
::-webkit-scrollbar-thumb:hover {
48+
background: var(--c-scrollbar-hover);
49+
}
1750

1851
.meta2d-map {
1952
border: 1px solid #aaa3 !important;
@@ -24,7 +57,6 @@ html.dark {
2457
border: 1px solid #722ED1 !important;
2558
}
2659

27-
2860
html.dark .meta2d-map {
2961
background: #182033 !important;
3062
}
@@ -45,3 +77,38 @@ html.dark .meta2d-map {
4577
background-color: transparent !important;
4678
}
4779

80+
/* Dropdown */
81+
82+
.arco-dropdown {
83+
background-color: var(--c-bg-base);
84+
border-color: #aaa3;
85+
}
86+
87+
.arco-dropdown-option-active, .arco-dropdown-option:not(.arco-dropdown-option-disabled):hover {
88+
--at-apply bg-active;
89+
}
90+
91+
.arco-dropdown-option {
92+
--at-apply: text-base;
93+
}
94+
95+
/* Divider */
96+
97+
.arco-divider-horizontal {
98+
border-color: #aaa3;
99+
}
100+
101+
.arco-divider-vertical {
102+
border-color: #aaa3;
103+
}
104+
105+
/* Tooltip */
106+
107+
.arco-tooltip-content {
108+
--at-apply: bg-base text-base text-sm border-box shadow;
109+
box-shadow: 0 6px 30px #0000001a;
110+
}
111+
112+
.arco-trigger-arrow {
113+
--at-apply: hidden;
114+
}

0 commit comments

Comments
 (0)