cursorless icon indicating copy to clipboard operation
cursorless copied to clipboard

Hat vertical alignment varies with font size

Open pokey opened this issue 2 years ago • 2 comments

I haven't personally observed this, but from @AndreasArvidsson:

I think I found a bug with our hats vertical alignment code. We calculate the vertical alignment based on the default font size. https://github.com/cursorless-dev/cursorless/blob/a79254cc6bbe13727a9cac01d8291e618460afd3/packages/cursorless-vscode/src/ide/vscode/hats/VscodeHatRenderer.ts#L369 This means that if you increase the size of the hats the vertical alignment becomes different. I've done a few experiments and the alignment of curve changes depending on the size of the hats

Original size image (7)

"cursorless.hatSizeAdjustment": 5, image (8)

Because our alignment is based on EM/% but we do not actually calculate it on the size of the actual hat. If you make the hat larger, but still have the same offset in pixels it's center is of course going to move

pokey avatar Nov 10 '23 12:11 pokey

The following code is what we have to try to fix the above problem, but apparently it isn't working as intended. - hatHeightPx / 2;

AndreasArvidsson avatar Nov 11 '23 10:11 AndreasArvidsson

update from meet-up: this wasn't reproducible on a higher resolution screen, so may be due to VSCode rasterization algorithm, which is something we've seen oddnesses with in the past. Keeping this open for now because @AndreasArvidsson would like to check the math at some point, but not an urgent priority

pokey avatar Jan 09 '24 16:01 pokey