Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes bugs related to scale updates during rotation operations in the Next2D Player display system. The changes improve the accuracy of scale calculations and ensure proper handling of rotated display objects.
- Version bump from 2.4.1/2.4.2 to 2.5.0
- Complete rewrite of scale calculation algorithms for better accuracy with rotated objects
- Addition of proper scale/rotation invalidation to maintain consistency
- Test updates to reflect improved precision
Reviewed Changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | Version string update in console log |
| package.json | Version bump and dependency updates |
| DisplayObjectSetScaleXUseCase.ts | Complete rewrite of X-scale setting logic with improved rotation handling |
| DisplayObjectSetScaleYUseCase.ts | Complete rewrite of Y-scale setting logic with improved rotation handling |
| DisplayObjectSetRotationUseCase.ts | Minor fix to clamp range and added scale invalidation |
| DisplayObjectGetScaleXUseCase.ts | Improved X-scale calculation using hypot and proper sign detection |
| DisplayObjectGetScaleYUseCase.ts | Improved Y-scale calculation using determinant formula |
| TextFieldGenerateRenderQueueUseCase.ts | Added type casting to resolve type issues |
| Various test files | Updated expected values and added new test cases |
| index.html | Removed commented code and updated test examples |
| export const execute = <D extends DisplayObject>(display_object: D, rotation: number): void => | ||
| { | ||
| rotation = $clamp(rotation % 360, 0 - 360, 360, 0); | ||
| rotation = $clamp(rotation % 360, -360, 360, 0); |
There was a problem hiding this comment.
[nitpick] The expression 0 - 360 was changed to -360. While functionally equivalent, this change removes an unnecessary arithmetic operation that could have been confusing. However, consider using a named constant for the rotation bounds to improve readability.
| rotation = $clamp(rotation % 360, -360, 360, 0); | |
| rotation = $clamp(rotation % 360, MIN_ROTATION_DEGREES, MAX_ROTATION_DEGREES, 0); |
|
|
||
| // transformed ColorTransform(tColorTransform) | ||
| const rawColor = displayObjectGetRawColorTransformUseCase(text_field); | ||
| const rawColor = displayObjectGetRawColorTransformUseCase(text_field as any); |
There was a problem hiding this comment.
Using as any type casting bypasses TypeScript's type checking. This suggests a type mismatch that should be resolved by either updating the function signature or fixing the type definitions rather than using unsafe casting.
| const rawColor = displayObjectGetRawColorTransformUseCase(text_field as any); | |
| const rawColor = displayObjectGetRawColorTransformUseCase(text_field); |
|
|
||
| // transformed matrix(tMatrix) | ||
| const rawMatrix = displayObjectGetRawMatrixUseCase(text_field); | ||
| const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as any); |
There was a problem hiding this comment.
Using as any type casting bypasses TypeScript's type checking. This suggests a type mismatch that should be resolved by either updating the function signature or fixing the type definitions rather than using unsafe casting.
| const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as any); | |
| const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as DisplayObject); |
No description provided.