mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: set height correctly when text properties updated while editing in container until first submit (#4469)
* fix: set height correctly when text properties updated while editing in container * rename PADDING to BOUND_TEXT_PADDING
This commit is contained in:
parent
bf2bca221e
commit
ef62390841
6 changed files with 62 additions and 31 deletions
|
@ -24,7 +24,7 @@ import { getResizedElementAbsoluteCoords } from "./bounds";
|
|||
import { measureText } from "./textElement";
|
||||
import { isBoundToContainer } from "./typeChecks";
|
||||
import Scene from "../scene/Scene";
|
||||
import { PADDING } from "../constants";
|
||||
import { BOUND_TEXT_PADDING } from "../constants";
|
||||
|
||||
type ElementConstructorOpts = MarkOptional<
|
||||
Omit<ExcalidrawGenericElement, "id" | "type" | "isDeleted" | "updated">,
|
||||
|
@ -219,11 +219,11 @@ const getAdjustedDimensions = (
|
|||
const container = Scene.getScene(element)!.getElement(element.containerId)!;
|
||||
let height = container.height;
|
||||
let width = container.width;
|
||||
if (nextHeight > height - PADDING * 2) {
|
||||
height = nextHeight + PADDING * 2;
|
||||
if (nextHeight > height - BOUND_TEXT_PADDING * 2) {
|
||||
height = nextHeight + BOUND_TEXT_PADDING * 2;
|
||||
}
|
||||
if (nextWidth > width - PADDING * 2) {
|
||||
width = nextWidth + PADDING * 2;
|
||||
if (nextWidth > width - BOUND_TEXT_PADDING * 2) {
|
||||
width = nextWidth + BOUND_TEXT_PADDING * 2;
|
||||
}
|
||||
if (height !== container.height || width !== container.width) {
|
||||
mutateElement(container, { height, width });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue