Fix brush tool and fill bucket bugs on browser zoom#132
Conversation
|
When using the brush, the size of the cursor does not properly scale with what you see being drawn on the screen. This is because the cursor's "zoom" is always at 100%, rather than whatever percent the tab is at. I found this decade-old repo (https://github.com/tombigel/detect-zoom) that actually still works, which we could use to scale the brush/eraser cursor accordingly. Alternatively we can change the cursor to be drawn directly on the website instead of using the cursor (which could arguably be better, so that we can work around the maximum cursor size). There are 2 more bugs I noticed that come from Wick, those being 1) if you zoomed in or out during the current session, the eraser gets weirdly offset/zoomed before doing the erase and 2) if you zoom in during the session, the resolution of the canvas tanks. both of these get fixed by reloading for the most part, the exception is that for the second bug, the raster brushstroke still looks a bit more blurry. Didn't notice any new bugs from this though, so that's good. If these issues are easy to fix we can do them, but probably no need to hold back 1.0.2 for these. |
This resolves issue #95 and hopefully issue Weird UI Glitch. For the brush tool, zooming out messes up the size attributes of Wick's
canvaselement: the width/height attributes of the canvas become scaled down from the true width and height. But the brush tool'scanvasuses the smaller width/height attributes as it true size, which is why the brush strokes keep getting cut off.For the fill bucket, I have no idea why the solution works