Skip to content

Commit

Permalink
feat: replace NSwitch with NCheckbox for WebGL flag in ImageDetailSec…
Browse files Browse the repository at this point in the history
…tion

- Updated the useWebglFlag to utilize useStorage for persistent state.
- Changed the UI component from NSwitch to NCheckbox for better user interaction.
- Adjusted layout and styling for the checkbox in the image detail section.

Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jan 8, 2025
1 parent e5f23e5 commit 47fab29
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/components/drawer/components/image-detail-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { uniqBy } from 'es-toolkit/compat'
import {
NButton,
NButtonGroup,
NCheckbox,
NCollapse,
NCollapseItem,
NColorPicker,
Expand Down Expand Up @@ -44,7 +45,7 @@ export const ImageDetailSection = defineComponent({
setup(props) {
const loading = ref(false)

const useWebglFlag = ref(false)
const useWebglFlag = useStorage('useWebglFlag', false)

const originImageMap = computed(() => {
const map = new Map<string, ImageModel>()
Expand Down Expand Up @@ -185,15 +186,15 @@ export const ImageDetailSection = defineComponent({
自动修正
</NButton>
</div>
<div class="mt-2 flex">
<NSwitch
value={useWebglFlag.value}
onUpdateValue={(e) => void (useWebglFlag.value = e)}
<div class="mt-2 flex items-center gap-1 pl-1 text-sm">
<NCheckbox
size="small"
checked={useWebglFlag.value}
onUpdateChecked={(e) => void (useWebglFlag.value = e)}
/>
<div class="ml-2">
{' '}
<label for="useWebglFlag" class="ml-2">
使用 Webgl 加速图片处理(实验性,调用 GPU 计算)
</div>
</label>
</div>
<NCollapse accordion class="mt-4">
{images.value.map((image: ImageModel, index: number) => {
Expand Down

0 comments on commit 47fab29

Please sign in to comment.