fix: update viewport coords correctly when editing text (#4416)
This commit is contained in:
parent
ff1d7728a0
commit
c2a8712593
@ -1916,7 +1916,10 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
},
|
},
|
||||||
this.state,
|
this.state,
|
||||||
);
|
);
|
||||||
return [viewportX, viewportY];
|
return [
|
||||||
|
viewportX - this.state.offsetLeft,
|
||||||
|
viewportY - this.state.offsetTop,
|
||||||
|
];
|
||||||
},
|
},
|
||||||
onChange: withBatchedUpdates((text) => {
|
onChange: withBatchedUpdates((text) => {
|
||||||
updateElement(text, text, false, !element.containerId);
|
updateElement(text, text, false, !element.containerId);
|
||||||
|
@ -426,10 +426,10 @@ export const textWysiwyg = ({
|
|||||||
if (isTextElement(updateElement) && updateElement.containerId) {
|
if (isTextElement(updateElement) && updateElement.containerId) {
|
||||||
if (editable.value) {
|
if (editable.value) {
|
||||||
mutateElement(updateElement, {
|
mutateElement(updateElement, {
|
||||||
y,
|
y: y + appState.offsetTop,
|
||||||
height: Number(editable.style.height.slice(0, -2)),
|
height: Number(editable.style.height.slice(0, -2)),
|
||||||
width: Number(editable.style.width.slice(0, -2)),
|
width: Number(editable.style.width.slice(0, -2)),
|
||||||
x,
|
x: x + appState.offsetLeft,
|
||||||
});
|
});
|
||||||
const boundTextElementId = getBoundTextElementId(container);
|
const boundTextElementId = getBoundTextElementId(container);
|
||||||
if (!boundTextElementId || boundTextElementId !== element.id) {
|
if (!boundTextElementId || boundTextElementId !== element.id) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user