Skip to content

FlxSpriteGroup: Allow clipRectTransform to be overriden #3388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 6, 2025

Conversation

slameron
Copy link
Contributor

@slameron slameron commented Mar 6, 2025

setting cliprect to a flxsprite group that has scaled members results in weird clipping

this video shows the clipping prior to the change, notice the profile picture becomes visible further to the left than other members of the group, as well as being clipped due to the height of the clipRect being 102 and the original size of the profile picture before being scaled was 184 - after scaling down the picture is 72 pixels.

2025-03-05_19-00-50.mp4

with the change, FlxSpriteGroup changes the height of the members' clipRect based on their scale.
after the change:

2025-03-05_20-35-01.mp4

note that in the videos, the crown is not a part of the sprite group, so it being visible before the rest of the group is not relevant

@Geokureli
Copy link
Member

I should mention that there is some previous discussions on cliprect + group + scaling
#2643
#2301
#2898

I assume this is making a similar change to what was proposed in the first link, making clipRect refer to a rect in the world rather than a rect in the source. If so, thats a breaking change and I think we should go towards the solution proposed in 2898

@slameron
Copy link
Contributor Author

slameron commented Mar 6, 2025

this doesn't necessarily make cliprect a rect in the world, it just scales the cliprect for items in spritegroups, as using cliprects on spritegroups that have members that were scaled down from a larger size than the spritegroup causes clipping issues shown in the first video.
i see in 2643 you said you wanted scaling cliprects to be opt-in
as for pr 2898, is it worth making an attempt at doing that, or is it not really on the radar for now?

for now, what are thoughts on making the cliprecttransform in FlxSpriteGroup non-inlined so it can be overridden with the change?

@Geokureli
Copy link
Member

as for pr 2898, is it worth making an attempt at doing that, or is it not really on the radar for now?

I think it's doable, and I would if I had time

for now, what are thoughts on making the cliprecttransform in FlxSpriteGroup non-inlined so it can be overridden with the change?

sure

@Geokureli Geokureli merged commit 19e9424 into HaxeFlixel:dev Mar 6, 2025
11 checks passed
@Geokureli Geokureli added this to the 6.1.0 milestone Mar 6, 2025
@Geokureli Geokureli changed the title fix cliprect on scaled members in FlxSpriteGroup inline FlxSpriteGroup.clipRectTransform Mar 7, 2025
@Geokureli Geokureli changed the title inline FlxSpriteGroup.clipRectTransform FlxSpriteGroup: Allow clipRectTransform to be overriden Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants