From f6e4a66ddd7a860e2915d5ac006c4576c50200ec Mon Sep 17 00:00:00 2001 From: malc Date: Fri, 27 Jan 2012 04:46:58 +0400 Subject: [PATCH] Fix zoomrect when default view is zoomed out --- main.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.ml b/main.ml index 6c590b3..4f4b8e5 100644 --- a/main.ml +++ b/main.ml @@ -4073,7 +4073,12 @@ let zoomrect x y x1 y1 = gotoy (state.y + y0); state.anchor <- getanchor (); let zoom = (float conf.winw *. conf.zoom) /. float (x1 - x0) in - state.x <- state.x - x0; + let margin = + if state.w < conf.winw - state.scrollw + then (conf.winw - state.scrollw - state.w) / 2 + else 0 + in + state.x <- margin - state.x - x0; setzoom zoom; Glut.setCursor Glut.CURSOR_INHERIT; state.mstate <- Mnone; -- 2.11.4.GIT