Skip to content

Comments

develop#229

Merged
ienaga merged 3 commits intomainfrom
develop
Nov 14, 2025
Merged

develop#229
ienaga merged 3 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:31
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 fallback hit detection logic for shapes without graphics buffer data.

  • Version updated to 2.8.0 across package.json and console output
  • Implemented fallback rectangle path for hit testing shapes with empty graphics buffers
  • Added comprehensive test coverage with 15 new test cases covering various scenarios including transformations, edge cases, and negative coordinates

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
package.json Updated version from 2.7.0 to 2.8.0
src/index.ts Updated console log version string to 2.8.0
packages/display/src/Shape/usecase/ShapeHitTestUseCase.ts Added fallback hit detection for shapes without graphics buffer by creating a default rectangle path based on bounds
packages/display/src/Shape/usecase/ShapeHitTestUseCase.test.ts Added 15 new test cases (test11-test25) covering hit detection scenarios without buffer, transformations, negative coordinates, and edge cases

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

Comment on lines +51 to +55
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 fallback rectangle path is using incorrect coordinates. The path starts at (0, 0) and extends to (width, height), but it should start at (xMin, yMin) and extend to (xMax, yMax) to correctly represent the shape's bounds.

For example, if a shape has xMin = -50, yMin = -50, xMax = 50, yMax = 50, the current code would create a rectangle from (0, 0) to (100, 100), but it should create a rectangle from (-50, -50) to (50, 50).

Suggested fix:

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 ienaga merged commit d05644a into main Nov 14, 2025
21 checks passed
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