Column: remove moveAfter

This commit is contained in:
Peter Fajdiga
2024-07-08 12:04:24 +02:00
parent 4e3d924366
commit fdb4b88333
3 changed files with 7 additions and 11 deletions

View File

@@ -148,13 +148,13 @@ namespace Actions {
case "column-move-start": return () => {
world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, grid) => {
column.moveAfter(null);
grid.moveColumn(column, null);
});
};
case "column-move-end": return () => {
world.doIfTiledFocused(true, (clientManager, desktopManager, window, column, grid) => {
column.moveAfter(grid.getLastColumn());
grid.moveColumn(column, grid.getLastColumn());
});
};
@@ -287,9 +287,9 @@ namespace Actions {
return;
}
if (targetColumn.isAfter(column)) {
column.moveAfter(targetColumn);
grid.moveColumn(column, targetColumn);
} else {
column.moveAfter(grid.getPrevColumn(targetColumn));
grid.moveColumn(column, grid.getPrevColumn(targetColumn));
}
});
};

View File

@@ -30,13 +30,6 @@ class Column {
}
}
public moveAfter(prevColumn: Column|null) {
if (prevColumn === this) {
return;
}
this.grid.moveColumn(this, prevColumn);
}
public isAfter(other: Column) {
return this.gridX > other.gridX;
}

View File

@@ -25,6 +25,9 @@ class Grid {
}
public moveColumn(column: Column, prevColumn: Column|null) {
if (column === prevColumn) {
return;
}
const movedLeft = prevColumn === null ? true : column.isAfter(prevColumn);
const firstMovedColumn = movedLeft ? column : this.getNextColumn(column);
this.columns.move(column, prevColumn);