scribble.rs icon indicating copy to clipboard operation
scribble.rs copied to clipboard

Cursor size incorrect when scaling

Open Bios-Marcel opened this issue 3 years ago • 0 comments

I am somewhat confused as to how I am supposed to scale correctly. When zooming out, you get more virtual pixels, but the lines won't get any smaller due to the fact the canvas gets bigger as well. Meaning that each line will simply take up more pixels than it would usually. Meaning that not scaling the cursor at all would look correct in this scenario.

Now in the opposite case, if we zoom in, we get less pixels, resulting in having to draw smaller lines. This means the cursor actually has to shrink.

However, not only the zoom factor, but also the backend size of the canvas is relevant for sizing the cursor. However, if you are have a very screen, like a 4k screen, you'll have way more pixels and no zoom. In this scenario, you'll actually run into the problem the mouse cursor can't be correctly sized due to browser virtual limitations.

I don't really know how to solve this with the current way of setting the cursor. The solution could potentially be to manually draw the cursor instead, so that we can get around the limit.

Another option would be to hard-limit the canvas size to 1600x900 virtual pixels. In this case, only downscaling would have to be handled.

Bios-Marcel avatar Apr 14 '21 20:04 Bios-Marcel