unblocked
unblocked copied to clipboard
Fix buggy interactions, and make coordinates easier to reason about
What has been done so far:
- Introduce position for absolute, relative viewport, and relative mouse
- Utility function to convert between them
- Migrate decent amount of logic to these new types
- Main benefit is to communicate coordinates better instead of reusing x,y everywhere and having to think about this every time
- Fix scrolling not working as intended when using coordinates (current solution feels hacky, but will be much better once switched to absolute coordinates)
- Fix/improve rectUtils: contained bugs (and weird edge cases), also added new util function
TODO:
- Migrate as much as possible/where it makes sense to absolute coordinates, why:
- Extract out extra info needed such as scrollposition, relativeTo... (encoded in absolute position) This info is only needed again when converting happens -> don't clutter everything with this
- Much easier to reason about coordinates in absolute system
- When other unit are needed don't reinvent the wheel everywhere, but just use util functions to convert between coordinate systems
- Tests for new rectUtils, and coordinateUtils
- Cleanup old logic and leftovers
- Modify Hero where needed
- ...