Fixed bug that caused incorrect layout being repositioned

This commit is contained in:
navaneeth 2021-06-03 22:29:29 +05:30
parent 4700063eef
commit baeeca9702
2 changed files with 7 additions and 7 deletions

View file

@ -93,7 +93,7 @@ export const Container = ({
}
let layouts = item['layouts'];
const currentLayoutOptions = layouts ? layouts[currentLayout] : {};
const currentLayoutOptions = layouts ? layouts[item.currentLayout] : {};
let componentData = {};
let componentMeta = {};
@ -129,8 +129,8 @@ export const Container = ({
...boxes[id],
layouts: {
...boxes[id]['layouts'],
[currentLayout]: {
...boxes[id]['layouts'][currentLayout],
[item.currentLayout]: {
...boxes[id]['layouts'][item.currentLayout],
top: top,
left: left,
}
@ -165,7 +165,7 @@ export const Container = ({
[id]: {
component: componentData,
layouts: {
[currentLayout]: {
[item.currentLayout]: {
top: top,
left: left,
width: componentMeta.defaultSize.width,
@ -291,7 +291,7 @@ export const Container = ({
configHandleClicked,
removeComponent,
currentLayout,
scaleValue
scaleValue
}}
/>
}

View file

@ -79,13 +79,13 @@ export const DraggableBox = function DraggableBox({
() => ({
type: ItemTypes.BOX,
item: {
id, title, component, zoomLevel, parent, layouts
id, title, component, zoomLevel, parent, layouts, currentLayout
},
collect: (monitor) => ({
isDragging: monitor.isDragging()
})
}),
[id, title, component, index, zoomLevel, parent, layouts]
[id, title, component, index, zoomLevel, parent, layouts, currentLayout]
);
useEffect(() => {