Skip to content

Commit

Permalink
✨ 添加了节点详细信息宽度的自定义调整
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlefean committed Feb 2, 2025
1 parent e06dded commit 3c734e3
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 7 additions & 3 deletions src/core/render/canvas2d/renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -29,7 +30,6 @@ import {
renderHorizonBackground,
renderVerticalBackground,
} from "./utilsRenderer/backgroundRenderer";
import { MouseLocation } from "../../service/controlService/MouseLocation";

/**
* 渲染器
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/core/service/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export namespace Settings {
useNativeTitleBar: boolean;
entityDetailsFontSize: number;
entityDetailsLinesLimit: number;
entityDetailsWidthLimit: number;
limitCameraInCycleSpace: boolean;
cameraCycleSpaceSizeX: number;
cameraCycleSpaceSizeY: number;
Expand Down Expand Up @@ -91,6 +92,7 @@ export namespace Settings {
useNativeTitleBar: false,
entityDetailsFontSize: 18,
entityDetailsLinesLimit: 4,
entityDetailsWidthLimit: 200,
limitCameraInCycleSpace: false,
cameraCycleSpaceSizeX: 1000,
cameraCycleSpaceSizeY: 1000,
Expand Down
4 changes: 4 additions & 0 deletions src/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 4 additions & 0 deletions src/locales/zh_CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ settings:
title: 实体详细信息行数限制
description: |
限制实体详细信息的最大行数,超过限制的部分将被省略
entityDetailsWidthLimit:
title: 实体详细信息宽度限制
description: |
限制实体详细信息的最大宽度,超过限制的部分将被换行
limitCameraInCycleSpace:
title: 开启循环空间限制摄像机移动
description: |
Expand Down
4 changes: 4 additions & 0 deletions src/locales/zh_TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ settings:
title: 实体详细信息行数限制
description: |
限制实体详细信息的最大行数,超过限制的部分将被省略
entityDetailsWidthLimit:
title: 实体详细信息宽度限制
description: |
限制实体详细信息的最大宽度,超过限制的部分将被换行
limitCameraInCycleSpace:
title: 开启循环空间限制摄像机移动
description: |
Expand Down
9 changes: 9 additions & 0 deletions src/pages/settings/visual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Ratio,
Rows4,
Scaling,
Space,
Spline,
VenetianMask,
} from "lucide-react";
Expand Down Expand Up @@ -53,6 +54,14 @@ export default function Visual() {
max={200}
step={2}
/>
<SettingField
icon={<Space />}
settingKey="entityDetailsWidthLimit"
type="slider"
min={200}
max={2000}
step={100}
/>

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

0 comments on commit 3c734e3

Please sign in to comment.