fix: update elbow arrow on font size change #8798 (#9002)

This commit is contained in:
Alplune 2025-01-26 00:00:26 +08:00 committed by GitHub
parent 49f1276ef2
commit b8da5065fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -89,6 +89,7 @@ import type {
FontFamilyValues,
TextAlign,
VerticalAlign,
NonDeletedSceneElementsMap,
} from "../element/types";
import { getLanguage, t } from "../i18n";
import { KEYS } from "../keys";
@ -115,6 +116,7 @@ import {
bindPointToSnapToElementOutline,
calculateFixedPointForElbowArrowBinding,
getHoveredElementForBinding,
updateBoundElements,
} from "../element/binding";
import { LinearElementEditor } from "../element/linearElementEditor";
import type { LocalPoint } from "../../math";
@ -218,8 +220,7 @@ const changeFontSize = (
) => {
const newFontSizes = new Set<number>();
return {
elements: changeProperty(
const updatedElements = changeProperty(
elements,
appState,
(oldElement) => {
@ -240,11 +241,26 @@ const changeFontSize = (
return newElement;
}
return oldElement;
},
true,
),
);
// Update arrow elements after text elements have been updated
const updatedElementsMap = arrayToMap(updatedElements);
getSelectedElements(elements, appState, {
includeBoundTextElement: true,
}).forEach((element) => {
if (isTextElement(element)) {
updateBoundElements(
element,
updatedElementsMap as NonDeletedSceneElementsMap,
);
}
});
return {
elements: updatedElements,
appState: {
...appState,
// update state only if we've set all select text elements to