Coordinates
Screen space (pixels from input and the viewport) and world space (the infinite canvas) are distinct euclid types, so mixing them is a compile error:
- Screen -> world:
world = screen / zoom - position - World -> screen:
screen = (world + position) * zoom - Zoom at cursor:
new_pos = old_pos + cursor_screen * (1/new_zoom - 1/old_zoom)
The derivations, and the screen/world type discipline they rest on, are in node_graph/camera.rs.