Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Fix buggy interactions, and make coordinates easier to reason about #72

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

soundofspace
Copy link
Contributor

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
  • ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant