mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix coords
This commit is contained in:
parent
66ccc254f0
commit
57a700f82e
2 changed files with 11 additions and 12 deletions
|
@ -98,13 +98,15 @@ export const redrawTextBoundingBox = (
|
||||||
mutateElement(container, { height: nextHeight });
|
mutateElement(container, { height: nextHeight });
|
||||||
updateOriginalContainerCache(container.id, nextHeight);
|
updateOriginalContainerCache(container.id, nextHeight);
|
||||||
}
|
}
|
||||||
const updatedTextElement = {
|
if (!isArrowElement(container)) {
|
||||||
...textElement,
|
const updatedTextElement = {
|
||||||
...boundTextUpdates,
|
...textElement,
|
||||||
} as ExcalidrawTextElementWithContainer;
|
...boundTextUpdates,
|
||||||
const { x, y } = computeBoundTextPosition(container, updatedTextElement);
|
} as ExcalidrawTextElementWithContainer;
|
||||||
boundTextUpdates.x = x;
|
const { x, y } = computeBoundTextPosition(container, updatedTextElement);
|
||||||
boundTextUpdates.y = y;
|
boundTextUpdates.x = x;
|
||||||
|
boundTextUpdates.y = y;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mutateElement(textElement, boundTextUpdates);
|
mutateElement(textElement, boundTextUpdates);
|
||||||
|
|
|
@ -235,15 +235,12 @@ export const textWysiwyg = ({
|
||||||
}
|
}
|
||||||
// Start pushing text upward until a diff of 30px (padding)
|
// Start pushing text upward until a diff of 30px (padding)
|
||||||
// is reached
|
// is reached
|
||||||
else {
|
else if (!isArrowElement(container)) {
|
||||||
const containerCoords = getContainerCoords(container);
|
const containerCoords = getContainerCoords(container);
|
||||||
|
|
||||||
// vertically center align the text
|
// vertically center align the text
|
||||||
if (verticalAlign === VERTICAL_ALIGN.MIDDLE) {
|
if (verticalAlign === VERTICAL_ALIGN.MIDDLE) {
|
||||||
if (!isArrowElement(container)) {
|
coordY = containerCoords.y + maxHeight / 2 - textElementHeight / 2;
|
||||||
coordY =
|
|
||||||
containerCoords.y + maxHeight / 2 - textElementHeight / 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (verticalAlign === VERTICAL_ALIGN.BOTTOM) {
|
if (verticalAlign === VERTICAL_ALIGN.BOTTOM) {
|
||||||
coordY = containerCoords.y + (maxHeight - textElementHeight);
|
coordY = containerCoords.y + (maxHeight - textElementHeight);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue