Skip to content

Comments

回転時のスケール更新処理のバグ改修#204

Merged
ienaga merged 8 commits intomainfrom
develop
Aug 10, 2025
Merged

回転時のスケール更新処理のバグ改修#204
ienaga merged 8 commits intomainfrom
develop

Conversation

@ienaga
Copy link
Member

@ienaga ienaga commented Aug 10, 2025

No description provided.

Copilot AI review requested due to automatic review settings August 10, 2025 12:42
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 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);
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

[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.

Suggested change
rotation = $clamp(rotation % 360, -360, 360, 0);
rotation = $clamp(rotation % 360, MIN_ROTATION_DEGREES, MAX_ROTATION_DEGREES, 0);

Copilot uses AI. Check for mistakes.

// transformed ColorTransform(tColorTransform)
const rawColor = displayObjectGetRawColorTransformUseCase(text_field);
const rawColor = displayObjectGetRawColorTransformUseCase(text_field as any);
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
const rawColor = displayObjectGetRawColorTransformUseCase(text_field as any);
const rawColor = displayObjectGetRawColorTransformUseCase(text_field);

Copilot uses AI. Check for mistakes.

// transformed matrix(tMatrix)
const rawMatrix = displayObjectGetRawMatrixUseCase(text_field);
const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as any);
Copy link

Copilot AI Aug 10, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as any);
const rawMatrix = displayObjectGetRawMatrixUseCase(text_field as DisplayObject);

Copilot uses AI. Check for mistakes.
@ienaga ienaga merged commit 23c777b into main Aug 10, 2025
14 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