mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: horizontal text alignment for bound text when resizing (#5721)
* Update textElement.ts * Add test * don't use modifier keys when not needed Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
parent
4cb6f09559
commit
b477c2ad6b
4 changed files with 113 additions and 41 deletions
|
@ -174,7 +174,12 @@ export const handleBindTextResize = (
|
|||
} else {
|
||||
updatedY = element.y + element.height / 2 - nextHeight / 2;
|
||||
}
|
||||
const updatedX = element.x + element.width / 2 - nextWidth / 2;
|
||||
const updatedX =
|
||||
textElement.textAlign === TEXT_ALIGN.LEFT
|
||||
? element.x + BOUND_TEXT_PADDING
|
||||
: textElement.textAlign === TEXT_ALIGN.RIGHT
|
||||
? element.x + element.width - nextWidth - BOUND_TEXT_PADDING
|
||||
: element.x + element.width / 2 - nextWidth / 2;
|
||||
mutateElement(textElement, {
|
||||
text,
|
||||
width: nextWidth,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue