Add full page scroll overlap setting

The default of 0.1 keeps 10% of a page visible on a full-page scroll.

Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
Jonas Hoersch 2012-09-15 13:33:41 +02:00 committed by Sebastian Ramacher
parent 269580c513
commit d76e33e3ec
2 changed files with 7 additions and 2 deletions

View file

@ -145,6 +145,8 @@ config_load_default(zathura_t* zathura)
girara_setting_add(gsession, "scroll-step", &float_value, FLOAT, false, _("Scroll step"), NULL, NULL);
float_value = -1;
girara_setting_add(gsession, "scroll-hstep", &float_value, FLOAT, false, _("Horizontal scroll step"), NULL, NULL);
float_value = 0.1;
girara_setting_add(gsession, "scroll-full-overlap", &float_value, FLOAT, false, _("Full page scroll overlap"), NULL, NULL);
int_value = 10;
girara_setting_add(gsession, "zoom-min", &int_value, INT, false, _("Zoom minimum"), NULL, NULL);
int_value = 1000;

View file

@ -563,6 +563,9 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
if (scroll_hstep < 0) {
scroll_hstep = scroll_step;
}
float scroll_full_overlap = 0.1;
girara_setting_get(session, "scroll-full-overlap", &scroll_full_overlap);
int padding = 1;
girara_setting_get(session, "page-padding", &padding);
@ -571,11 +574,11 @@ sc_scroll(girara_session_t* session, girara_argument_t* argument,
switch(argument->n) {
case FULL_UP:
case FULL_LEFT:
new_value = value - view_size - padding;
new_value = value - (1.0 - scroll_full_overlap) * view_size - padding;
break;
case FULL_DOWN:
case FULL_RIGHT:
new_value = value + view_size + padding;
new_value = value + (1.0 - scroll_full_overlap) * view_size + padding;
break;
case HALF_UP:
case HALF_LEFT: