Google Maps Disable user panning on all events

前端 未结 3 889
灰色年华
灰色年华 2020-12-29 04:35

In my google maps application I have a follow method which follows a moving marker. When it is following I want to allow zooming through all the usual methods (dblclick, dbl

3条回答
  •  抹茶落季
    2020-12-29 05:08

    While it's possible to argue that double-clicking the map or wheel-zooming the map need not take account of the mouse location (because you are acting on the map object rather than a location on the map), pinch-to-zoom is always location-dependent because you physically stretch or squash the map around a location. To alter that behaviour would be distinctly unintuitive.

    In this case you should listen for zoom_changed or idle and then pan the map to recentre it, so the user can see what's going on.

    You could even use those events to handle the default double-click or mousewheel behaviour so that it's obvious you are changing the level of control the user normally has.

提交回复
热议问题