|
@@ -3,7 +3,7 @@
|
|
<t-tabs v-model="data.tab">
|
|
<t-tabs v-model="data.tab">
|
|
<t-tab-panel :value="1" label="外观">
|
|
<t-tab-panel :value="1" label="外观">
|
|
<t-space direction="vertical" class="py-16 w-full">
|
|
<t-space direction="vertical" class="py-16 w-full">
|
|
- <div class="px-16 flex between">
|
|
|
|
|
|
+ <div class="px-16 flex between" style="margin-bottom:2px;">
|
|
<label>选中了{{ selections.pens.length }}个图元</label>
|
|
<label>选中了{{ selections.pens.length }}个图元</label>
|
|
<div class="icons">
|
|
<div class="icons">
|
|
<t-tooltip
|
|
<t-tooltip
|
|
@@ -67,13 +67,42 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-item px-16" style="margin-top: -12px">
|
|
<div class="form-item px-16" style="margin-top: -12px">
|
|
- <label style="width: 50px">模板</label>
|
|
|
|
- <t-switch
|
|
|
|
- class="mt-8 ml-8"
|
|
|
|
- size="small"
|
|
|
|
- v-model="data.template"
|
|
|
|
- @change="changeValue('template')"
|
|
|
|
- />
|
|
|
|
|
|
+ <label style="width: 50px">分组</label>
|
|
|
|
+ <t-select-input
|
|
|
|
+ v-model:inputValue="data.inputTag"
|
|
|
|
+ :value="data.tags"
|
|
|
|
+ allow-input
|
|
|
|
+ placeholder="请输入或选择分组"
|
|
|
|
+ multiple
|
|
|
|
+ @tag-change="onChangeInputTag"
|
|
|
|
+ @focus="data.tagPopupVisible = true"
|
|
|
|
+ @blur="data.tagPopupVisible = false"
|
|
|
|
+ :tag-input-props="{ excessTagsDisplayType: 'break-line' }"
|
|
|
|
+ >
|
|
|
|
+ <template #panel>
|
|
|
|
+ <ul style="padding: 8px 12px">
|
|
|
|
+ <li
|
|
|
|
+ v-for="item in data.groups"
|
|
|
|
+ :key="item"
|
|
|
|
+ @click="onSelectTag(item)"
|
|
|
|
+ >
|
|
|
|
+ {{ item }}
|
|
|
|
+ </li>
|
|
|
|
+ </ul>
|
|
|
|
+ </template>
|
|
|
|
+ </t-select-input>
|
|
|
|
+ </div>
|
|
|
|
+ <div class="form-item px-16" style="margin-top: -12px">
|
|
|
|
+ <label style="width: 50px">画布层</label>
|
|
|
|
+ <t-select
|
|
|
|
+ v-model="data.canvasLayer"
|
|
|
|
+ @change="changeValue('canvasLayer')"
|
|
|
|
+ >
|
|
|
|
+ <t-option :key="4" :disabled="!allImg" :value="4" label="上层图片层"> 上层图片层 </t-option>
|
|
|
|
+ <t-option :key="3" :disabled="hasDom" :value="3" label="主画布层"> 主画布层 </t-option>
|
|
|
|
+ <t-option :key="2" :disabled="!allImg" :value="2" label="下层图片层"> 下层图片层 </t-option>
|
|
|
|
+ <t-option :key="1" :disabled="hasDom" :value="1" label="模板层"> 模板层 </t-option>
|
|
|
|
+ </t-select>
|
|
</div>
|
|
</div>
|
|
<t-collapse
|
|
<t-collapse
|
|
:defaultValue="['1', '2', '3', '4']"
|
|
:defaultValue="['1', '2', '3', '4']"
|
|
@@ -812,9 +841,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
<script lang="ts" setup>
|
|
-import { onBeforeMount, onUnmounted, reactive, ref } from 'vue';
|
|
|
|
|
|
+import { onBeforeMount, onUnmounted, reactive, ref, computed } from 'vue';
|
|
|
|
|
|
-import { LockState, Pen } from '@meta2d/core';
|
|
|
|
|
|
+import { LockState, Pen, isDomShapes } from '@meta2d/core';
|
|
|
|
|
|
import { updatePen } from './pen';
|
|
import { updatePen } from './pen';
|
|
|
|
|
|
@@ -912,7 +941,17 @@ const aligns2 = [
|
|
},
|
|
},
|
|
];
|
|
];
|
|
|
|
|
|
-onBeforeMount(() => {});
|
|
|
|
|
|
+onBeforeMount(() => {
|
|
|
|
+ const d = meta2d.store.data as any;
|
|
|
|
+ if (!d.groups) {
|
|
|
|
+ d.groups = [];
|
|
|
|
+ }
|
|
|
|
+ data.groups = d.groups;
|
|
|
|
+
|
|
|
|
+ if (!data.tags) {
|
|
|
|
+ data.tags = [];
|
|
|
|
+ }
|
|
|
|
+});
|
|
|
|
|
|
const lock = (v: LockState) => {
|
|
const lock = (v: LockState) => {
|
|
data.locked = v;
|
|
data.locked = v;
|
|
@@ -970,6 +1009,47 @@ const onFontPopupVisible = (val: boolean) => {
|
|
const decimalRound = (val: number) => {
|
|
const decimalRound = (val: number) => {
|
|
return Math.round(+val || 0);
|
|
return Math.round(+val || 0);
|
|
};
|
|
};
|
|
|
|
+
|
|
|
|
+const onSelectTag = (tag: string) => {
|
|
|
|
+ data.tagPopupVisible = false;
|
|
|
|
+ if (data.tags.includes(tag)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ data.tags.push(tag);
|
|
|
|
+ changeValue('tags');
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const onChangeInputTag = (currentTags: any, context: any) => {
|
|
|
|
+ const { trigger, index, item } = context;
|
|
|
|
+ if (['tag-remove', 'backspace'].includes(trigger)) {
|
|
|
|
+ data.tags.splice(index, 1);
|
|
|
|
+ }
|
|
|
|
+ if (trigger === 'enter') {
|
|
|
|
+ onSelectTag(item);
|
|
|
|
+ const d = meta2d.store.data as any;
|
|
|
|
+ if (!d.groups.includes(item)) {
|
|
|
|
+ d.groups.push(item);
|
|
|
|
+ data.groups = d.groups;
|
|
|
|
+ }
|
|
|
|
+ data.inputTag = '';
|
|
|
|
+ }
|
|
|
|
+ data.tagPopupVisible = false;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+const hasDom = computed(() => {
|
|
|
|
+ return selections.pens.some((item: Pen) => {
|
|
|
|
+ return isDomShapes.includes(item.name) ||
|
|
|
|
+ item.name.endsWith('Dom') ||
|
|
|
|
+ meta2d.store.options.domShapes.includes(item.name);
|
|
|
|
+ });
|
|
|
|
+});
|
|
|
|
+
|
|
|
|
+const allImg = computed(() => {
|
|
|
|
+ return selections.pens.every((item: Pen) => {
|
|
|
|
+ return item.name === 'image';
|
|
|
|
+ });
|
|
|
|
+});
|
|
|
|
+
|
|
</script>
|
|
</script>
|
|
<style lang="postcss" scoped>
|
|
<style lang="postcss" scoped>
|
|
.props {
|
|
.props {
|