Skip to content

Comments

develop#228

Closed
ienaga wants to merge 2 commits intomainfrom
develop
Closed

develop#228
ienaga wants to merge 2 commits intomainfrom
develop

Conversation

@ienaga
Copy link
Member

@ienaga ienaga commented Nov 14, 2025

No description provided.

Copilot AI review requested due to automatic review settings November 14, 2025 06:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR bumps the Next2D Player version from 2.7.0 to 2.8.0 and adds a fallback hit-testing mechanism for shapes without a graphics buffer.

  • Version bumped to 2.8.0 in both package.json and console log
  • Added fallback rectangle-based hit testing for shapes with empty graphics buffers
  • Added 15 new test cases to validate the hit-testing behavior with various transformations and edge cases

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
package.json Updated package version from 2.7.0 to 2.8.0
src/index.ts Updated console log version string from 2.7.0 to 2.8.0
packages/display/src/Shape/usecase/ShapeHitTestUseCase.ts Added fallback hit-testing logic for shapes without graphics buffer, creating a default rectangle path based on shape bounds
packages/display/src/Shape/usecase/ShapeHitTestUseCase.test.ts Added comprehensive test coverage for the new fallback hit-testing behavior, including transformations, edge cases, and boundary conditions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to +54
hit_context.setTransform(
tMatrix[0], tMatrix[1], tMatrix[2],
tMatrix[3], tMatrix[4], tMatrix[5]
);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The setTransform call is duplicated - it's already called on lines 40-43 before the conditional check. The second call on lines 51-54 is redundant and should be removed.

Suggested change
hit_context.setTransform(
tMatrix[0], tMatrix[1], tMatrix[2],
tMatrix[3], tMatrix[4], tMatrix[5]
);

Copilot uses AI. Check for mistakes.
tMatrix[0], tMatrix[1], tMatrix[2],
tMatrix[3], tMatrix[4], tMatrix[5]
);
hit_context.beginPath();
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The beginPath call is also duplicated - it's already called on line 39 before the conditional check. The second call on line 55 is redundant and should be removed.

Suggested change
hit_context.beginPath();

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +60
hit_context.moveTo(0, 0);
hit_context.lineTo(width, 0);
hit_context.lineTo(width, height);
hit_context.lineTo(0, height);
hit_context.lineTo(0, 0);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rectangle path should start from (graphics.xMin, graphics.yMin) instead of (0, 0). The current implementation assumes the shape bounds start at the origin, but shapes can have non-zero xMin/yMin values (as tested in test case23 with negative coordinates). The path should be:

hit_context.moveTo(graphics.xMin, graphics.yMin);
hit_context.lineTo(graphics.xMax, graphics.yMin);
hit_context.lineTo(graphics.xMax, graphics.yMax);
hit_context.lineTo(graphics.xMin, graphics.yMax);
hit_context.lineTo(graphics.xMin, graphics.yMin);
Suggested change
hit_context.moveTo(0, 0);
hit_context.lineTo(width, 0);
hit_context.lineTo(width, height);
hit_context.lineTo(0, height);
hit_context.lineTo(0, 0);
hit_context.moveTo(graphics.xMin, graphics.yMin);
hit_context.lineTo(graphics.xMax, graphics.yMin);
hit_context.lineTo(graphics.xMax, graphics.yMax);
hit_context.lineTo(graphics.xMin, graphics.yMax);
hit_context.lineTo(graphics.xMin, graphics.yMin);

Copilot uses AI. Check for mistakes.
@ienaga
Copy link
Member Author

ienaga commented Nov 14, 2025

指摘箇所を改修するので、一旦close

@ienaga ienaga closed this Nov 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant