main.ml: always center, compare zoom > 0 instead of 1

This commit is contained in:
hazen2215 2023-09-20 01:11:13 +09:00
parent 2827a6c741
commit 1d67679656
1 changed files with 8 additions and 7 deletions

15
main.ml
View File

@ -1101,10 +1101,7 @@ let act cmds =
if n = 0
then (
let y = (getpagey pageno) + truncate y0 in
let x =
if (!S.x < - truncate x0) || (!S.x > !S.winw - truncate x1)
then !S.winw/2 - truncate (x0 /. 2. +. x1 /. 2.)
else !S.x
let x = !S.x
in
addnav ();
gotoxy x y;
@ -3038,7 +3035,7 @@ let setautoscrollspeed step goingdown =
let canpan () =
match conf.columns with
| Csplit _ -> true
| Csingle _ | Cmulti _ -> !S.x != 0 || conf.zoom > 1.0
| Csingle _ | Cmulti _ -> !S.x != 0 || conf.zoom > 0.0
let existsinrow pageno (columns, coverA, coverB) p =
let last = ((pageno - coverA) mod columns) + columns in
@ -3386,7 +3383,11 @@ let viewkeyboard key mask =
end
| Ascii ' ' -> nextpage ()
| Delete -> prevpage ()
| Ascii '=' -> showtext ' ' (describe_layout !S.layout);
| Ascii '=' ->
if conf.zoom = 1.0
then gotoxy 0 !S.y
else setzoom 1.0;
reqlayout conf.angle FitPage
| Ascii 'w' ->
begin match !S.layout with
| [] -> ()
@ -3417,7 +3418,7 @@ let viewkeyboard key mask =
| Ascii 'c' when !S.mode = View ->
if Wsi.withalt mask
then (
if conf.zoom > 1.0
if conf.zoom > 0.0
then
let m = (!S.winw - !S.w) / 2 in
gotoxy m !S.y