JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.18.2/ol-debug.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/3.18.2/ol-debug.js"></script>
<div id="map" class="map"></div>
JavaScript
var map = new ol.Map({
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2
}),
interactions: ol.interaction.defaults({
dragPan: false
})
});
map.addInteraction(new ol.interaction.DragPan({
condition: function(event) {
return event.originalEvent.ctrlKey
}
}));