read and use scrolling configuration

This commit is contained in:
Peter Fajdiga
2023-12-05 22:15:49 +01:00
parent 2bd000f0a6
commit e7d33030ba
5 changed files with 22 additions and 3 deletions

View File

@@ -12,6 +12,8 @@ type Config = {
resizeNeighborColumn: boolean,
reMaximize: boolean,
skipSwitcher: boolean,
scrollingLazy: boolean,
scrollingCentered: boolean,
tiledKeepBelow: boolean,
floatingKeepAbove: boolean,
windowRules: string,

View File

@@ -117,6 +117,16 @@ const configDef = [
"type": "Bool",
"default": false
},
{
"name": "scrollingLazy",
"type": "Bool",
"default": true
},
{
"name": "scrollingCentered",
"type": "Bool",
"default": false
},
{
"name": "tiledKeepBelow",
"type": "Bool",

View File

@@ -8,7 +8,6 @@ class Desktop {
private dirtyPins: boolean;
public clientArea: QRect;
public tilingArea: QRect;
public readonly scroller: Desktop.Scroller = new ScrollerLazy();
constructor(desktopNumber: number, pinManager: PinManager, config: Desktop.Config, layoutConfig: LayoutConfig) {
this.pinManager = pinManager;
@@ -104,7 +103,11 @@ class Desktop {
return;
}
this.scroller.focusColumn(this, focusedColumn);
this.focusColumn(focusedColumn);
}
public focusColumn(column: Column) {
this.config.scroller.focusColumn(this, column);
}
private getVisibleRange(scrollX: number) {
@@ -190,6 +193,7 @@ namespace Desktop {
marginLeft: number,
marginRight: number,
overscroll: number,
scroller: Desktop.Scroller,
};
export type Range = {

View File

@@ -277,7 +277,7 @@ class Grid {
lastFocusedColumn.restoreToTiled();
}
this.lastFocusedColumn = column;
this.desktop.scroller.focusColumn(this.desktop, column);
this.desktop.focusColumn(column);
}
public onScreenSizeChanged() {

View File

@@ -29,6 +29,9 @@ class World {
marginLeft: config.gapsOuterLeft,
marginRight: config.gapsOuterRight,
overscroll: config.overscroll,
scroller: config.scrollingLazy ? new ScrollerLazy() :
config.scrollingCentered ? new ScrollerCentered() :
console.assert(false),
},
{
gapsInnerHorizontal: config.gapsInnerHorizontal,