I want to zoom to an area selected by drawing a box on the map following this example:
http://openlayers.org/en/latest/examples/box-selection.html
Working fine. Now I want to change the line color and background of the box. Some examples have this code (edited to show all my working CSS changes but ol-dragbox
):
<style>
.ol-overviewmap {
bottom: 30px !important;
}
.ol-control button {
font-size : 18px;
}
.ol-zoomslider {
top : 5.5em;
}
.ol-dragbox {
background-color: rgba(255,255,255,0.4);
border-color: rgba(100,150,0,1);
}
.ol-scale-line {
background: rgba(0, 60, 136, 0.5);
padding: 2px;
}
</style>
... it is changing all classes but not ol-dragbox
.
I'm curious because in this example I can't see anything adding this kind of behaviour ( zoom to box ) and nor in my map even it is working well:
My map:
map = new ol.Map({
layers: [ landLayer, routesLayer ],
target: 'map',
renderer: 'canvas',
loadTilesWhileAnimating: true,
loadTilesWhileInteracting: true,
controls: ol.control.defaults().extend([
new ol.control.ScaleLine(),
new ol.control.ZoomSlider(),
new ol.control.MousePosition({
undefinedHTML: '',
projection: 'EPSG:4326',
coordinateFormat: function(coordinate) {
return ol.coordinate.format(coordinate, '{y}, {x}', 4);
}
})
]),
view: theView
});
I not added any control or interaction to create this zoom-to-box feature.
Inspecting the OpenLayers CSS file ( v3.15 ) I can't find any style to .ol-dragbox
. Where this blue box came from and how can I change it?