Skip to content

Commit d6135e6

Browse files
committed
✨ 增加实体详细信息渲染字体大小自定义和行数限制自定义
1 parent 1c52d38 commit d6135e6

File tree

7 files changed

+60
-3
lines changed

7 files changed

+60
-3
lines changed

src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,10 @@ export namespace EntityRenderer {
179179
export function renderEntityDetails(entity: Entity) {
180180
if (entity.details && !entity.isEditingDetails) {
181181
if (Renderer.isAlwaysShowDetails) {
182-
_renderEntityDetails(entity, 4);
182+
_renderEntityDetails(entity, Renderer.ENTITY_DETAILS_LIENS_LIMIT);
183183
} else {
184184
if (entity.isMouseHover) {
185-
_renderEntityDetails(entity, 4);
185+
_renderEntityDetails(entity, Renderer.ENTITY_DETAILS_LIENS_LIMIT);
186186
}
187187
}
188188
}

src/core/render/canvas2d/renderer.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ export namespace Renderer {
4242
/**
4343
* 节点详细信息的文字大小
4444
*/
45-
export const FONT_SIZE_DETAILS = 18;
45+
export let FONT_SIZE_DETAILS = 18;
46+
/**
47+
* 节点详细信息的文字行数限制
48+
*/
49+
export let ENTITY_DETAILS_LIENS_LIMIT = 4;
4650
export const NODE_PADDING = 14;
4751
/// 节点的圆角半径
4852
export const NODE_ROUNDED_RADIUS = 8;
@@ -104,6 +108,12 @@ export namespace Renderer {
104108

105109
// 确保这个函数在软件打开的那一次调用
106110
export function init() {
111+
Settings.watch("entityDetailsFontSize", (value) => {
112+
FONT_SIZE_DETAILS = value;
113+
});
114+
Settings.watch("entityDetailsLinesLimit", (value) => {
115+
ENTITY_DETAILS_LIENS_LIMIT = value;
116+
});
107117
Settings.watch("showDebug", (value) => (isShowDebug = value));
108118
Settings.watch("showBackgroundHorizontalLines", (value) => {
109119
isShowBackgroundHorizontalLines = value;

src/core/service/Settings.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export namespace Settings {
2828
alwaysShowDetails: boolean;
2929
protectingPrivacy: boolean;
3030
useNativeTitleBar: boolean;
31+
entityDetailsFontSize: number;
32+
entityDetailsLinesLimit: number;
3133
limitCameraInCycleSpace: boolean;
3234
cameraCycleSpaceSizeX: number;
3335
cameraCycleSpaceSizeY: number;
@@ -87,6 +89,8 @@ export namespace Settings {
8789
alwaysShowDetails: false,
8890
protectingPrivacy: false,
8991
useNativeTitleBar: false,
92+
entityDetailsFontSize: 18,
93+
entityDetailsLinesLimit: 4,
9094
limitCameraInCycleSpace: false,
9195
cameraCycleSpaceSizeX: 1000,
9296
cameraCycleSpaceSizeY: 1000,

src/locales/en.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ settings:
165165
When taking screenshots for feedback, enabling this option will replace all Chinese characters with "好" to protect privacy.
166166
This is only a visual replacement and will not affect the actual data.
167167
You can turn it off and restore it after providing feedback.
168+
entityDetailsFontSize:
169+
title: Font Size for Entity Details
170+
description: |
171+
Unit is pixels
172+
entityDetailsLinesLimit:
173+
title: Line Limit for Entity Details
174+
description: |
175+
Limit the maximum number of lines for entity details. Exceeding this limit will result in the omission of the excess content.
168176
limitCameraInCycleSpace:
169177
title: Enable Camera Movement Limitation in Cycle Space
170178
description: |

src/locales/zh_CN.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ settings:
150150
用于反馈问题截图时,开启此项之后将汉字全部替换成《㊙》,以保护隐私。
151151
仅作显示层面的替换,不会影响真实数据
152152
反馈完毕后可再关闭,复原
153+
entityDetailsFontSize:
154+
title: 实体详细信息字体大小
155+
description: |
156+
单位为像素
157+
entityDetailsLinesLimit:
158+
title: 实体详细信息行数限制
159+
description: |
160+
限制实体详细信息的最大行数,超过限制的部分将被省略
153161
limitCameraInCycleSpace:
154162
title: 开启循环空间限制摄像机移动
155163
description: |

src/locales/zh_TW.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,14 @@ settings:
137137
用於回饋問題截圖時,開啟此項之後將漢字全部替換成《好》,以保護隱私。
138138
僅作顯示層面的替換,不會影響真實數據
139139
回饋完畢後可再關閉,復原
140+
entityDetailsFontSize:
141+
title: 实体详细信息字体大小
142+
description: |
143+
单位为像素
144+
entityDetailsLinesLimit:
145+
title: 实体详细信息行数限制
146+
description: |
147+
限制实体详细信息的最大行数,超过限制的部分将被省略
140148
limitCameraInCycleSpace:
141149
title: 开启循环空间限制摄像机移动
142150
description: |

src/pages/settings/visual.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import {
22
AppWindowMac,
3+
ArrowDownNarrowWide,
34
Blend,
45
Bug,
6+
CaseSensitive,
57
Columns4,
68
Crosshair,
79
Grip,
@@ -35,6 +37,23 @@ export default function Visual() {
3537

3638
<SettingField icon={<ListCollapse />} settingKey="alwaysShowDetails" type="switch" />
3739
<SettingField icon={<AppWindowMac />} settingKey="useNativeTitleBar" type="switch" />
40+
<SettingField
41+
icon={<CaseSensitive />}
42+
settingKey="entityDetailsFontSize"
43+
type="slider"
44+
min={18}
45+
max={36}
46+
step={1}
47+
/>
48+
<SettingField
49+
icon={<ArrowDownNarrowWide />}
50+
settingKey="entityDetailsLinesLimit"
51+
type="slider"
52+
min={1}
53+
max={200}
54+
step={2}
55+
/>
56+
3857
<SettingField icon={<Ratio />} settingKey="limitCameraInCycleSpace" type="switch" />
3958
<SettingField
4059
icon={<Scaling />}

0 commit comments

Comments
 (0)