From d6135e6eff80cf9f2ebad23a38f69061f121ec52 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sat, 1 Feb 2025 23:45:43 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E5=AE=9E?= =?UTF-8?q?=E4=BD=93=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E5=AD=97=E4=BD=93=E5=A4=A7=E5=B0=8F=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=92=8C=E8=A1=8C=E6=95=B0=E9=99=90=E5=88=B6=E8=87=AA=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entityRenderer/EntityRenderer.tsx | 4 ++-- src/core/render/canvas2d/renderer.tsx | 12 +++++++++++- src/core/service/Settings.tsx | 4 ++++ src/locales/en.yml | 8 ++++++++ src/locales/zh_CN.yml | 8 ++++++++ src/locales/zh_TW.yml | 8 ++++++++ src/pages/settings/visual.tsx | 19 +++++++++++++++++++ 7 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx b/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx index 703ef1c2..53fe6338 100644 --- a/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx +++ b/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx @@ -179,10 +179,10 @@ export namespace EntityRenderer { export function renderEntityDetails(entity: Entity) { if (entity.details && !entity.isEditingDetails) { if (Renderer.isAlwaysShowDetails) { - _renderEntityDetails(entity, 4); + _renderEntityDetails(entity, Renderer.ENTITY_DETAILS_LIENS_LIMIT); } else { if (entity.isMouseHover) { - _renderEntityDetails(entity, 4); + _renderEntityDetails(entity, Renderer.ENTITY_DETAILS_LIENS_LIMIT); } } } diff --git a/src/core/render/canvas2d/renderer.tsx b/src/core/render/canvas2d/renderer.tsx index f685a244..07576a04 100644 --- a/src/core/render/canvas2d/renderer.tsx +++ b/src/core/render/canvas2d/renderer.tsx @@ -42,7 +42,11 @@ export namespace Renderer { /** * 节点详细信息的文字大小 */ - export const FONT_SIZE_DETAILS = 18; + export let FONT_SIZE_DETAILS = 18; + /** + * 节点详细信息的文字行数限制 + */ + export let ENTITY_DETAILS_LIENS_LIMIT = 4; export const NODE_PADDING = 14; /// 节点的圆角半径 export const NODE_ROUNDED_RADIUS = 8; @@ -104,6 +108,12 @@ export namespace Renderer { // 确保这个函数在软件打开的那一次调用 export function init() { + Settings.watch("entityDetailsFontSize", (value) => { + FONT_SIZE_DETAILS = value; + }); + Settings.watch("entityDetailsLinesLimit", (value) => { + ENTITY_DETAILS_LIENS_LIMIT = value; + }); Settings.watch("showDebug", (value) => (isShowDebug = value)); Settings.watch("showBackgroundHorizontalLines", (value) => { isShowBackgroundHorizontalLines = value; diff --git a/src/core/service/Settings.tsx b/src/core/service/Settings.tsx index 7f78f766..3e26ac09 100644 --- a/src/core/service/Settings.tsx +++ b/src/core/service/Settings.tsx @@ -28,6 +28,8 @@ export namespace Settings { alwaysShowDetails: boolean; protectingPrivacy: boolean; useNativeTitleBar: boolean; + entityDetailsFontSize: number; + entityDetailsLinesLimit: number; limitCameraInCycleSpace: boolean; cameraCycleSpaceSizeX: number; cameraCycleSpaceSizeY: number; @@ -87,6 +89,8 @@ export namespace Settings { alwaysShowDetails: false, protectingPrivacy: false, useNativeTitleBar: false, + entityDetailsFontSize: 18, + entityDetailsLinesLimit: 4, limitCameraInCycleSpace: false, cameraCycleSpaceSizeX: 1000, cameraCycleSpaceSizeY: 1000, diff --git a/src/locales/en.yml b/src/locales/en.yml index 63050561..9d245e5a 100644 --- a/src/locales/en.yml +++ b/src/locales/en.yml @@ -165,6 +165,14 @@ settings: When taking screenshots for feedback, enabling this option will replace all Chinese characters with "好" to protect privacy. This is only a visual replacement and will not affect the actual data. You can turn it off and restore it after providing feedback. + entityDetailsFontSize: + title: Font Size for Entity Details + description: | + Unit is pixels + entityDetailsLinesLimit: + title: Line Limit for Entity Details + description: | + Limit the maximum number of lines for entity details. Exceeding this limit will result in the omission of the excess content. limitCameraInCycleSpace: title: Enable Camera Movement Limitation in Cycle Space description: | diff --git a/src/locales/zh_CN.yml b/src/locales/zh_CN.yml index be58bc0d..e7c7d53a 100644 --- a/src/locales/zh_CN.yml +++ b/src/locales/zh_CN.yml @@ -150,6 +150,14 @@ settings: 用于反馈问题截图时,开启此项之后将汉字全部替换成《㊙》,以保护隐私。 仅作显示层面的替换,不会影响真实数据 反馈完毕后可再关闭,复原 + entityDetailsFontSize: + title: 实体详细信息字体大小 + description: | + 单位为像素 + entityDetailsLinesLimit: + title: 实体详细信息行数限制 + description: | + 限制实体详细信息的最大行数,超过限制的部分将被省略 limitCameraInCycleSpace: title: 开启循环空间限制摄像机移动 description: | diff --git a/src/locales/zh_TW.yml b/src/locales/zh_TW.yml index 393809b1..b9a8f6b9 100644 --- a/src/locales/zh_TW.yml +++ b/src/locales/zh_TW.yml @@ -137,6 +137,14 @@ settings: 用於回饋問題截圖時,開啟此項之後將漢字全部替換成《好》,以保護隱私。 僅作顯示層面的替換,不會影響真實數據 回饋完畢後可再關閉,復原 + entityDetailsFontSize: + title: 实体详细信息字体大小 + description: | + 单位为像素 + entityDetailsLinesLimit: + title: 实体详细信息行数限制 + description: | + 限制实体详细信息的最大行数,超过限制的部分将被省略 limitCameraInCycleSpace: title: 开启循环空间限制摄像机移动 description: | diff --git a/src/pages/settings/visual.tsx b/src/pages/settings/visual.tsx index 4f34cb76..d375eed1 100644 --- a/src/pages/settings/visual.tsx +++ b/src/pages/settings/visual.tsx @@ -1,7 +1,9 @@ import { AppWindowMac, + ArrowDownNarrowWide, Blend, Bug, + CaseSensitive, Columns4, Crosshair, Grip, @@ -35,6 +37,23 @@ export default function Visual() { } settingKey="alwaysShowDetails" type="switch" /> } settingKey="useNativeTitleBar" type="switch" /> + } + settingKey="entityDetailsFontSize" + type="slider" + min={18} + max={36} + step={1} + /> + } + settingKey="entityDetailsLinesLimit" + type="slider" + min={1} + max={200} + step={2} + /> + } settingKey="limitCameraInCycleSpace" type="switch" /> } From d385e4259bd7819f25c1bb2ef78ccd219eb3a1da Mon Sep 17 00:00:00 2001 From: zty012 Date: Sun, 2 Feb 2025 15:25:25 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20update=20vitest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- pnpm-lock.yaml | 183 ++++++++---------- src/__tests__/README.md | 1 - {src/__tests__/unit => tests}/deco.test.tsx | 0 .../unit => tests}/lruCache.test.tsx | 4 +- {src/__tests__/unit => tests}/mod.test.tsx | 4 +- .../unit => tests}/monoStack.test.tsx | 4 +- .../parseMarkdownToJSON.test.tsx | 4 +- .../unit => tests}/validUrl.test.tsx | 4 +- {src/__tests__/unit => tests}/vector.test.tsx | 4 +- {src/__tests__/unit => tests}/vitest.test.tsx | 0 tsconfig.json | 17 +- vite.config.ts | 7 + vitest.config.ts | 17 -- 14 files changed, 115 insertions(+), 136 deletions(-) delete mode 100644 src/__tests__/README.md rename {src/__tests__/unit => tests}/deco.test.tsx (100%) rename {src/__tests__/unit => tests}/lruCache.test.tsx (95%) rename {src/__tests__/unit => tests}/mod.test.tsx (75%) rename {src/__tests__/unit => tests}/monoStack.test.tsx (96%) rename {src/__tests__/unit => tests}/parseMarkdownToJSON.test.tsx (97%) rename {src/__tests__/unit => tests}/validUrl.test.tsx (98%) rename {src/__tests__/unit => tests}/vector.test.tsx (72%) rename {src/__tests__/unit => tests}/vitest.test.tsx (100%) delete mode 100644 vitest.config.ts diff --git a/package.json b/package.json index dcddfc34..5a84a658 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "vite": "^6.0.6", "vite-plugin-svgr": "^4.3.0", "vitepress": "^1.5.0", - "vitest": "^2.1.8", + "vitest": "3.0.4", "vue": "^3.5.13" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3a5abf4b..ccfa2bec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -177,8 +177,8 @@ importers: specifier: ^1.5.0 version: 1.5.0(@algolia/client-search@5.18.0)(@types/react@19.0.2)(less@4.2.1)(lightningcss@1.29.1)(postcss@8.4.49)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)(sass-embedded@1.83.0)(search-insights@2.17.3)(typescript@5.7.2) vitest: - specifier: ^2.1.8 - version: 2.1.8(jsdom@25.0.1)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) + specifier: 3.0.4 + version: 3.0.4(jiti@2.4.2)(jsdom@25.0.1)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1) vue: specifier: ^3.5.13 version: 3.5.13(typescript@5.7.2) @@ -1012,70 +1012,60 @@ packages: { integrity: sha512-Py5vFd5HWYN9zxBv3WMrLAXY3yYJ6Q/aVERoeUFwiDGiMOWsMs7FokXihSOaT/PMWUty/Pj60XDQndK3eAfE6A== } cpu: [arm] os: [linux] - libc: [glibc] "@rollup/rollup-linux-arm-musleabihf@4.29.1": resolution: { integrity: sha512-RiWpGgbayf7LUcuSNIbahr0ys2YnEERD4gYdISA06wa0i8RALrnzflh9Wxii7zQJEB2/Eh74dX4y/sHKLWp5uQ== } cpu: [arm] os: [linux] - libc: [musl] "@rollup/rollup-linux-arm64-gnu@4.29.1": resolution: { integrity: sha512-Z80O+taYxTQITWMjm/YqNoe9d10OX6kDh8X5/rFCMuPqsKsSyDilvfg+vd3iXIqtfmp+cnfL1UrYirkaF8SBZA== } cpu: [arm64] os: [linux] - libc: [glibc] "@rollup/rollup-linux-arm64-musl@4.29.1": resolution: { integrity: sha512-fOHRtF9gahwJk3QVp01a/GqS4hBEZCV1oKglVVq13kcK3NeVlS4BwIFzOHDbmKzt3i0OuHG4zfRP0YoG5OF/rA== } cpu: [arm64] os: [linux] - libc: [musl] "@rollup/rollup-linux-loongarch64-gnu@4.29.1": resolution: { integrity: sha512-5a7q3tnlbcg0OodyxcAdrrCxFi0DgXJSoOuidFUzHZ2GixZXQs6Tc3CHmlvqKAmOs5eRde+JJxeIf9DonkmYkw== } cpu: [loong64] os: [linux] - libc: [glibc] "@rollup/rollup-linux-powerpc64le-gnu@4.29.1": resolution: { integrity: sha512-9b4Mg5Yfz6mRnlSPIdROcfw1BU22FQxmfjlp/CShWwO3LilKQuMISMTtAu/bxmmrE6A902W2cZJuzx8+gJ8e9w== } cpu: [ppc64] os: [linux] - libc: [glibc] "@rollup/rollup-linux-riscv64-gnu@4.29.1": resolution: { integrity: sha512-G5pn0NChlbRM8OJWpJFMX4/i8OEU538uiSv0P6roZcbpe/WfhEO+AT8SHVKfp8qhDQzaz7Q+1/ixMy7hBRidnQ== } cpu: [riscv64] os: [linux] - libc: [glibc] "@rollup/rollup-linux-s390x-gnu@4.29.1": resolution: { integrity: sha512-WM9lIkNdkhVwiArmLxFXpWndFGuOka4oJOZh8EP3Vb8q5lzdSCBuhjavJsw68Q9AKDGeOOIHYzYm4ZFvmWez5g== } cpu: [s390x] os: [linux] - libc: [glibc] "@rollup/rollup-linux-x64-gnu@4.29.1": resolution: { integrity: sha512-87xYCwb0cPGZFoGiErT1eDcssByaLX4fc0z2nRM6eMtV9njAfEE6OW3UniAoDhX4Iq5xQVpE6qO9aJbCFumKYQ== } cpu: [x64] os: [linux] - libc: [glibc] "@rollup/rollup-linux-x64-musl@4.29.1": resolution: { integrity: sha512-xufkSNppNOdVRCEC4WKvlR1FBDyqCSCpQeMMgv9ZyXqqtKBfkw1yfGMTUTs9Qsl6WQbJnsGboWCp7pJGkeMhKA== } cpu: [x64] os: [linux] - libc: [musl] "@rollup/rollup-win32-arm64-msvc@4.29.1": resolution: @@ -1226,7 +1216,6 @@ packages: engines: { node: ">=10" } cpu: [arm64] os: [linux] - libc: [glibc] "@swc/core-linux-arm64-musl@1.10.1": resolution: @@ -1234,7 +1223,6 @@ packages: engines: { node: ">=10" } cpu: [arm64] os: [linux] - libc: [musl] "@swc/core-linux-x64-gnu@1.10.1": resolution: @@ -1242,7 +1230,6 @@ packages: engines: { node: ">=10" } cpu: [x64] os: [linux] - libc: [glibc] "@swc/core-linux-x64-musl@1.10.1": resolution: @@ -1250,7 +1237,6 @@ packages: engines: { node: ">=10" } cpu: [x64] os: [linux] - libc: [musl] "@swc/core-win32-arm64-msvc@1.10.1": resolution: @@ -1336,7 +1322,6 @@ packages: engines: { node: ">= 10" } cpu: [arm64] os: [linux] - libc: [glibc] "@tailwindcss/oxide-linux-arm64-musl@4.0.0": resolution: @@ -1344,7 +1329,6 @@ packages: engines: { node: ">= 10" } cpu: [arm64] os: [linux] - libc: [musl] "@tailwindcss/oxide-linux-x64-gnu@4.0.0": resolution: @@ -1352,7 +1336,6 @@ packages: engines: { node: ">= 10" } cpu: [x64] os: [linux] - libc: [glibc] "@tailwindcss/oxide-linux-x64-musl@4.0.0": resolution: @@ -1360,7 +1343,6 @@ packages: engines: { node: ">= 10" } cpu: [x64] os: [linux] - libc: [musl] "@tailwindcss/oxide-win32-arm64-msvc@4.0.0": resolution: @@ -1418,7 +1400,6 @@ packages: engines: { node: ">= 10" } cpu: [arm64] os: [linux] - libc: [glibc] "@tauri-apps/cli-linux-arm64-musl@2.1.0": resolution: @@ -1426,7 +1407,6 @@ packages: engines: { node: ">= 10" } cpu: [arm64] os: [linux] - libc: [musl] "@tauri-apps/cli-linux-x64-gnu@2.1.0": resolution: @@ -1434,7 +1414,6 @@ packages: engines: { node: ">= 10" } cpu: [x64] os: [linux] - libc: [glibc] "@tauri-apps/cli-linux-x64-musl@2.1.0": resolution: @@ -1442,7 +1421,6 @@ packages: engines: { node: ">= 10" } cpu: [x64] os: [linux] - libc: [musl] "@tauri-apps/cli-win32-arm64-msvc@2.1.0": resolution: @@ -1638,41 +1616,41 @@ packages: vite: ^5.0.0 || ^6.0.0 vue: ^3.2.25 - "@vitest/expect@2.1.8": + "@vitest/expect@3.0.4": resolution: - { integrity: sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw== } + { integrity: sha512-Nm5kJmYw6P2BxhJPkO3eKKhGYKRsnqJqf+r0yOGRKpEP+bSCBDsjXgiu1/5QFrnPMEgzfC38ZEjvCFgaNBC0Eg== } - "@vitest/mocker@2.1.8": + "@vitest/mocker@3.0.4": resolution: - { integrity: sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA== } + { integrity: sha512-gEef35vKafJlfQbnyOXZ0Gcr9IBUsMTyTLXsEQwuyYAerpHqvXhzdBnDFuHLpFqth3F7b6BaFr4qV/Cs1ULx5A== } peerDependencies: msw: ^2.4.9 - vite: ^5.0.0 + vite: ^5.0.0 || ^6.0.0 peerDependenciesMeta: msw: optional: true vite: optional: true - "@vitest/pretty-format@2.1.8": + "@vitest/pretty-format@3.0.4": resolution: - { integrity: sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ== } + { integrity: sha512-ts0fba+dEhK2aC9PFuZ9LTpULHpY/nd6jhAQ5IMU7Gaj7crPCTdCFfgvXxruRBLFS+MLraicCuFXxISEq8C93g== } - "@vitest/runner@2.1.8": + "@vitest/runner@3.0.4": resolution: - { integrity: sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg== } + { integrity: sha512-dKHzTQ7n9sExAcWH/0sh1elVgwc7OJ2lMOBrAm73J7AH6Pf9T12Zh3lNE1TETZaqrWFXtLlx3NVrLRb5hCK+iw== } - "@vitest/snapshot@2.1.8": + "@vitest/snapshot@3.0.4": resolution: - { integrity: sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg== } + { integrity: sha512-+p5knMLwIk7lTQkM3NonZ9zBewzVp9EVkVpvNta0/PlFWpiqLaRcF4+33L1it3uRUCh0BGLOaXPPGEjNKfWb4w== } - "@vitest/spy@2.1.8": + "@vitest/spy@3.0.4": resolution: - { integrity: sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg== } + { integrity: sha512-sXIMF0oauYyUy2hN49VFTYodzEAu744MmGcPR3ZBsPM20G+1/cSW/n1U+3Yu/zHxX2bIDe1oJASOkml+osTU6Q== } - "@vitest/utils@2.1.8": + "@vitest/utils@3.0.4": resolution: - { integrity: sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA== } + { integrity: sha512-8BqC1ksYsHtbWH+DfpOAKrFw3jl3Uf9J7yeFh85Pz52IWuh1hBBtyfEbRNNZNjl8H8A5yMLH9/t+k7HIKzQcZQ== } "@vue/compiler-core@3.5.13": resolution: @@ -2229,9 +2207,9 @@ packages: { integrity: sha512-uDn+FE1yrDzyC0pCo961B2IHbdM8y/ACZsKD4dG6WqrjV53BADjwa7D+1aom2rsNVfLyDgU/eigvlJGJ08OQ4w== } engines: { node: ">= 0.4" } - es-module-lexer@1.5.4: + es-module-lexer@1.6.0: resolution: - { integrity: sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw== } + { integrity: sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ== } es-object-atoms@1.0.0: resolution: @@ -2970,7 +2948,6 @@ packages: engines: { node: ">= 12.0.0" } cpu: [arm64] os: [linux] - libc: [glibc] lightningcss-linux-arm64-musl@1.29.1: resolution: @@ -2978,7 +2955,6 @@ packages: engines: { node: ">= 12.0.0" } cpu: [arm64] os: [linux] - libc: [musl] lightningcss-linux-x64-gnu@1.29.1: resolution: @@ -2986,7 +2962,6 @@ packages: engines: { node: ">= 12.0.0" } cpu: [x64] os: [linux] - libc: [glibc] lightningcss-linux-x64-musl@1.29.1: resolution: @@ -2994,7 +2969,6 @@ packages: engines: { node: ">= 12.0.0" } cpu: [x64] os: [linux] - libc: [musl] lightningcss-win32-arm64-msvc@1.29.1: resolution: @@ -3332,9 +3306,9 @@ packages: { integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== } engines: { node: ">=8" } - pathe@1.1.2: + pathe@2.0.2: resolution: - { integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ== } + { integrity: sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w== } pathval@2.0.0: resolution: @@ -4024,18 +3998,18 @@ packages: resolution: { integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg== } - tinyexec@0.3.1: + tinyexec@0.3.2: resolution: - { integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ== } + { integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA== } tinypool@1.0.2: resolution: { integrity: sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA== } engines: { node: ^18.0.0 || >=20.0.0 } - tinyrainbow@1.2.0: + tinyrainbow@2.0.0: resolution: - { integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ== } + { integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw== } engines: { node: ">=14.0.0" } tinyspy@3.0.2: @@ -4195,10 +4169,10 @@ packages: resolution: { integrity: sha512-KzIbH/9tXat2u30jf+smMwFCsno4wHVdNmzFyL+T/L3UGqqk6JKfVqOFOZEpZSHADH1k40ab6NUIXZq422ov3Q== } - vite-node@2.1.8: + vite-node@3.0.4: resolution: - { integrity: sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg== } - engines: { node: ^18.0.0 || >=20.0.0 } + { integrity: sha512-7JZKEzcYV2Nx3u6rlvN8qdo3QV7Fxyt6hx+CCKz9fbWxdX5IvUOmTWEAxMrWxaiSf7CKGLJQ5rFu8prb/jBjOA== } + engines: { node: ^18.0.0 || ^20.0.0 || >=22.0.0 } hasBin: true vite-plugin-svgr@4.3.0: @@ -4293,21 +4267,24 @@ packages: postcss: optional: true - vitest@2.1.8: + vitest@3.0.4: resolution: - { integrity: sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ== } - engines: { node: ^18.0.0 || >=20.0.0 } + { integrity: sha512-6XG8oTKy2gnJIFTHP6LD7ExFeNLxiTkK3CfMvT7IfR8IN+BYICCf0lXUQmX7i7JoxUP8QmeP4mTnWXgflu4yjw== } + engines: { node: ^18.0.0 || ^20.0.0 || >=22.0.0 } hasBin: true peerDependencies: "@edge-runtime/vm": "*" - "@types/node": ^18.0.0 || >=20.0.0 - "@vitest/browser": 2.1.8 - "@vitest/ui": 2.1.8 + "@types/debug": ^4.1.12 + "@types/node": ^18.0.0 || ^20.0.0 || >=22.0.0 + "@vitest/browser": 3.0.4 + "@vitest/ui": 3.0.4 happy-dom: "*" jsdom: "*" peerDependenciesMeta: "@edge-runtime/vm": optional: true + "@types/debug": + optional: true "@types/node": optional: true "@vitest/browser": @@ -5661,45 +5638,45 @@ snapshots: vite: 5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) vue: 3.5.13(typescript@5.7.2) - "@vitest/expect@2.1.8": + "@vitest/expect@3.0.4": dependencies: - "@vitest/spy": 2.1.8 - "@vitest/utils": 2.1.8 + "@vitest/spy": 3.0.4 + "@vitest/utils": 3.0.4 chai: 5.1.2 - tinyrainbow: 1.2.0 + tinyrainbow: 2.0.0 - "@vitest/mocker@2.1.8(vite@5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0))": + "@vitest/mocker@3.0.4(vite@6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1))": dependencies: - "@vitest/spy": 2.1.8 + "@vitest/spy": 3.0.4 estree-walker: 3.0.3 magic-string: 0.30.17 optionalDependencies: - vite: 5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) + vite: 6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1) - "@vitest/pretty-format@2.1.8": + "@vitest/pretty-format@3.0.4": dependencies: - tinyrainbow: 1.2.0 + tinyrainbow: 2.0.0 - "@vitest/runner@2.1.8": + "@vitest/runner@3.0.4": dependencies: - "@vitest/utils": 2.1.8 - pathe: 1.1.2 + "@vitest/utils": 3.0.4 + pathe: 2.0.2 - "@vitest/snapshot@2.1.8": + "@vitest/snapshot@3.0.4": dependencies: - "@vitest/pretty-format": 2.1.8 + "@vitest/pretty-format": 3.0.4 magic-string: 0.30.17 - pathe: 1.1.2 + pathe: 2.0.2 - "@vitest/spy@2.1.8": + "@vitest/spy@3.0.4": dependencies: tinyspy: 3.0.2 - "@vitest/utils@2.1.8": + "@vitest/utils@3.0.4": dependencies: - "@vitest/pretty-format": 2.1.8 + "@vitest/pretty-format": 3.0.4 loupe: 3.1.2 - tinyrainbow: 1.2.0 + tinyrainbow: 2.0.0 "@vue/compiler-core@3.5.13": dependencies: @@ -6228,7 +6205,7 @@ snapshots: iterator.prototype: 1.1.4 safe-array-concat: 1.1.3 - es-module-lexer@1.5.4: {} + es-module-lexer@1.6.0: {} es-object-atoms@1.0.0: dependencies: @@ -7206,7 +7183,7 @@ snapshots: path-type@4.0.0: {} - pathe@1.1.2: {} + pathe@2.0.2: {} pathval@2.0.0: {} @@ -7715,11 +7692,11 @@ snapshots: tinybench@2.9.0: {} - tinyexec@0.3.1: {} + tinyexec@0.3.2: {} tinypool@1.0.2: {} - tinyrainbow@1.2.0: {} + tinyrainbow@2.0.0: {} tinyspy@3.0.2: {} @@ -7864,15 +7841,16 @@ snapshots: "@types/unist": 3.0.3 vfile-message: 4.0.2 - vite-node@2.1.8(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0): + vite-node@3.0.4(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1): dependencies: cac: 6.7.14 debug: 4.4.0 - es-module-lexer: 1.5.4 - pathe: 1.1.2 - vite: 5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) + es-module-lexer: 1.6.0 + pathe: 2.0.2 + vite: 6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1) transitivePeerDependencies: - "@types/node" + - jiti - less - lightningcss - sass @@ -7881,6 +7859,8 @@ snapshots: - sugarss - supports-color - terser + - tsx + - yaml vite-plugin-svgr@4.3.0(rollup@4.29.1)(typescript@5.7.2)(vite@6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1)): dependencies: @@ -7967,31 +7947,32 @@ snapshots: - typescript - universal-cookie - vitest@2.1.8(jsdom@25.0.1)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0): + vitest@3.0.4(jiti@2.4.2)(jsdom@25.0.1)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1): dependencies: - "@vitest/expect": 2.1.8 - "@vitest/mocker": 2.1.8(vite@5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)) - "@vitest/pretty-format": 2.1.8 - "@vitest/runner": 2.1.8 - "@vitest/snapshot": 2.1.8 - "@vitest/spy": 2.1.8 - "@vitest/utils": 2.1.8 + "@vitest/expect": 3.0.4 + "@vitest/mocker": 3.0.4(vite@6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1)) + "@vitest/pretty-format": 3.0.4 + "@vitest/runner": 3.0.4 + "@vitest/snapshot": 3.0.4 + "@vitest/spy": 3.0.4 + "@vitest/utils": 3.0.4 chai: 5.1.2 debug: 4.4.0 expect-type: 1.1.0 magic-string: 0.30.17 - pathe: 1.1.2 + pathe: 2.0.2 std-env: 3.8.0 tinybench: 2.9.0 - tinyexec: 0.3.1 + tinyexec: 0.3.2 tinypool: 1.0.2 - tinyrainbow: 1.2.0 - vite: 5.4.11(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) - vite-node: 2.1.8(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0) + tinyrainbow: 2.0.0 + vite: 6.0.6(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1) + vite-node: 3.0.4(jiti@2.4.2)(less@4.2.1)(lightningcss@1.29.1)(sass-embedded@1.83.0)(yaml@2.6.1) why-is-node-running: 2.3.0 optionalDependencies: jsdom: 25.0.1 transitivePeerDependencies: + - jiti - less - lightningcss - msw @@ -8001,6 +7982,8 @@ snapshots: - sugarss - supports-color - terser + - tsx + - yaml void-elements@3.1.0: {} diff --git a/src/__tests__/README.md b/src/__tests__/README.md deleted file mode 100644 index 6e88dac7..00000000 --- a/src/__tests__/README.md +++ /dev/null @@ -1 +0,0 @@ -这里是放测试的地方 diff --git a/src/__tests__/unit/deco.test.tsx b/tests/deco.test.tsx similarity index 100% rename from src/__tests__/unit/deco.test.tsx rename to tests/deco.test.tsx diff --git a/src/__tests__/unit/lruCache.test.tsx b/tests/lruCache.test.tsx similarity index 95% rename from src/__tests__/unit/lruCache.test.tsx rename to tests/lruCache.test.tsx index 8de77368..38540068 100644 --- a/src/__tests__/unit/lruCache.test.tsx +++ b/tests/lruCache.test.tsx @@ -1,6 +1,6 @@ // LruCache.test.ts -import { describe, it, expect } from "vitest"; -import { LruCache } from "../../core/dataStruct/Cache"; +import { describe, expect, it } from "vitest"; +import { LruCache } from "../src/core/dataStruct/Cache"; describe("LruCache", () => { it("对于不存在的键应返回 undefined", () => { diff --git a/src/__tests__/unit/mod.test.tsx b/tests/mod.test.tsx similarity index 75% rename from src/__tests__/unit/mod.test.tsx rename to tests/mod.test.tsx index 6ef8d1e0..00cebb83 100644 --- a/src/__tests__/unit/mod.test.tsx +++ b/tests/mod.test.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect } from "vitest"; -import { NumberFunctions } from "../../core/algorithm/numberFunctions"; +import { describe, expect, it } from "vitest"; +import { NumberFunctions } from "../src/core/algorithm/numberFunctions"; describe("mod.test.tsx", () => { it("should pass", () => { diff --git a/src/__tests__/unit/monoStack.test.tsx b/tests/monoStack.test.tsx similarity index 96% rename from src/__tests__/unit/monoStack.test.tsx rename to tests/monoStack.test.tsx index 6f38b24e..9500d361 100644 --- a/src/__tests__/unit/monoStack.test.tsx +++ b/tests/monoStack.test.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect } from "vitest"; -import { MonoStack } from "../../core/dataStruct/MonoStack"; +import { describe, expect, it } from "vitest"; +import { MonoStack } from "../src/core/dataStruct/MonoStack"; describe("monoStack", () => { /** * a diff --git a/src/__tests__/unit/parseMarkdownToJSON.test.tsx b/tests/parseMarkdownToJSON.test.tsx similarity index 97% rename from src/__tests__/unit/parseMarkdownToJSON.test.tsx rename to tests/parseMarkdownToJSON.test.tsx index 838c3f17..5419af18 100644 --- a/src/__tests__/unit/parseMarkdownToJSON.test.tsx +++ b/tests/parseMarkdownToJSON.test.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect } from "vitest"; -import { parseMarkdownToJSON } from "../../utils/markdownParse"; +import { describe, expect, it } from "vitest"; +import { parseMarkdownToJSON } from "../src/utils/markdownParse"; describe("测试测试框架是否正常运行", () => { it("测试用例1", () => { diff --git a/src/__tests__/unit/validUrl.test.tsx b/tests/validUrl.test.tsx similarity index 98% rename from src/__tests__/unit/validUrl.test.tsx rename to tests/validUrl.test.tsx index d25ed3fb..fb7ad684 100644 --- a/src/__tests__/unit/validUrl.test.tsx +++ b/tests/validUrl.test.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect } from "vitest"; -import { PathString } from "../../utils/pathString"; +import { describe, expect, it } from "vitest"; +import { PathString } from "../src/utils/pathString"; describe("PathString", () => { it("URL有效性检测", () => { diff --git a/src/__tests__/unit/vector.test.tsx b/tests/vector.test.tsx similarity index 72% rename from src/__tests__/unit/vector.test.tsx rename to tests/vector.test.tsx index e2ae8934..ccd3cacb 100644 --- a/src/__tests__/unit/vector.test.tsx +++ b/tests/vector.test.tsx @@ -1,5 +1,5 @@ -import { describe, it, expect } from "vitest"; -import { Vector } from "../../core/dataStruct/Vector"; +import { describe, expect, it } from "vitest"; +import { Vector } from "../src/core/dataStruct/Vector"; describe("Vector", () => { it("1+1=2", () => { diff --git a/src/__tests__/unit/vitest.test.tsx b/tests/vitest.test.tsx similarity index 100% rename from src/__tests__/unit/vitest.test.tsx rename to tests/vitest.test.tsx diff --git a/tsconfig.json b/tsconfig.json index 2e0c745f..3245d4e1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -23,9 +23,16 @@ // 其他 "experimentalDecorators": true // 开启装饰器 }, - "include": ["src"], - "references": [ - { "path": "./tsconfig.node.json" }, - { "path": "./tsconfig.docs.json" } - ] + "include": [ + "src", + "tests/deco.test.tsx", + "tests/lruCache.test.tsx", + "tests/mod.test.tsx", + "tests/monoStack.test.tsx", + "tests/parseMarkdownToJSON.test.tsx", + "tests/validUrl.test.tsx", + "tests/vector.test.tsx", + "tests/vitest.test.tsx" + ], + "references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.docs.json" }] } diff --git a/vite.config.ts b/vite.config.ts index b630bc34..10c6ab50 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,5 @@ +/// + import generouted from "@generouted/react-router/plugin"; import ViteYaml from "@modyfi/vite-plugin-yaml"; import tailwindcss from "@tailwindcss/vite"; @@ -59,4 +61,9 @@ export default defineConfig(async () => ({ // 只有名字以LR_开头的环境变量才会被注入到前端 // import.meta.env.LR_xxx envPrefix: "LR_", + + test: { + environment: "jsdom", + include: ["./tests/**/*.test.tsx"], + }, })); diff --git a/vitest.config.ts b/vitest.config.ts deleted file mode 100644 index 95189d86..00000000 --- a/vitest.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from "vitest/config"; - -export default defineConfig({ - test: { - // 配置测试环境 - environment: "jsdom", // 用jsdom模拟浏览器环境 - // 全局设置 - globals: true, - include: ["src/__tests__/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"], - // 设置覆盖率报告 - // coverage: { - // provider: 'c8', - // reporter: ['text', 'json', 'html'] - // }, - // 其他配置选项 - }, -}); From 0f076d5894688ac2e5468d713748eded54fbe3f0 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sun, 2 Feb 2025 16:41:16 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=93=9D=20=E4=BF=AE=E6=94=B9toolbar?= =?UTF-8?q?=E8=BF=9E=E7=BA=BF=E9=A2=9C=E8=89=B2=E6=9B=B4=E6=94=B9=E7=9A=84?= =?UTF-8?q?=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/_toolbar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/_toolbar.tsx b/src/pages/_toolbar.tsx index 5d95bc0a..7e7d3091 100644 --- a/src/pages/_toolbar.tsx +++ b/src/pages/_toolbar.tsx @@ -351,7 +351,7 @@ export default function Toolbar({ className = "" }: { className?: string }) { {(isHaveSelectedNode || isHaveSelectedEdge) && ( } handleFunction={() => Popup.show()} /> From b8250674990ed58b0ce775a271ee57d763cccd8e Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sun, 2 Feb 2025 17:15:12 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=90=9B=20=E4=B8=B4=E6=97=B6=E6=80=A7?= =?UTF-8?q?=E8=A7=A3=E5=86=B3toolbar=E8=BF=87=E9=AB=98=E9=81=AE=E6=8C=A1?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E6=8C=89=E9=92=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/_toolbar.tsx | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/pages/_toolbar.tsx b/src/pages/_toolbar.tsx index 7e7d3091..16cc5dca 100644 --- a/src/pages/_toolbar.tsx +++ b/src/pages/_toolbar.tsx @@ -274,7 +274,8 @@ function AlignNodePanel() { * @returns */ export default function Toolbar({ className = "" }: { className?: string }) { - const [isCopyClearShow, setIsCopyClearShow] = useState(false); + // 是否显示清空粘贴板 + const [isClipboardClearShow, setIsCopyClearShow] = useState(false); const [isHaveSelectedNode, setSsHaveSelectedNode] = useState(false); const [isHaveSelectedNodeOverTwo, setSsHaveSelectedNodeOverTwo] = useState(false); const [isHaveSelectedEdge, setSsHaveSelectedEdge] = useState(false); @@ -314,13 +315,13 @@ export default function Toolbar({ className = "" }: { className?: string }) { // 因为报错窗口可能会被它遮挡住导致无法在右上角关闭报错窗口 return (
@@ -364,7 +365,7 @@ export default function Toolbar({ className = "" }: { className?: string }) { handleFunction={() => Popup.show()} /> )} - {isCopyClearShow && ( + {isClipboardClearShow && ( } @@ -469,6 +470,28 @@ export default function Toolbar({ className = "" }: { className?: string }) { StageManager.autoLayoutFastTreeMode(); }} /> + {/* 测试占位符 */} + {/* } + handleFunction={() => { + StageManager.autoLayoutFastTreeMode(); + }} + /> + } + handleFunction={() => { + StageManager.autoLayoutFastTreeMode(); + }} + /> + } + handleFunction={() => { + StageManager.autoLayoutFastTreeMode(); + }} + /> */}
); From c7b0aa27b63d4b68a2e664c41ba865479c7bcfc9 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sun, 2 Feb 2025 17:28:18 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E6=B3=A8=E9=87=8A=E5=88=A0=E9=99=A4=E4=B8=8D=E5=B9=B2?= =?UTF-8?q?=E5=87=80=E5=AF=BC=E8=87=B4=E5=8F=B3=E4=B8=8A=E8=A7=92=E5=9B=BE?= =?UTF-8?q?=E6=A0=87=E4=B8=80=E7=9B=B4=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canvas2d/entityRenderer/EntityDetailsButtonRenderer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/render/canvas2d/entityRenderer/EntityDetailsButtonRenderer.tsx b/src/core/render/canvas2d/entityRenderer/EntityDetailsButtonRenderer.tsx index b8c2b0d8..a9dccc39 100644 --- a/src/core/render/canvas2d/entityRenderer/EntityDetailsButtonRenderer.tsx +++ b/src/core/render/canvas2d/entityRenderer/EntityDetailsButtonRenderer.tsx @@ -10,7 +10,7 @@ import { Renderer } from "../renderer"; * 仅仅渲染一个节点右上角的按钮 */ export function EntityDetailsButtonRenderer(entity: Entity) { - if (!entity.details) { + if (!entity.details.trim()) { return; } // ShapeRenderer.renderRect( From e06ddedb72b7cf1cacf3bc189c7ce83e67cda293 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sun, 2 Feb 2025 20:24:48 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=F0=9F=90=9B=20=E6=9B=B4=E6=96=B0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AA=E9=80=BB=E8=BE=91=E8=8A=82=E7=82=B9=EF=BC=9A=E6=A0=B9?= =?UTF-8?q?=E6=8D=AE=E9=A2=9C=E8=89=B2=E6=94=B6=E9=9B=86=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=97=B6=E9=81=87=E5=88=B0=E7=A9=BA=E5=86=85=E5=AE=B9=E4=B8=8D?= =?UTF-8?q?=E6=94=B6=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autoComputeEngine/functions/nodeLogic.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/service/dataGenerateService/autoComputeEngine/functions/nodeLogic.tsx b/src/core/service/dataGenerateService/autoComputeEngine/functions/nodeLogic.tsx index 597e6c81..4c95d2e0 100644 --- a/src/core/service/dataGenerateService/autoComputeEngine/functions/nodeLogic.tsx +++ b/src/core/service/dataGenerateService/autoComputeEngine/functions/nodeLogic.tsx @@ -263,6 +263,9 @@ export namespace NodeLogic { if (AutoComputeUtils.isNodeConnectedWithLogicNode(node)) { continue; } + if (node.text.trim() === "") { + continue; + } // 匹配颜色 if (node.color.equals(matchColor)) { matchNodes.push(node); @@ -306,6 +309,9 @@ export namespace NodeLogic { if (AutoComputeUtils.isNodeConnectedWithLogicNode(node)) { continue; } + if (node.details.trim() === "") { + continue; + } // 匹配颜色 if (node.color.equals(matchColor)) { matchNodes.push(node); From 3c734e3da2dd201314e164d529a9869e8d59b216 Mon Sep 17 00:00:00 2001 From: littlefean <2028140990@qq.com> Date: Sun, 2 Feb 2025 20:54:03 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E5=AE=BD?= =?UTF-8?q?=E5=BA=A6=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../render/canvas2d/entityRenderer/EntityRenderer.tsx | 2 +- src/core/render/canvas2d/renderer.tsx | 10 +++++++--- src/core/service/Settings.tsx | 2 ++ src/locales/en.yml | 4 ++++ src/locales/zh_CN.yml | 4 ++++ src/locales/zh_TW.yml | 4 ++++ src/pages/settings/visual.tsx | 9 +++++++++ 7 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx b/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx index 53fe6338..c9e508ff 100644 --- a/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx +++ b/src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx @@ -195,7 +195,7 @@ export namespace EntityRenderer { ), Renderer.FONT_SIZE_DETAILS * Camera.currentScale, Math.max( - Renderer.NODE_DETAILS_WIDTH * Camera.currentScale, + Renderer.ENTITY_DETAILS_WIDTH * Camera.currentScale, entity.collisionBox.getRectangle().size.x * Camera.currentScale, ), StageStyleManager.currentStyle.NodeDetailsTextColor, diff --git a/src/core/render/canvas2d/renderer.tsx b/src/core/render/canvas2d/renderer.tsx index 07576a04..f653709e 100644 --- a/src/core/render/canvas2d/renderer.tsx +++ b/src/core/render/canvas2d/renderer.tsx @@ -4,11 +4,12 @@ import { Color, mixColors } from "../../dataStruct/Color"; import { Vector } from "../../dataStruct/Vector"; import { Rectangle } from "../../dataStruct/shape/Rectangle"; import { Settings } from "../../service/Settings"; +import { MouseLocation } from "../../service/controlService/MouseLocation"; import { Controller } from "../../service/controlService/controller/Controller"; +import { KeyboardOnlyEngine } from "../../service/controlService/keyboardOnlyEngine/keyboardOnlyEngine"; import { CopyEngine } from "../../service/dataManageService/copyEngine/copyEngine"; import { sine } from "../../service/feedbackService/effectEngine/mathTools/animateFunctions"; import { StageStyleManager } from "../../service/feedbackService/stageStyle/StageStyleManager"; -import { KeyboardOnlyEngine } from "../../service/controlService/keyboardOnlyEngine/keyboardOnlyEngine"; import { Camera } from "../../stage/Camera"; import { Canvas } from "../../stage/Canvas"; import { Stage } from "../../stage/Stage"; @@ -29,7 +30,6 @@ import { renderHorizonBackground, renderVerticalBackground, } from "./utilsRenderer/backgroundRenderer"; -import { MouseLocation } from "../../service/controlService/MouseLocation"; /** * 渲染器 @@ -50,10 +50,11 @@ export namespace Renderer { export const NODE_PADDING = 14; /// 节点的圆角半径 export const NODE_ROUNDED_RADIUS = 8; + /** * 节点详细信息最大宽度 */ - export const NODE_DETAILS_WIDTH = 200; + export let ENTITY_DETAILS_WIDTH = 200; export let w = 0; export let h = 0; @@ -114,6 +115,9 @@ export namespace Renderer { Settings.watch("entityDetailsLinesLimit", (value) => { ENTITY_DETAILS_LIENS_LIMIT = value; }); + Settings.watch("entityDetailsWidthLimit", (value) => { + ENTITY_DETAILS_WIDTH = value; + }); Settings.watch("showDebug", (value) => (isShowDebug = value)); Settings.watch("showBackgroundHorizontalLines", (value) => { isShowBackgroundHorizontalLines = value; diff --git a/src/core/service/Settings.tsx b/src/core/service/Settings.tsx index 3e26ac09..a545709f 100644 --- a/src/core/service/Settings.tsx +++ b/src/core/service/Settings.tsx @@ -30,6 +30,7 @@ export namespace Settings { useNativeTitleBar: boolean; entityDetailsFontSize: number; entityDetailsLinesLimit: number; + entityDetailsWidthLimit: number; limitCameraInCycleSpace: boolean; cameraCycleSpaceSizeX: number; cameraCycleSpaceSizeY: number; @@ -91,6 +92,7 @@ export namespace Settings { useNativeTitleBar: false, entityDetailsFontSize: 18, entityDetailsLinesLimit: 4, + entityDetailsWidthLimit: 200, limitCameraInCycleSpace: false, cameraCycleSpaceSizeX: 1000, cameraCycleSpaceSizeY: 1000, diff --git a/src/locales/en.yml b/src/locales/en.yml index 9d245e5a..b4240597 100644 --- a/src/locales/en.yml +++ b/src/locales/en.yml @@ -173,6 +173,10 @@ settings: title: Line Limit for Entity Details description: | Limit the maximum number of lines for entity details. Exceeding this limit will result in the omission of the excess content. + entityDetailsWidthLimit: + title: Width Limit for Entity Details + description: | + Limit the maximum width for entity details. Exceeding this limit will result in the excess content wrapping to the next line. limitCameraInCycleSpace: title: Enable Camera Movement Limitation in Cycle Space description: | diff --git a/src/locales/zh_CN.yml b/src/locales/zh_CN.yml index e7c7d53a..0c888587 100644 --- a/src/locales/zh_CN.yml +++ b/src/locales/zh_CN.yml @@ -158,6 +158,10 @@ settings: title: 实体详细信息行数限制 description: | 限制实体详细信息的最大行数,超过限制的部分将被省略 + entityDetailsWidthLimit: + title: 实体详细信息宽度限制 + description: | + 限制实体详细信息的最大宽度,超过限制的部分将被换行 limitCameraInCycleSpace: title: 开启循环空间限制摄像机移动 description: | diff --git a/src/locales/zh_TW.yml b/src/locales/zh_TW.yml index b9a8f6b9..8fdea587 100644 --- a/src/locales/zh_TW.yml +++ b/src/locales/zh_TW.yml @@ -145,6 +145,10 @@ settings: title: 实体详细信息行数限制 description: | 限制实体详细信息的最大行数,超过限制的部分将被省略 + entityDetailsWidthLimit: + title: 实体详细信息宽度限制 + description: | + 限制实体详细信息的最大宽度,超过限制的部分将被换行 limitCameraInCycleSpace: title: 开启循环空间限制摄像机移动 description: | diff --git a/src/pages/settings/visual.tsx b/src/pages/settings/visual.tsx index d375eed1..09cb2a2d 100644 --- a/src/pages/settings/visual.tsx +++ b/src/pages/settings/visual.tsx @@ -14,6 +14,7 @@ import { Ratio, Rows4, Scaling, + Space, Spline, VenetianMask, } from "lucide-react"; @@ -53,6 +54,14 @@ export default function Visual() { max={200} step={2} /> + } + settingKey="entityDetailsWidthLimit" + type="slider" + min={200} + max={2000} + step={100} + /> } settingKey="limitCameraInCycleSpace" type="switch" />