I need to refactor $Handles & OnCanvasObject. Currently $Handles doesn't really know about the object it's supposed to affect. It uses a callback with a delta position and absolute width/height... It listens for an event to know when the element of the object it's supposed to affect is replaced... and most importantly, it gets the dimensions of the object from getBoundingClientRect. Simply dividing by the magnification level "helps", but it has other issues because it doesn't have a proper source of truth for the dimensions.
The text was updated successfully, but these errors were encountered:
Note: I've done some work on a branch working towards passive selections (#28), which simplifies the OnCanvasSelection object a bit, removing the concept of "instantiation" from it, instead having a different way of rendering the selection while you're dragging to create a selection, which looks like it does in mspaint.
That should probably be done and merged first, 1. because it's modifying similar code, 2. because the simplification should help work on this.
After improving the Text tool, and giving care to how it works when zoomed in, and then making the handles of the textbox and selection way easier to grab, I didn't feel like I could share these improvements without a disclaimer, given this much more glaring bug.
So I decided to attack this, and I figured out how to do it without as much restructuring as I was previously imagining.
First I simplified the interface of the $Handles module, from an element (that could be replaced over time, thru an event!), to just a function that returns a rectangle, which is nearly all it was used for. 3392557
Then I changed the rectangle from a client rectangle (getBoundingClientRect()) to a canvas document coordinates rectangle, with better sources of truth: 7ce4e94