mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-11-27 16:08:38 +03:00
* fix(editor): stop centered text lines jittering while typing The text editor was placed by `left`/`top` and zoomed by a scale transform. Browsers round a scaled element's layout offset to whole pixels, so as a center- or right-aligned text grows (moving the editor by fractions of a pixel) its other lines shifted by up to 1px per keystroke at any zoom other than 100%. Place the editor by the transform's translate instead, which is kept exact. * fix(editor): stop the other lines' glyphs shimmering while typing - Anchor the editor's transform at the text's alignment point (origin 0 0), so it doesn't move while typing; only the box's own anchor (a whole or half px) changes. - Give non-wrapping editors a whole-px width, so the browser's rounding of each line's centering offset stays constant. Wrapping editors keep their exact width, where the canvas wraps the text too. - Grow the editor's box to its text when a font's glyphs overflow it, so the browser doesn't scroll the text to reveal the caret on each keystroke (which shifted the other lines). * test(editor): update the text editor style snapshot for its new placement