fix: switch cursor to center of container when adding text when dimensions are too small (#4452)
This commit is contained in:
parent
081e097cef
commit
089b05db1b
@ -2066,7 +2066,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
/** whether to attempt to insert at element center if applicable */
|
/** whether to attempt to insert at element center if applicable */
|
||||||
insertAtParentCenter?: boolean;
|
insertAtParentCenter?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const parentCenterPosition =
|
let parentCenterPosition =
|
||||||
insertAtParentCenter &&
|
insertAtParentCenter &&
|
||||||
this.getTextWysiwygSnappedToCenterPosition(
|
this.getTextWysiwygSnappedToCenterPosition(
|
||||||
sceneX,
|
sceneX,
|
||||||
@ -2111,6 +2111,15 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
mutateElement(container, { height: newHeight, width: newWidth });
|
mutateElement(container, { height: newHeight, width: newWidth });
|
||||||
sceneX = container.x + newWidth / 2;
|
sceneX = container.x + newWidth / 2;
|
||||||
sceneY = container.y + newHeight / 2;
|
sceneY = container.y + newHeight / 2;
|
||||||
|
if (parentCenterPosition) {
|
||||||
|
parentCenterPosition = this.getTextWysiwygSnappedToCenterPosition(
|
||||||
|
sceneX,
|
||||||
|
sceneY,
|
||||||
|
this.state,
|
||||||
|
this.canvas,
|
||||||
|
window.devicePixelRatio,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const element = existingTextElement
|
const element = existingTextElement
|
||||||
|
Loading…
x
Reference in New Issue
Block a user