|
@@ -922,10 +922,21 @@
|
|
|
<t-divider style="margin: -8px 0" />
|
|
|
<div class="form-item px-16" style="margin-top: -12px">
|
|
|
<label style="width: 60px">鼠标提示</label>
|
|
|
- <t-button shape="square" variant="outline" style="width: 24px">
|
|
|
+ <t-button
|
|
|
+ shape="square"
|
|
|
+ variant="outline"
|
|
|
+ style="width: 24px"
|
|
|
+ @click="showTitle"
|
|
|
+ >
|
|
|
<t-icon name="ellipsis" slot="icon"
|
|
|
/></t-button>
|
|
|
</div>
|
|
|
+ <MonacoModal
|
|
|
+ v-model:visible="titleVisible"
|
|
|
+ :options="titleOptions"
|
|
|
+ title="鼠标提示"
|
|
|
+ @changeOptions="changeTitleCode"
|
|
|
+ />
|
|
|
<t-space />
|
|
|
</t-space>
|
|
|
</t-tab-panel>
|
|
@@ -939,16 +950,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
-import { onBeforeMount, onUnmounted, reactive, ref } from 'vue';
|
|
|
-import { getCookie } from '@/services/cookie';
|
|
|
-import { useSelection } from '@/services/selections';
|
|
|
+import { onBeforeMount, onUnmounted, reactive, ref } from "vue";
|
|
|
+import { getCookie } from "@/services/cookie";
|
|
|
+import { useSelection } from "@/services/selections";
|
|
|
+import MonacoModal from "./common/MonacoModal.vue";
|
|
|
+import { monacoOption } from "./common/MonacoModal.vue";
|
|
|
|
|
|
import PenAnimates from './PenAnimates.vue';
|
|
|
|
|
|
const headers = {
|
|
|
- Authorization: 'Bearer ' + (localStorage.token || getCookie('token') || ''),
|
|
|
+ Authorization: "Bearer " + (localStorage.token || getCookie("token") || ""),
|
|
|
};
|
|
|
-const updataData = { directory: '/项目' };
|
|
|
+const updataData = { directory: "/项目" };
|
|
|
|
|
|
const uploadRef = ref();
|
|
|
|
|
@@ -959,23 +972,23 @@ const data = reactive<any>({
|
|
|
});
|
|
|
|
|
|
const fonts = [
|
|
|
- '新宋体',
|
|
|
- '微软雅黑',
|
|
|
- '黑体',
|
|
|
- '楷体',
|
|
|
- '-apple-system',
|
|
|
- 'BlinkMacSystemFont',
|
|
|
- 'PingFang SC',
|
|
|
- 'Hiragino Sans GB',
|
|
|
- 'Microsoft YaHei UI',
|
|
|
- 'Microsoft YaHei',
|
|
|
- 'fangsong',
|
|
|
- 'Source Han Sans CN',
|
|
|
- 'sans-serif',
|
|
|
- 'serif',
|
|
|
- 'Apple Color Emoji',
|
|
|
- 'Segoe UI Emoji',
|
|
|
- 'Segoe UI Symbol',
|
|
|
+ "新宋体",
|
|
|
+ "微软雅黑",
|
|
|
+ "黑体",
|
|
|
+ "楷体",
|
|
|
+ "-apple-system",
|
|
|
+ "BlinkMacSystemFont",
|
|
|
+ "PingFang SC",
|
|
|
+ "Hiragino Sans GB",
|
|
|
+ "Microsoft YaHei UI",
|
|
|
+ "Microsoft YaHei",
|
|
|
+ "fangsong",
|
|
|
+ "Source Han Sans CN",
|
|
|
+ "sans-serif",
|
|
|
+ "serif",
|
|
|
+ "Apple Color Emoji",
|
|
|
+ "Segoe UI Emoji",
|
|
|
+ "Segoe UI Symbol",
|
|
|
];
|
|
|
|
|
|
const { selections } = useSelection();
|
|
@@ -998,12 +1011,12 @@ onBeforeMount(() => {
|
|
|
data.pen.dash = 0;
|
|
|
}
|
|
|
if (!data.pen.props.text) {
|
|
|
- if (data.pen.text || data.pen.name === 'text') {
|
|
|
+ if (data.pen.text || data.pen.name === "text") {
|
|
|
data.pen.props.text = true;
|
|
|
}
|
|
|
}
|
|
|
if (!data.pen.props.image) {
|
|
|
- if (data.pen.image || data.pen.name === 'image') {
|
|
|
+ if (data.pen.image || data.pen.name === "image") {
|
|
|
data.pen.props.image = true;
|
|
|
}
|
|
|
}
|
|
@@ -1023,27 +1036,27 @@ onBeforeMount(() => {
|
|
|
|
|
|
// 测试代码
|
|
|
data.pen.props.custom = [
|
|
|
- { label: '数字', key: 'a', type: 'number', placeholder: '输入提示' },
|
|
|
- { label: '文本', key: 'b' },
|
|
|
- { label: '布尔', key: 'c', type: 'bool', placeholder: '输入提示' },
|
|
|
- { label: '颜色', key: 'd', type: 'color', placeholder: '输入提示' },
|
|
|
+ { label: "数字", key: "a", type: "number", placeholder: "输入提示" },
|
|
|
+ { label: "文本", key: "b" },
|
|
|
+ { label: "布尔", key: "c", type: "bool", placeholder: "输入提示" },
|
|
|
+ { label: "颜色", key: "d", type: "color", placeholder: "输入提示" },
|
|
|
{
|
|
|
- label: '下拉框',
|
|
|
- key: 'd',
|
|
|
- type: 'select',
|
|
|
+ label: "下拉框",
|
|
|
+ key: "d",
|
|
|
+ type: "select",
|
|
|
options: [
|
|
|
- { label: '选项1', value: '1' },
|
|
|
- { label: '选项2', value: '2' },
|
|
|
+ { label: "选项1", value: "1" },
|
|
|
+ { label: "选项2", value: "2" },
|
|
|
],
|
|
|
- placeholder: '输入提示',
|
|
|
+ placeholder: "输入提示",
|
|
|
},
|
|
|
];
|
|
|
// end
|
|
|
data.pen.shadow = !!data.pen.shadowColor;
|
|
|
getRect();
|
|
|
- meta2d.on('translatePens', getRect);
|
|
|
- meta2d.on('resizePens', getRect);
|
|
|
- meta2d.on('rotatePens', getRect);
|
|
|
+ meta2d.on("translatePens", getRect);
|
|
|
+ meta2d.on("resizePens", getRect);
|
|
|
+ meta2d.on("rotatePens", getRect);
|
|
|
});
|
|
|
|
|
|
const getRect = () => {
|
|
@@ -1064,25 +1077,25 @@ const decimalRound = (val: number) => {
|
|
|
const changeValue = (prop: string) => {
|
|
|
const v: any = { id: data.pen.id };
|
|
|
v[prop] = data.pen[prop];
|
|
|
- if (prop === 'x') {
|
|
|
+ if (prop === "x") {
|
|
|
v.x = data.rect.x;
|
|
|
- } else if (prop === 'y') {
|
|
|
+ } else if (prop === "y") {
|
|
|
v.y = data.rect.y;
|
|
|
- } else if (prop === 'width') {
|
|
|
+ } else if (prop === "width") {
|
|
|
v.height = (data.rect.width / data.pen.width) * data.pen.height;
|
|
|
- } else if (prop === 'height') {
|
|
|
+ } else if (prop === "height") {
|
|
|
v.width = (data.rect.height / data.pen.height) * data.pen.width;
|
|
|
- } else if (prop === 'shadow') {
|
|
|
+ } else if (prop === "shadow") {
|
|
|
if (v[prop]) {
|
|
|
!v.shadowOffsetX && (v.shadowOffsetX = 0);
|
|
|
!v.shadowOffsetY && (v.shadowOffsetY = 0);
|
|
|
!v.shadowBlur && (v.shadowBlur = 0);
|
|
|
} else {
|
|
|
- v.shadowColor = '';
|
|
|
+ v.shadowColor = "";
|
|
|
}
|
|
|
- } else if (prop === 'lineGradientColors') {
|
|
|
+ } else if (prop === "lineGradientColors") {
|
|
|
//@ts-ignore
|
|
|
- if (meta2d.store.active[0].name === 'line') {
|
|
|
+ if (meta2d.store.active[0].name === "line") {
|
|
|
//@ts-ignore
|
|
|
meta2d.store.active[0].calculative.gradientColorStop = null;
|
|
|
} else {
|
|
@@ -1090,6 +1103,8 @@ const changeValue = (prop: string) => {
|
|
|
meta2d.store.active[0].calculative.lineGradient = null;
|
|
|
}
|
|
|
//不同模式切换不同的系统配色
|
|
|
+ } else if (prop === "titleFnJs") {
|
|
|
+ v.titleFn = null;
|
|
|
}
|
|
|
meta2d.setValue(v);
|
|
|
};
|
|
@@ -1101,7 +1116,7 @@ const onFontPopupVisible = (val: boolean) => {
|
|
|
const onFontFamily = (fontFamily: string) => {
|
|
|
data.pen.fontFamily = fontFamily;
|
|
|
data.fontFamilyPopupVisible = false;
|
|
|
- changeValue('fontFamily');
|
|
|
+ changeValue("fontFamily");
|
|
|
};
|
|
|
|
|
|
const fileSuccessed = async (content: any) => {
|
|
@@ -1112,7 +1127,7 @@ const fileSuccessed = async (content: any) => {
|
|
|
};
|
|
|
|
|
|
const fileRemoved = () => {
|
|
|
- meta2d.setBackgroundImage('');
|
|
|
+ meta2d.setBackgroundImage("");
|
|
|
meta2d.store.patchFlagsBackground = true;
|
|
|
meta2d.render();
|
|
|
data.background = [];
|
|
@@ -1128,30 +1143,65 @@ const onSelectTag = (tag: string) => {
|
|
|
return;
|
|
|
}
|
|
|
data.pen.tags.push(tag);
|
|
|
- changeValue('tags');
|
|
|
+ changeValue("tags");
|
|
|
};
|
|
|
|
|
|
const onChangeInputTag = (currentTags: any, context: any) => {
|
|
|
const { trigger, index, item } = context;
|
|
|
- if (['tag-remove', 'backspace'].includes(trigger)) {
|
|
|
+ if (["tag-remove", "backspace"].includes(trigger)) {
|
|
|
data.pen.tags.splice(index, 1);
|
|
|
}
|
|
|
- if (trigger === 'enter') {
|
|
|
+ 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.inputTag = "";
|
|
|
}
|
|
|
data.tagPopupVisible = false;
|
|
|
};
|
|
|
|
|
|
+const titleVisible = ref(false);
|
|
|
+const titleOptions: monacoOption[] = [
|
|
|
+ {
|
|
|
+ key: "title",
|
|
|
+ value: 0,
|
|
|
+ name: "文本",
|
|
|
+ tip: "支持markdown",
|
|
|
+ code: "",
|
|
|
+ language: "markdown",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ key: "titleFnJs",
|
|
|
+ value: 1,
|
|
|
+ name: "高级",
|
|
|
+ tip: "mark函数",
|
|
|
+ code: "",
|
|
|
+ language: "javascript",
|
|
|
+ example:'//例如: return `${pen.name}<br/>${pen.text}`;'
|
|
|
+ },
|
|
|
+];
|
|
|
+
|
|
|
+const showTitle = () => {
|
|
|
+ titleOptions.forEach((item) => {
|
|
|
+ item.code = data.pen[item.key] || "";
|
|
|
+ });
|
|
|
+ titleVisible.value = true;
|
|
|
+};
|
|
|
+
|
|
|
+const changeTitleCode = (options: monacoOption[]) => {
|
|
|
+ options.forEach((item) => {
|
|
|
+ data.pen[item.key] = item.code || "";
|
|
|
+ changeValue(item.key);
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
onUnmounted(() => {
|
|
|
- meta2d.off('translatePens', getRect);
|
|
|
- meta2d.off('resizePens', getRect);
|
|
|
- meta2d.off('rotatePens', getRect);
|
|
|
+ meta2d.off("translatePens", getRect);
|
|
|
+ meta2d.off("resizePens", getRect);
|
|
|
+ meta2d.off("rotatePens", getRect);
|
|
|
});
|
|
|
</script>
|
|
|
<style lang="postcss" scoped>
|