Move Map
To disable map movement by dragging:
To toggle map movement by button:
Sample web page:
To disable map movement by dragging:
const maplibreMap = new maplibregl.Map({
container: "map",
zoom: 17,
dragPan: false,
});To toggle map movement by button:
const disable = "Map movement disable";
const enable = "Map movement enable";
document.querySelector("#button").onclick = function (e) {
if (e.target.innerText === disable) {
maplibreMap.dragPan.enable();
e.target.innerText = enable;
return;
}
maplibreMap.dragPan.disable();
e.target.innerText = disable;
};Sample web page:

