-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Phaser.Ellipse.contains() broken #1524
Comments
I'm fine with a local Phaser patch - I suspect I'm not alone. Care to create a PR? |
I'd like to keep differences to Pixi as minimal as possible, but I'm no longer worried about maintaining absolute parity - so am happy to have this fixed locally in Phaser if you'd like to create a PR. |
I've just checked the current dev branch and it behaves similarly broken as expected. Tested with the following in the browser console with just PIXI loaded:
So, both libs seems to require a fix one way or another. Would it be best to fix in PIXI first then import the mods into Phaser - that way alignment is maintained and both get fixed? |
If you're going to submit a PR then feel free to do it against both. I can't say when Pixi will merge it as they're starting off on some major rewrite, but I'll merge it into Phaser dev instantly. |
Ok, before reverting I'll test the old version properly, make sure it works in differing cases and not just my simple use where the ellipse xy position = 0. |
Just wondering how you got on with this? Should we close the issue off? |
Argh, I put this aside for a bit with the intention to see why PIXI was also doing this, I did a little digging then got sidetracked. The fix I suggested (just reverting back) is fine but I did see that there is room for a little optimisation too. I’ve been running with the broken function overridden for now. I’ll do it now. |
Thanks for the code. Now in dev :) |
It looks like the recent update to this function broke it (imported from PIXI it seems).
Here's how to demonstrate the problem. Start with the current dev phaser loaded in the browser and open the dev console.
Create an ellipse by typing:
then test if the most upper-left coordinate is within the ellipse by typing:
it will return true - which is wrong (a corner pixel is not within the ellipse)
by comparision, you can add the old code and re-test - paste this chunk into the console:
and type the following to repeat the test using the old 'contains' function:
this time the return is false - which is right, ie the corner pixel is not in the ellipse.
Either fix the new calculation method or revert to the old method.
The text was updated successfully, but these errors were encountered: