Marcus Johansson
Marcus Johansson

Reputation: 158

Min and max zoom in here api

Is there any way to actually set a min and max zoom on the map that would be run before the different event types.

Right now I have tried to add a listener on mapviewchange, mapviewchangeend, mapviewchangestart that manually set's the zoom, but it's a really hacky solution that makes the screen "jump".

I've looked through the documentation, but can't really find anything. Anyone knows?

Upvotes: 2

Views: 2584

Answers (3)

user2557885
user2557885

Reputation: 69

I was able to reach a behaviour needed with

mapView.camera.limits.zoomRange = .init(kind: .zoomLevel, minimumValue: 2, maximumValue: 18)

Upvotes: 0

goblin
goblin

Reputation: 61

You can use the setMin/setMax methods on your tile layer. For example:

   var defaultLayers = platform.createDefaultLayers();  
   defaultLayers.normal.map.setMax(12); 

see also How to set max zoom

Upvotes: 0

David Leong
David Leong

Reputation: 1762

Sorry, we do not have a set of APIs to actively clip the min and max zoom.

However, on Android you can intercept the rendering thread and properly cap the zoom level without the jumping effect.

Please see MapRenderListener The method onPredraw() will callback just before the map is rendered. Here, you can get and set the zoom level and limit the zoom level as needed.

Upvotes: 0

Related Questions