Skip to content
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

Rect2.clip returns incorrect results when using Rect2 containing negative size values #25829

Closed
Anaxagor14 opened this issue Feb 12, 2019 · 1 comment · Fixed by #37626
Closed
Milestone

Comments

@Anaxagor14
Copy link

Godot version:
Godot 3.1 beta

OS/device including version:
Windows 10 Home build 17763.195

Issue description:
Using Rect2.clip returns incorrect results if one of the Rect2 objects has a size containing negative values.
Other systems using Rect2 seem to work fine with them, like draw_rect.

Steps to reproduce:
Here is a simple code example:

            var rectA = Rect2(0, 0, 8, 8)
            var rectB = Rect2(2, 2, 8, 8)
            var overlap_AB_OK = rectA.clip(rectB) # Returns Rect2(2, 2, 6, 6)
            var rectC = Rect2(10, 10, -8, -8) # Equivalent to rectB
            var overlap_AC_wrong = rectA.clip(rectC) # Returns Rect2(0, 0, 0, 0)
            var overlap_AC_OK = rectA.clip(rectC.abs()) # Returns the correct value, same as overlap_AB_OK 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants