Fixed widgets sticking to cursor (#3143)

This commit is contained in:
Kavin Venkatachalam 2022-05-28 06:44:50 +05:30 committed by GitHub
parent 8a7a1d21ad
commit 30a4dc9949
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -232,11 +232,13 @@ export const Container = ({
for (const selectedComponent of selectedComponents) {
newBoxes = produce(newBoxes, (draft) => {
const topOffset = draft[selectedComponent.id].layouts[currentLayout].top;
const leftOffset = draft[selectedComponent.id].layouts[currentLayout].left;
if (draft[selectedComponent.id]) {
const topOffset = draft[selectedComponent.id].layouts[currentLayout].top;
const leftOffset = draft[selectedComponent.id].layouts[currentLayout].left;
draft[selectedComponent.id].layouts[currentLayout].top = topOffset - topDiff;
draft[selectedComponent.id].layouts[currentLayout].left = leftOffset - leftDiff;
draft[selectedComponent.id].layouts[currentLayout].top = topOffset - topDiff;
draft[selectedComponent.id].layouts[currentLayout].left = leftOffset - leftDiff;
}
});
}