mirror of
https://github.com/gosticks/PaperWM.git
synced 2026-07-09 02:20:02 +00:00
prefs: Hook up sensitivity and friction spinners
This commit is contained in:
@@ -152,7 +152,7 @@ function done(space) {
|
||||
let startGlide = space.targetX;
|
||||
|
||||
// timetravel
|
||||
let accel = .3/16; // px/ms^2
|
||||
let accel = prefs.swipe_friction[0]/16; // px/ms^2
|
||||
accel = space.vx > 0 ? -accel : accel;
|
||||
let t = -space.vx/accel;
|
||||
let d = space.vx*t + .5*accel*t**2;
|
||||
@@ -335,11 +335,12 @@ function endVertical() {
|
||||
return false;
|
||||
}
|
||||
|
||||
let friction = 0.05;
|
||||
let dy = vy*16;
|
||||
let v = vy;
|
||||
let accel = prefs.swipe_friction[1];
|
||||
accel = v > 0 ? -accel : accel;
|
||||
updateVertical(dy, time + 16);
|
||||
vy = vy + (v > 0 ? -0.1 : 0.1);
|
||||
vy = vy + accel;
|
||||
return true; // repeat
|
||||
};
|
||||
|
||||
|
||||
23
prefs.js
23
prefs.js
@@ -96,6 +96,29 @@ class SettingsWidget {
|
||||
this._settings.set_int('vertical-margin-bottom', bottomMargin.get_value());
|
||||
});
|
||||
|
||||
let vSens = this.builder.get_object('vertical-sensitivity');
|
||||
let hSens = this.builder.get_object('horizontal-sensitivity');
|
||||
let [sx, sy] = this._settings.get_value('swipe-sensitivity').deep_unpack();
|
||||
hSens.set_value(sx);
|
||||
vSens.set_value(sy);
|
||||
let sensChanged = () => {
|
||||
this._settings.set_value('swipe-sensitivity', new GLib.Variant('ad', [hSens.get_value(), vSens.get_value()]));
|
||||
};
|
||||
vSens.connect('value-changed', sensChanged);
|
||||
hSens.connect('value-changed', sensChanged);
|
||||
|
||||
|
||||
let vFric = this.builder.get_object('vertical-friction');
|
||||
let hFric = this.builder.get_object('horizontal-friction');
|
||||
let [fx, fy] = this._settings.get_value('swipe-friction').deep_unpack();
|
||||
hFric.set_value(fx);
|
||||
vFric.set_value(fy);
|
||||
let fricChanged = () => {
|
||||
this._settings.set_value('swipe-friction', new GLib.Variant('ad', [hFric.get_value(), vFric.get_value()]));
|
||||
};
|
||||
vFric.connect('value-changed', fricChanged);
|
||||
hFric.connect('value-changed', fricChanged);
|
||||
|
||||
let onlyScratch = this.builder.get_object('only-scratch-in-overview');
|
||||
onlyScratch.state =
|
||||
this._settings.get_boolean('only-scratch-in-overview');
|
||||
|
||||
Reference in New Issue
Block a user