mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-01 21:07:40 +08:00
[gcs] Fix map canvas center function double move
This commit is contained in:
@@ -391,10 +391,11 @@ object (self)
|
|||||||
canvas#scroll_to (truncate xc) (truncate yc)
|
canvas#scroll_to (truncate xc) (truncate yc)
|
||||||
|
|
||||||
method center = fun wgs84 ->
|
method center = fun wgs84 ->
|
||||||
self#moveto wgs84;
|
let (xw, yw) = self#world_of wgs84 in
|
||||||
let sx_w, sy_w = Gdk.Drawable.get_size canvas#misc#window
|
let (xc, yc) = canvas#world_to_window xw yw in
|
||||||
and (x, y) = canvas#get_scroll_offsets in
|
let (xt, yt) = ((truncate xc), (truncate yc)) in
|
||||||
canvas#scroll_to (x-sx_w/2) (y-sy_w/2)
|
let sx_w, sy_w = Gdk.Drawable.get_size canvas#misc#window in
|
||||||
|
canvas#scroll_to (xt-sx_w/2) (yt-sy_w/2)
|
||||||
|
|
||||||
method get_center = fun () ->
|
method get_center = fun () ->
|
||||||
let (x, y) = canvas#get_scroll_offsets
|
let (x, y) = canvas#get_scroll_offsets
|
||||||
|
|||||||
Reference in New Issue
Block a user