mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix arrow label rotation bug
This commit is contained in:
parent
af8d4e12be
commit
5a4c1fb6b5
2 changed files with 35 additions and 32 deletions
|
@ -351,7 +351,10 @@ export const getTextElementAngle = (
|
||||||
textElement: ExcalidrawTextElement,
|
textElement: ExcalidrawTextElement,
|
||||||
container: ExcalidrawTextContainer | null,
|
container: ExcalidrawTextContainer | null,
|
||||||
) => {
|
) => {
|
||||||
if (!container || isArrowElement(container)) {
|
if (isArrowElement(container)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (!container) {
|
||||||
return textElement.angle;
|
return textElement.angle;
|
||||||
}
|
}
|
||||||
return container.angle;
|
return container.angle;
|
||||||
|
|
|
@ -5352,15 +5352,11 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
y: sceneY,
|
y: sceneY,
|
||||||
});
|
});
|
||||||
|
|
||||||
const element = existingTextElement
|
const element =
|
||||||
? existingTextElement
|
existingTextElement ||
|
||||||
: newTextElement({
|
newTextElement({
|
||||||
x: parentCenterPosition
|
x: parentCenterPosition ? parentCenterPosition.elementCenterX : sceneX,
|
||||||
? parentCenterPosition.elementCenterX
|
y: parentCenterPosition ? parentCenterPosition.elementCenterY : sceneY,
|
||||||
: sceneX,
|
|
||||||
y: parentCenterPosition
|
|
||||||
? parentCenterPosition.elementCenterY
|
|
||||||
: sceneY,
|
|
||||||
strokeColor: this.state.currentItemStrokeColor,
|
strokeColor: this.state.currentItemStrokeColor,
|
||||||
backgroundColor: this.state.currentItemBackgroundColor,
|
backgroundColor: this.state.currentItemBackgroundColor,
|
||||||
fillStyle: this.state.currentItemFillStyle,
|
fillStyle: this.state.currentItemFillStyle,
|
||||||
|
@ -5380,7 +5376,11 @@ class App extends React.Component<AppProps, AppState> {
|
||||||
containerId: shouldBindToContainer ? container?.id : undefined,
|
containerId: shouldBindToContainer ? container?.id : undefined,
|
||||||
groupIds: container?.groupIds ?? [],
|
groupIds: container?.groupIds ?? [],
|
||||||
lineHeight,
|
lineHeight,
|
||||||
angle: container?.angle ?? (0 as Radians),
|
angle: container
|
||||||
|
? isArrowElement(container)
|
||||||
|
? (0 as Radians)
|
||||||
|
: container.angle
|
||||||
|
: (0 as Radians),
|
||||||
frameId: topLayerFrame ? topLayerFrame.id : null,
|
frameId: topLayerFrame ? topLayerFrame.id : null,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue