Skip to content

Commit

Permalink
💄 NodeDetails 宽度和节点宽度一致
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlefean committed Nov 15, 2024
1 parent fbea182 commit 669cbb2
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/core/render/canvas2d/entityRenderer/EntityRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ export namespace EntityRenderer {
section.rectangle.location.add(Vector.same(Renderer.NODE_PADDING)),
),
Renderer.FONT_SIZE * Camera.currentScale,
section.color.a === 1 ? colorInvert(section.color) : colorInvert(StageStyleManager.currentStyle.BackgroundColor)
section.color.a === 1
? colorInvert(section.color)
: colorInvert(StageStyleManager.currentStyle.BackgroundColor),
);
} else {
RenderUtils.renderRect(
Expand All @@ -58,7 +60,9 @@ export namespace EntityRenderer {
section.rectangle.location.add(Vector.same(Renderer.NODE_PADDING)),
),
Renderer.FONT_SIZE * Camera.currentScale,
section.color.a === 1 ? colorInvert(section.color) : colorInvert(StageStyleManager.currentStyle.BackgroundColor),
section.color.a === 1
? colorInvert(section.color)
: colorInvert(StageStyleManager.currentStyle.BackgroundColor),
);
}

Expand Down Expand Up @@ -103,17 +107,23 @@ export namespace EntityRenderer {
node.rectangle.location.add(Vector.same(Renderer.NODE_PADDING)),
),
Renderer.FONT_SIZE * Camera.currentScale,
node.color.a === 1 ? colorInvert(node.color) : colorInvert(StageStyleManager.currentStyle.BackgroundColor),
node.color.a === 1
? colorInvert(node.color)
: colorInvert(StageStyleManager.currentStyle.BackgroundColor),
);
}

if (node.isSelected) {
// 在外面增加一个框
CollisionBoxRenderer.render(node.collisionBox, StageStyleManager.currentStyle.CollideBoxSelectedColor);
CollisionBoxRenderer.render(
node.collisionBox,
StageStyleManager.currentStyle.CollideBoxSelectedColor,
);
}
if (node.isAiGenerating) {
const borderColor = StageStyleManager.currentStyle.CollideBoxSelectedColor.clone();
borderColor.a = Random.randomFloat(0.2, 1);
const borderColor =
StageStyleManager.currentStyle.CollideBoxSelectedColor.clone();
borderColor.a = Random.randomFloat(0.2, 1);
// 在外面增加一个框
RenderUtils.renderRect(
new Rectangle(
Expand Down Expand Up @@ -144,8 +154,11 @@ export namespace EntityRenderer {
node.rectangle.location.add(new Vector(0, node.rectangle.size.y)),
),
Renderer.FONT_SIZE_DETAILS * Camera.currentScale,
Renderer.NODE_DETAILS_WIDTH * Camera.currentScale,
StageStyleManager.currentStyle.NodeDetailsTextColor
Math.max(
Renderer.NODE_DETAILS_WIDTH * Camera.currentScale,
node.rectangle.size.x * Camera.currentScale,
),
StageStyleManager.currentStyle.NodeDetailsTextColor,
);
}
export function colorInvert(color: Color): Color {
Expand Down

0 comments on commit 669cbb2

Please sign in to comment.