Skip to content

Commit a6f94f2

Browse files
committed
feat: can close the current file
1 parent 331f956 commit a6f94f2

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

src/components/SvgTo3D.vue

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ function getClipboardData(event: ClipboardEvent): DataTransfer | null {
199199
return (event.clipboardData || (window as any).clipboardData)
200200
}
201201
202+
function handleClose() {
203+
fileName.value = ''
204+
svgShapes.value = []
205+
svgCode.value = ''
206+
selectedShapeIndex.value = null
207+
editingInputIndex.value = null
208+
isExporting.value = false
209+
size.value = defaultSize
210+
loadDefaultSvg()
211+
}
212+
202213
const isLoaded = computed(() => svgShapes.value.length && !isDefaultSvg.value)
203214
</script>
204215

@@ -228,10 +239,18 @@ const isLoaded = computed(() => svgShapes.value.length && !isDefaultSvg.value)
228239
/>
229240
<div flex="~ col gap-6" p4 rounded-4 bg-white:50 max-w-340px w-full left-10 top-10 fixed z-999 of-y-auto backdrop-blur-md dark:bg-black:50 max-h="[calc(100vh-160px)]">
230241
<div flex="~ col gap-2">
231-
<div flex="~ gap-3 items-center" text-xl font-500>
232-
<img src="/logo-dark.svg" size-7.5 class="hidden dark:block">
233-
<img src="/logo-light.svg" size-7.5 class="block dark:hidden">
234-
<h1>Bekuto 3D</h1>
242+
<div flex="~ gap-3 items-center justify-between" text-xl font-500>
243+
<div flex="~ gap-3 items-center">
244+
<img src="/logo-dark.svg" size-7.5 class="hidden dark:block">
245+
<img src="/logo-light.svg" size-7.5 class="block dark:hidden">
246+
<h1>Bekuto 3D</h1>
247+
</div>
248+
<button
249+
v-if="isLoaded"
250+
class="i-iconoir-cancel text-xl cursor-pointer transition-opacity hover:op-80"
251+
title="Close current file"
252+
@click="handleClose"
253+
/>
235254
</div>
236255
<p op-80>
237256
Convert SVG files to 3D models

0 commit comments

Comments
 (0)