Persistent Zoom controls on map

102 views
Skip to first unread message

lele

unread,
Apr 7, 2015, 2:52:57 PM4/7/15
to mapsfo...@googlegroups.com
Hi what's the proper way to have persistent zoom buttons on the screen? I had a look at (https://github.com/mapsforge/mapsforge/blob/master/mapsforge-map-android/src/main/java/org/mapsforge/map/android/input/MapZoomControls.java) and didn't see such option.

The easiest would be to edit out
private static class ZoomControlsHideHandler extends Handler {
         private final ZoomControls zoomControls;

                ZoomControlsHideHandler(ZoomControls zoomControls) {
                   super();
                       this.zoomControls = zoomControls;
              }

                @Override
              public void handleMessage(Message message) {
                   this.zoomControls.hide();
              }
      }
or
private static final long ZOOM_CONTROLS_TIMEOUT = ViewConfiguration.getZoomControlsTimeout();
but it's a bit of a hack.

Any better ideas? Anything that doesn't require messing with the code or overriding classes (future compatibility)?


thanks

Emux

unread,
Apr 7, 2015, 2:59:33 PM4/7/15
to mapsfo...@googlegroups.com
A better way would be to just put your own 2 buttons on your layout and simply call zoom in/out in them.

--
Emux
Cruiser - Atlas

lele

unread,
Apr 7, 2015, 3:21:19 PM4/7/15
to mapsfo...@googlegroups.com
cheers Emux

Emux

unread,
Apr 7, 2015, 3:23:31 PM4/7/15
to mapsfo...@googlegroups.com
On second thought we probably can use more options on zoom controls.

I opened an issue for that too.

Emux

unread,
May 27, 2015, 1:50:17 PM5/27/15
to mapsfo...@googlegroups.com
I pushed on dev the feature for zoom controls to have auto hide optional.
mapView.getMapZoomControls().setAutoHide(false);

An example of that is currently Diagnostics map viewer in Samples.

Emux

unread,
May 27, 2015, 2:24:52 PM5/27/15
to mapsfo...@googlegroups.com
I pushed also on dev customizable horizontal and vertical offsets for zoom controls.

It can be useful for better fine tuning their position on screen.
Reply all
Reply to author
Forward
0 new messages