I want to add the functionality of switching the option to pan the map and put it in a checkbox. But I'm not quite sure how I can do that.
The reason I want to do this is: I have a layer which displays features and has a select and hover control. So there's no way to pan the map, because the clickEvent
triggers direct action from the Handlers (click,hover). I want to add a checkbox where I can activate/deactivate the possibility to pan the map, so I can pan the map when there are features present, which normally would trigger a reaction to the mouseover the feature.
The way I've tried to do it is this one but it didn't work. I attached the function to the checkbox but it never worked.
function allowPan() {
if(panAct == false){
highlightCtrl.activate();
selectedControl.activate();
alert("controls activated!!")
panAct = true;
}
if(panAct == true){
highlightCtrl.deactivate();
selectedControl.deactivate();
alert("controls deactivated!!");
panAct = false;
}
}