如何设置最大变焦 [英] How to set max zoom

查看:66
本文介绍了如何设置最大变焦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我注意到在较旧版本的API中,在nokia.maps.map.Display下有一个maxZoomLevel.但是,我在JS API 3.0中找不到与此类似的东西.

So I noticed in the older version of the API there was a maxZoomLevel under nokia.maps.map.Display. However I can not find anything similar to this in the JS API 3.0.

当前我正在使用

map.addEventListener('mapviewchange', function () {
    var zoom=map.getZoom();
    if(zoom<=maxZoom)  {
        map.setZoom(maxZoom)
    }
});

但是一旦它碰到了maxZoom并且您将其缩小得更多时,它会变得非常不稳定,因为它会缩小一点,然后将其设置回maxZoom.有更好的方法吗?

But once it hits the maxZoom and you zoom out more it is very choppy since it zooms out a bit then I set it back to maxZoom. Is there any better way of doing this?

推荐答案

您可以设置图层的最大缩放比例,如下所示的方法应该起作用

You can set the max zoom for the layer, something like follow should work

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

var map = new H.Map(mapContainer,
  defaultLayers.normal.map,{
  center: {lat:39.2328, lng:9.01168},
});

这篇关于如何设置最大变焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆