diff --git a/src/lib/layout/Column.ts b/src/lib/layout/Column.ts index 7eb4e7c..82eea30 100644 --- a/src/lib/layout/Column.ts +++ b/src/lib/layout/Column.ts @@ -19,7 +19,7 @@ class Column { public moveToGrid(targetGrid: Grid, prevColumn: Column|null) { if (targetGrid === this.grid) { - this.grid.onColumnMoved(this, prevColumn); + this.grid.moveColumn(this, prevColumn); } else { this.grid.onColumnRemoved(this, false); this.grid = targetGrid; @@ -34,7 +34,7 @@ class Column { if (prevColumn === this) { return; } - this.grid.onColumnMoved(this, prevColumn); + this.grid.moveColumn(this, prevColumn); } public isAfter(other: Column) { diff --git a/src/lib/layout/Grid.ts b/src/lib/layout/Grid.ts index d3e3b64..e34bdf8 100644 --- a/src/lib/layout/Grid.ts +++ b/src/lib/layout/Grid.ts @@ -24,6 +24,15 @@ class Grid { }); } + public moveColumn(column: Column, prevColumn: Column|null) { + const movedLeft = prevColumn === null ? true : column.isAfter(prevColumn); + const firstMovedColumn = movedLeft ? column : this.getNextColumn(column); + this.columns.move(column, prevColumn); + this.columnsSetX(firstMovedColumn); + this.desktop.onLayoutChanged(); + this.desktop.autoAdjustScroll(); + } + public moveColumnLeft(column: Column) { this.columns.moveBack(column); this.columnsSetX(column); @@ -180,15 +189,6 @@ class Grid { } } - public onColumnMoved(column: Column, prevColumn: Column|null) { - const movedLeft = prevColumn === null ? true : column.isAfter(prevColumn); - const firstMovedColumn = movedLeft ? column : this.getNextColumn(column); - this.columns.move(column, prevColumn); - this.columnsSetX(firstMovedColumn); - this.desktop.onLayoutChanged(); - this.desktop.autoAdjustScroll(); - } - public onColumnWidthChanged(column: Column) { const nextColumn = this.columns.getNext(column); this.columnsSetX(nextColumn);