make grid-scroll-focused center the focused column
This commit is contained in:
@@ -216,7 +216,7 @@ function initActions(world: World) {
|
||||
}
|
||||
const column = focusedWindow.column;
|
||||
const grid = column.grid;
|
||||
grid.scrollToColumn(column);
|
||||
grid.scrollCenterColumn(column);
|
||||
grid.arrange();
|
||||
},
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ const keyBindings: KeyBinding[] = [
|
||||
},
|
||||
{
|
||||
"name": "grid-scroll-focused",
|
||||
"description": "Scroll to focused window",
|
||||
"description": "Center focused window",
|
||||
"defaultKeySequence": "Meta+Alt+Return",
|
||||
"action": "gridScrollFocused",
|
||||
},
|
||||
|
||||
@@ -153,6 +153,12 @@ class Grid {
|
||||
}
|
||||
}
|
||||
|
||||
scrollCenterColumn(column: Column) {
|
||||
const windowCenter = column.gridX + column.width / 2 + this.world.config.gapsInnerHorizontal - this.scrollX; // in screen space
|
||||
const screenCenter = this.tilingArea.x + this.tilingArea.width / 2;
|
||||
this.adjustScroll(Math.round(windowCenter - screenCenter), false);
|
||||
}
|
||||
|
||||
autoAdjustScroll() {
|
||||
const focusedWindow = this.world.getFocusedWindow();
|
||||
if (focusedWindow === null) {
|
||||
|
||||
Reference in New Issue
Block a user