diff --git a/src/pods/toolbar/components/export-button/export-button.business.ts b/src/pods/toolbar/components/export-button/export-button.business.ts index 765b62f7..8f7fd991 100644 --- a/src/pods/toolbar/components/export-button/export-button.business.ts +++ b/src/pods/toolbar/components/export-button/export-button.business.ts @@ -92,10 +92,10 @@ export const placeTableWithoutOverlap = ( ): TableVm => { let newTable = table; let attempts = 0; - + while ( doesTableOverlap(newTable, tables) && - attempts < TABLE_CONST.MAX_PLACEMENT_ATTEMPTS + attempts < TABLE_CONST.MAX_PLACEMENT_ATTEMPTS ) { newTable = { ...newTable, @@ -113,6 +113,12 @@ export const placeTableWithoutOverlap = ( attempts++; } + // If relocated table still overlaps, restore original posotion. + if ((newTable.width) && (newTable.width > TABLE_CONST.TABLE_SHIFT_DISTANCE) && doesTableOverlap(newTable, tables)) { + newTable.x = table.x; + newTable.y = table.y; + } + return newTable; };