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

Fix resizing the canvas or the selection when magnified #13

Closed
1j01 opened this issue May 24, 2017 · 2 comments
Closed

Fix resizing the canvas or the selection when magnified #13

1j01 opened this issue May 24, 2017 · 2 comments
Labels
bug

Comments

@1j01
Copy link
Owner

@1j01 1j01 commented May 24, 2017

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.

@1j01

This comment has been minimized.

Copy link
Owner Author

@1j01 1j01 commented Oct 18, 2019

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.

@1j01

This comment has been minimized.

Copy link
Owner Author

@1j01 1j01 commented Dec 5, 2019

Finally fixed!!!

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

I'm super happy with this 😃

@1j01 1j01 closed this Dec 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.