Skip to content

Commit

Permalink
✨ 增加实体详细信息渲染字体大小自定义和行数限制自定义
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlefean committed Feb 1, 2025
1 parent 1c52d38 commit d6135e6
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
12 changes: 11 additions & 1 deletion src/core/render/canvas2d/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions src/core/service/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export namespace Settings {
alwaysShowDetails: boolean;
protectingPrivacy: boolean;
useNativeTitleBar: boolean;
entityDetailsFontSize: number;
entityDetailsLinesLimit: number;
limitCameraInCycleSpace: boolean;
cameraCycleSpaceSizeX: number;
cameraCycleSpaceSizeY: number;
Expand Down Expand Up @@ -87,6 +89,8 @@ export namespace Settings {
alwaysShowDetails: false,
protectingPrivacy: false,
useNativeTitleBar: false,
entityDetailsFontSize: 18,
entityDetailsLinesLimit: 4,
limitCameraInCycleSpace: false,
cameraCycleSpaceSizeX: 1000,
cameraCycleSpaceSizeY: 1000,
Expand Down
8 changes: 8 additions & 0 deletions src/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
8 changes: 8 additions & 0 deletions src/locales/zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ settings:
用于反馈问题截图时,开启此项之后将汉字全部替换成《㊙》,以保护隐私。
仅作显示层面的替换,不会影响真实数据
反馈完毕后可再关闭,复原
entityDetailsFontSize:
title: 实体详细信息字体大小
description: |
单位为像素
entityDetailsLinesLimit:
title: 实体详细信息行数限制
description: |
限制实体详细信息的最大行数,超过限制的部分将被省略
limitCameraInCycleSpace:
title: 开启循环空间限制摄像机移动
description: |
Expand Down
8 changes: 8 additions & 0 deletions src/locales/zh_TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ settings:
用於回饋問題截圖時,開啟此項之後將漢字全部替換成《好》,以保護隱私。
僅作顯示層面的替換,不會影響真實數據
回饋完畢後可再關閉,復原
entityDetailsFontSize:
title: 实体详细信息字体大小
description: |
单位为像素
entityDetailsLinesLimit:
title: 实体详细信息行数限制
description: |
限制实体详细信息的最大行数,超过限制的部分将被省略
limitCameraInCycleSpace:
title: 开启循环空间限制摄像机移动
description: |
Expand Down
19 changes: 19 additions & 0 deletions src/pages/settings/visual.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import {
AppWindowMac,
ArrowDownNarrowWide,
Blend,
Bug,
CaseSensitive,
Columns4,
Crosshair,
Grip,
Expand Down Expand Up @@ -35,6 +37,23 @@ export default function Visual() {

<SettingField icon={<ListCollapse />} settingKey="alwaysShowDetails" type="switch" />
<SettingField icon={<AppWindowMac />} settingKey="useNativeTitleBar" type="switch" />
<SettingField
icon={<CaseSensitive />}
settingKey="entityDetailsFontSize"
type="slider"
min={18}
max={36}
step={1}
/>
<SettingField
icon={<ArrowDownNarrowWide />}
settingKey="entityDetailsLinesLimit"
type="slider"
min={1}
max={200}
step={2}
/>

<SettingField icon={<Ratio />} settingKey="limitCameraInCycleSpace" type="switch" />
<SettingField
icon={<Scaling />}
Expand Down

0 comments on commit d6135e6

Please sign in to comment.