Nokia Here JavaScript API disables pinch zoom in i

2019-07-22 19:00发布

问题:

I've just started using the Nokia Here API and it works great, but I've noticed that the maps disable pinch zoom on iOS, on both iPhone and iPad.

Here's an example: http://seemann.com/mapsample/

Works fine across most browsers on a desktop, but pinch zooming is not possible on iOS. (Haven't tested on Android.) This happens even when I turn off the Behavior component.

Thoughts?

回答1:

A basic pinch zoom functionality does exist in the HERE Maps API for Javascript - you just need to include the Behavior component as shown.

var map = new nokia.maps.map.Display(mapContainer, {
    // initial center and zoom level of the map
    center: [52.51, 13.4],
    zoomLevel: 10,
    components: [
        // We add the behavior component to allow panning / zooming of the map
        new nokia.maps.map.component.Behavior()]
});

To take a couple of examples

  • Basic Map Components on developer.here.net
  • Headline news story from CNN News

If you don't include Behavior zoom will not work - here is an example

  • Basic Map - no Behavior on developer.here.net

I've just tested the examples using an iPad and they work fine for me.

According to the browser support matrix the API will work on Safari 5+ and iOS 4+