So I am trying to disable the zoom option in my Map when a user clicks on a map region, using the event handlers it works well for the attributtes like color and so, but not working to disable the zoom.
/* ... */
, defaultArea: {
attrs : {
fill : "#28282b"
//, stroke: "#474c4b"
}
, attrsHover : {
fill: "#3da879"
}
, text : {
attrs : {
fill : "#6d6d6d"
}
, attrsHover : {
fill : "#fff"
}
}
,eventHandlers: {
click: function (e, id, mapElem, textElem,elemOptions) {
var newData = {
'areas': {}
,'zoom': {}
};
if (mapElem.originalAttrs.fill == "#28282b") {
newData.areas[id] = {
attrs: {
fill: "#3da879"
}
, text : {
attrs : {
fill : "#fff"
}
, attrsHover : {
fill : "#fff"
}
}
};
newData.zoom[id] = {
enabled : false,
maxLevel : 10
};
} else {
newData.areas[id] = {
attrs: {
fill: "#28282b"
}
, text : {
attrs : {
fill : "#6d6d6d"
}
, attrsHover : {
fill : "#fff"
}
}
};
}
$(".mapcontainer").trigger('update', [newData]);
}
}
/* ... */
Have you checked this JSFiddle example : http://jsfiddle.net/neveldo/ejf9dsL9/ ? It shows how to zoom on a specific area by triggering a 'zoom' event when the user click on a button :
$maparea2.trigger('zoom', {level : 10, latitude : 45.758888888889, longitude : 4.8413888888889});
If you want to disable zoom feature after, you can unbind the 'mousewheel' event on the map container.
I hope it will help you.