Commit 295d0bd4 authored by jonnybradley's avatar jonnybradley

[ENH] maps: Add ZoomSlider and make coordinates work properly (although i'm...

[ENH] maps: Add ZoomSlider and make coordinates work properly (although i'm not convinced that's really the right projection for our maps)
Also define them all before the map constructor instead of adding them afterwards.
parent b36d9535
Pipeline #72118264 passed with stages
in 60 minutes and 49 seconds
......@@ -455,13 +455,45 @@
setTimeout(function () {
ol.ImgPath = "lib/openlayers/theme/dark/";
var controls = ol.control.defaults({
// zoom control is added by default, so remove it if not needed
zoom: $.inArray('controls', desiredControls) !== -1
});
if ($.inArray('coordinates', desiredControls) !== -1) {
controls.push(new ol.control.MousePosition({
projection: "EPSG:4326",
coordinateFormat: function (coordinate) {
return ol.coordinate.format(coordinate, '{y}, {x}', 4);
}
})
);
}
if ($.inArray('scale', desiredControls) !== -1) {
controls.push(new ol.control.ScaleLine());
}
if ($.inArray('levels', desiredControls) !== -1) {
controls.push(new ol.control.ZoomSlider());
}
/* no navbar, pan or layer switcher anymore?
if (layers.length > 0 && -1 !== $.inArray('navigation', desiredControls)) {
defaultMode.controls.push(new ol.control.NavToolbar());
}
if (layers.length > 1 && -1 !== $.inArray('layers', desiredControls)) {
map.addControl(new ol.control.LayerSwitcher());
}
*/
var map = container.map = new ol.Map({
target: id,
controls: ol.control.defaults({
attributionOptions: /** @type {ol.control.AttributionOptions} */ ({
collapsible: false
})
}),
controls: controls,
view: new ol.View({
center: [0, 0],
zoom: 2
......@@ -763,36 +795,6 @@
controls: []
};
map.addControl(new ol.control.Attribution());
if (-1 !== $.inArray('coordinates', desiredControls)) {
map.addControl(new ol.control.MousePosition({
displayProjection: new ol.proj.Projection("EPSG:4326")
}));
}
if (layers.length > 0 && -1 !== $.inArray('scale', desiredControls)) {
map.addControl(new ol.control.ScaleLine());
}
/* no navbar, pan or layer switcher anymore?
if (layers.length > 0 && -1 !== $.inArray('navigation', desiredControls)) {
defaultMode.controls.push(new ol.control.NavToolbar());
}
if (layers.length > 0 && -1 !== $.inArray('controls', desiredControls)) {
if (-1 !== $.inArray('levels', desiredControls)) {
map.addControl(new ol.control.PanZoomBar());
} else {
map.addControl(new ol.control.PanZoom());
}
}
if (layers.length > 1 && -1 !== $.inArray('layers', desiredControls)) {
map.addControl(new ol.control.LayerSwitcher());
}
*/
var $mapBootstrapDummy = $("<div>")
.attr("id", "map-tooltip")
.css("position", "absolute")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment