From 6e72972a342b4b723479dceefda04d257b77f4df Mon Sep 17 00:00:00 2001
From: wuyulong17 <2284273586@qq.com>
Date: Wed, 2 Jul 2025 17:14:57 +0800
Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=8F=8F=E8=BF=B0=E3=80=91=E8=A1=A5?=
=?UTF-8?q?=E5=85=85=E5=AD=90=E5=9B=BE=E8=A1=A8=E6=A0=BC=E6=9A=97=E8=89=B2?=
=?UTF-8?q?=E4=B8=BB=E9=A2=98=E5=92=8C=E4=BF=AE=E5=A4=8D=E6=94=BE=E7=BC=A9?=
=?UTF-8?q?=E4=B9=8B=E5=90=8E=E5=AD=90=E5=9B=BE=E6=B6=88=E5=A4=B1=E7=9A=84?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Control/SubgraphControl.tsx | 2 +-
.../app/src/ModelStructure/Subgraph/index.tsx | 42 +++++++++++--------
.../ModelVis/app/src/ModelStructure/index.tsx | 13 ++++--
.../ModelVis/app/src/src-worker/render.ts | 2 +-
.../ModelVis/app/src/src-worker/worker.ts | 1 +
.../ModelVis/app/src/types/ipc.d.ts | 1 +
.../ModelVis/app/src/worker-apis.ts | 3 +-
7 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Control/SubgraphControl.tsx b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Control/SubgraphControl.tsx
index 347308844..b8e3d1b02 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Control/SubgraphControl.tsx
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Control/SubgraphControl.tsx
@@ -33,7 +33,7 @@ const SubgraphControl = () => {
return
}
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Subgraph/index.tsx b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Subgraph/index.tsx
index 4b40d1cc4..fd9231351 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Subgraph/index.tsx
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/Subgraph/index.tsx
@@ -21,12 +21,12 @@ import {
loadingAtom,
modelPathAtom,
subgraphPanelVisibleAtom,
- subgraphsVisibleAtom
+ subgraphsVisibleAtom, themeAtom
} from '../../stores'
import { useAtom, useSetAtom } from 'jotai/index'
import { invoke } from '@tauri-apps/api/core'
import type { ColumnsType } from 'antd/es/table'
-import { Table } from 'antd'
+import { ConfigProvider, Table, theme } from 'antd'
import { useState } from 'react'
import { workerInitSubgraphs, workerToggleSubgraphs } from '../../worker-apis'
@@ -106,6 +106,8 @@ const Subgraph = () => {
const [selectedRow, setSelectedRow] = useState()
const columns = getColumns(t)
+ const globalTheme = useAtomValue(themeAtom)
+
const querySubgraph = async (repeat: number, min: number, max: number) => {
setLoading(true)
const res = await invoke(
@@ -119,7 +121,7 @@ const Subgraph = () => {
const toggleSubgraph = (): void => {
setSubgraphVis(!subgraphVis)
- workerToggleSubgraphs(!visible)
+ workerToggleSubgraphs(!subgraphVis)
if (!subgraphVis) {
workerInitSubgraphs(selectedRow?.nodes ?? [])
}
@@ -145,21 +147,27 @@ const Subgraph = () => {
style={{display: visible ? 'block' : 'none'}}
>
- record.key === selectedRow?.key ? 'bg-blue-300' : ''}
- pagination={{
- className: '!my-2',
- pageSizeOptions: ['10', '20', '50', '100'],
- total: subgraphData.length,
- showTotal: (total: number): string => t('subgraph.paginationTotal', {total: total}),
- showSizeChanger: true,
- showQuickJumper: true
+
+ >
+ record.key === selectedRow?.key ? 'bg-blue-300' : ''}
+ pagination={{
+ className: '!my-2',
+ pageSizeOptions: ['10', '20', '50', '100'],
+ total: subgraphData.length,
+ showTotal: (total: number): string => t('subgraph.paginationTotal', {total: total}),
+ showSizeChanger: true,
+ showQuickJumper: true
+ }}
+ />
+
}
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/index.tsx b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/index.tsx
index de726bb62..19a8439df 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/index.tsx
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/ModelStructure/index.tsx
@@ -24,12 +24,12 @@ import {
useRef,
useState
} from "react"
-import { nodesEdgesAtom, themeAtom, translateAtom, useZoom } from "stores"
+import { nodesEdgesAtom, subgraphsVisibleAtom, themeAtom, translateAtom, useZoom } from "stores"
import {
workerHitTest,
workerInit,
workerLayoutRs,
- workerNewProj,
+ workerNewProj, workerResize,
workerToggleTheme,
workerTransform
} from "worker-apis"
@@ -46,6 +46,7 @@ const ModelStructureComp = ({ width, height }: WindowSize) => {
const [translate, setTranslate] = useAtom(translateAtom)
const [zoom, zoomIn, zoomOut] = useZoom()
const theme = useAtomValue(themeAtom)
+ const subgraphVis = useAtomValue(subgraphsVisibleAtom)
const ref = useRef(null!)
const hlRef = useRef(null!)
@@ -122,7 +123,13 @@ const ModelStructureComp = ({ width, height }: WindowSize) => {
} catch (_e) {
workerNewProj(data)
}
- }, [width, data])
+ }, [data])
+
+ useEffect(() => {
+ if (!width || !height || !data) return
+
+ workerResize({ width, height, subgraphVis })
+ }, [width, height])
useEffect(() => workerTransform(translate, zoom), [translate, zoom])
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/render.ts b/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/render.ts
index 8e83e66f9..339b34949 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/render.ts
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/render.ts
@@ -67,7 +67,7 @@ const render = () => {
const ex = (Width - TranslateX) / Zoom
const ey = (Height - TranslateY) / Zoom
- if (DisplaySubgraph) renderMaxSubgraphs()
+ if (DisplaySubgraph && MaxSubgraphs !== null) renderMaxSubgraphs()
renderNodes(Nodes, sx, sy, ex, ey)
// When the zoom is too small, the edge is hard to see, so it is hidden
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/worker.ts b/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/worker.ts
index 00bc3c01e..12f2e4c4f 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/worker.ts
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/src-worker/worker.ts
@@ -140,6 +140,7 @@ const handleResize = (payload: ResizePayload) => {
HighlightCanvas.width = payload.width * DPR
HighlightCanvas.height = payload.height * DPR
HighlightCtx = HighlightCanvas.getContext("2d")
+ DisplaySubgraph = payload.subgraphVis
rerender()
}
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/types/ipc.d.ts b/plugins/mindstudio-insight-plugins/ModelVis/app/src/types/ipc.d.ts
index 6f81a56c6..44e3a9733 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/types/ipc.d.ts
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/types/ipc.d.ts
@@ -17,6 +17,7 @@ type ResizePayload = {
type: "resize"
width: number
height: number
+ subgraphVis: boolean
}
type TransformPayload = {
diff --git a/plugins/mindstudio-insight-plugins/ModelVis/app/src/worker-apis.ts b/plugins/mindstudio-insight-plugins/ModelVis/app/src/worker-apis.ts
index 33d14a777..53055c4f8 100644
--- a/plugins/mindstudio-insight-plugins/ModelVis/app/src/worker-apis.ts
+++ b/plugins/mindstudio-insight-plugins/ModelVis/app/src/worker-apis.ts
@@ -48,7 +48,8 @@ export const workerResize = (payload: MainThreadResizePayload) => {
{
type: "resize",
width: payload.width,
- height: payload.height
+ height: payload.height,
+ subgraphVis: payload.subgraphVis
}
)
}
--
Gitee