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

Add KeepInBoundsComponent #842

Closed
2 tasks done
AlmasB opened this issue Jul 8, 2020 · 1 comment
Closed
2 tasks done

Add KeepInBoundsComponent #842

AlmasB opened this issue Jul 8, 2020 · 1 comment
Labels
difficulty:easy Simple, few changes required help wanted Contributions welcome / high PR acceptance rate lang:java-or-kotlin Can be done in Java or Kotlin

Comments

@AlmasB
Copy link
Owner

AlmasB commented Jul 8, 2020

  • This is similar to KeepOnScreenComponent in com.almasb.fxgl.dsl.components, but the user provides a Rectangle2D (which can also be set at runtime). The component does not allow the attached entity to move outside of the bounds. BBox should be used to check entity bounds.

  • Once the above is complete, KeepOnScreenComponent should be updated to either extend KeepInBounds or somehow make use of it to avoid code duplication and fix a bug that will occur when viewport is zoomed. In order to fix the bug, viewport.visibleArea should be used, as it correctly computes visible Rectangle2D.

@AlmasB AlmasB added help wanted Contributions welcome / high PR acceptance rate difficulty:easy Simple, few changes required labels Jul 8, 2020
@AlmasB
Copy link
Owner Author

AlmasB commented Dec 23, 2020

@hendrikebbers might be exactly what you need for your "drag but keep in bounds" use case.

@AlmasB AlmasB added the lang:java-or-kotlin Can be done in Java or Kotlin label Feb 5, 2021
@AlmasB AlmasB closed this as completed in 7c2e659 Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty:easy Simple, few changes required help wanted Contributions welcome / high PR acceptance rate lang:java-or-kotlin Can be done in Java or Kotlin
Projects
None yet
Development

No branches or pull requests

1 participant