I am trying to add custom zoom buttons to a Microsoft Map that I am instantiating in a constructor function.
function Planner(options, $mapPanel) {
this.settings = $.extend(true, {}, options);
this.$panel = $mapPanel;
this.map = new Microsoft.Maps.Map($panel, this.settings.map);
}
The default map settings include a default zoom level, center location, and disabling the logo and dashboard.
Instantiation of the map works well. It loads correctly and zoom on scroll and panning are functioning as expected.
var planner = new Planner(options, $mapPanel);
The problem is that planner.map.setView() is not working correctly. When I call planner.map.setView({ zoom: 8 })
nothing happens, but if I change the center of my map to a different location zoom via setView starts working again. For example, this works:
planner.map.setView({ center: someCompletelyNewLoc });
planner.map.setView({ center: myOldLoc });
planner.map.setView({ zoom: newZoomLevel });
I can't figure out what is going wrong here. Any ideas?
P.s. This is my first post, so let me know if this code/explanation is too brief/simple.