Ma[gic][dness]

This commit is contained in:
malc 2013-02-17 17:15:10 +04:00
parent 2c121f79dd
commit 761271fac0

35
main.ml
View file

@ -6988,24 +6988,31 @@ let ract cmds =
match cl with
| "reload" :: [] -> reload ()
| "goto" :: args :: [] ->
let cmd, _ = state.geomcmds in
scan args "%u %f %f"
(fun pageno x y ->
onpagerect pageno (fun w h ->
let top = y /. h in
let _,w1,_,leftx = getpagedim pageno in
let sw = float w1 /. w in
let x = sw *. x in
let x = leftx + state.x + truncate x in
let newpan =
if x < 0 || x >= state.winw - state.scrollw
then (state.x <- state.x - x; true)
else false
in
let y, h = getpageyh pageno in
let y = y + (truncate (top *. float h)) in
let dy = y - state.y in
if newpan || not (dy > 0 && dy < state.winh - state.hscrollh)
then gotoy y
if String.length cmd = 0
then (
let _,w1,_,leftx = getpagedim pageno in
let sw = float w1 /. w in
let x = sw *. x in
let x = leftx + state.x + truncate x in
let newpan =
if x < 0 || x >= state.winw - state.scrollw
then (state.x <- state.x - x; true)
else false
in
let y, h = getpageyh pageno in
let y = y + (truncate (top *. float h)) in
let dy = y - state.y in
if newpan || not (dy > 0 && dy < state.winh - state.hscrollh)
then gotoy y
)
else (
state.anchor <- pageno, top /. h, 0.0
)
)
)
| "goto1" :: args :: [] -> scan args "%u %f" gotopage