feat: 流程预览dot画布+夜间背景色

This commit is contained in:
dap 2025-05-26 17:26:13 +08:00
parent 2217c96cd9
commit d9c57dfb61

View File

@ -1,7 +1,9 @@
<script setup lang="ts">
import type { ZoomParamType } from '@logicflow/core';
import { onMounted, shallowRef, useTemplateRef } from 'vue';
import { onMounted, shallowRef, useTemplateRef, watch } from 'vue';
import { usePreferences } from '@vben/preferences';
import {
MinusCircleOutlined,
@ -41,9 +43,19 @@ onMounted(async () => {
const data = json2LogicFlowJson(props.data);
lf.value = new LogicFlow({
container: container.value,
grid: false,
isSilentMode: true,
textEdit: false,
grid: {
size: 20,
type: 'dot',
config: {
color: '#ccc',
thickness: 1,
},
},
background: {
backgroundColor: '#fff',
},
});
lf.value.register(Start);
@ -57,6 +69,16 @@ onMounted(async () => {
lf.value.translateCenter();
}
});
const { isDark } = usePreferences();
watch(isDark, (v) => {
if (!lf.value) {
return;
}
lf.value.graphModel.background = {
background: v ? '#333' : '#fff',
};
});
</script>
<template>