绘图工具调整

This commit is contained in:
joylink_fanyuhong 2024-09-25 10:37:26 +08:00
parent 4adcfacc12
commit dede7f400f
2 changed files with 32 additions and 14 deletions

View File

@ -84,7 +84,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { QBar, useDialogPluginComponent } from 'quasar'; import { QBar, useDialogPluginComponent } from 'quasar';
import { ref, onMounted, onUnmounted, reactive } from 'vue'; import { ref, onMounted, onUnmounted, reactive, watch } from 'vue';
import ResizableDivWidth from './ResizableDivWidth.vue'; import ResizableDivWidth from './ResizableDivWidth.vue';
import ResizableDivHeight from './ResizableDivHeight.vue'; import ResizableDivHeight from './ResizableDivHeight.vue';
@ -121,6 +121,14 @@ const props = withDefaults(
} }
); );
watch(
() => props.height,
() => {
dialogHeight.value = props.height;
lastDialogHeight = props.height;
}
);
const { dialogRef, onDialogHide /* , onDialogCancel, onDialogOK */ } = const { dialogRef, onDialogHide /* , onDialogCancel, onDialogOK */ } =
useDialogPluginComponent(); useDialogPluginComponent();

View File

@ -103,12 +103,12 @@
<draggable-dialog <draggable-dialog
seamless seamless
title="绘制工具" title="绘制工具"
:width="230" :width="130"
:height="50" :height="drawDialogHeight"
v-model="showDrawTool" v-model="showDrawTool"
canNotClose canNotClose
> >
<q-btn-toggle <!-- <q-btn-toggle
v-model="selectUtil" v-model="selectUtil"
color="brown" color="brown"
text-color="white" text-color="white"
@ -116,15 +116,22 @@
toggle-text-color="black" toggle-text-color="black"
:options="utilsOption" :options="utilsOption"
@update:model-value="drawSelect" @update:model-value="drawSelect"
> -->
<div class="row wrap">
<template v-for="(ctl, idx) in utilsOption" :key="idx">
<q-btn
square
style="margin: 4px"
color="brown"
@click="drawSelect(ctl.value)"
:icon="ctl.icon"
> >
<template </q-btn>
v-for="(ctl, idx) in utilsOption"
:key="idx"
v-slot:[ctl.value]
>
<q-tooltip>{{ ctl.tip }}</q-tooltip>
</template> </template>
</q-btn-toggle> </div>
<!-- <q-tooltip>{{ ctl.tip }}</q-tooltip> -->
<!-- </q-btn-toggle> -->
</draggable-dialog> </draggable-dialog>
<q-resize-observer @resize="onResize" /> <q-resize-observer @resize="onResize" />
</q-layout> </q-layout>
@ -153,6 +160,7 @@ const router = useRouter();
const searchId = ref(0); const searchId = ref(0);
const drawStore = useDrawStore(); const drawStore = useDrawStore();
const showDrawTool = ref(true); const showDrawTool = ref(true);
const drawDialogHeight = ref(44);
watch( watch(
() => drawStore.drawMode, () => drawStore.drawMode,
@ -192,9 +200,10 @@ function toggleRightDrawer() {
// //
const selectUtil = ref(); const selectUtil = ref();
const utilsOption: ControlItem[] = reactive([]); const utilsOption: ControlItem[] = reactive([]);
const drawSelect = (item: string) => {
function drawSelect(item: string) {
drawStore.getDrawApp().interactionPlugin(item).resume(); drawStore.getDrawApp().interactionPlugin(item).resume();
}; }
class ControlItem { class ControlItem {
value: string; value: string;
slot: string; slot: string;
@ -250,6 +259,7 @@ onMounted(() => {
); );
} }
}); });
drawDialogHeight.value = 44 * Math.ceil(utilsOption.length / 2);
}); });
const canvasWidth = ref(0); const canvasWidth = ref(0);