You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When cropping a trimmed frame, the crop region is cut excessively on the right and bottom.
Example Test Code
// a frame that has transparent area around it and was trimmed from its original size by a texture packer
const image = this.add.image( 0, 0, 'atlas', 'frame' );
image.setCrop( 0, 0, image.width, image.height );
Additional Information
Frame.setCropUVs() has this code:
// Need to check for intersection between the cut area and the crop area
// If there is none, we set UV to be empty, otherwise set it to be the intersection area
width = Clamp(width, 0, cw - x);
height = Clamp(height, 0, ch - y);
But it has a problem as 'cw' and 'ch' are relative to 'cx' and 'cy' respectively while 'x' and 'y' are relative to (0,0) of the untrimmed frame. Not accounting for that leads to the width/height cut off compared to the requested crop region's width/height when cx/cy is not zero. The correct math would therefore be this:
Version
Description
When cropping a trimmed frame, the crop region is cut excessively on the right and bottom.
Example Test Code
Additional Information
Frame.setCropUVs() has this code:
But it has a problem as 'cw' and 'ch' are relative to 'cx' and 'cy' respectively while 'x' and 'y' are relative to (0,0) of the untrimmed frame. Not accounting for that leads to the width/height cut off compared to the requested crop region's width/height when cx/cy is not zero. The correct math would therefore be this:
The text was updated successfully, but these errors were encountered: