Commit be04f4c9 authored by Niels Holt's avatar Niels Holt

Allowing routeControl on all screen sizes

parent 00a94208
......@@ -42,7 +42,7 @@
* We encapsulate the changeDatetime callback in an object to produce
* a closure for overlays.
*/
function DatetimeCallback(overlays) {
function DatetimeCallback(overlays, map) {
/**
* Called when something is updated in the datetime selector. If
* type is 'datetime' all overlays with timesteps will be updated
......@@ -52,6 +52,8 @@
* @param type string
* @param arg date|boolean
*/
this.map = map;
this.changeDatetime = function (type, arg) {
var i, j, k,
layergroup,
......@@ -62,6 +64,11 @@
t,
dt;
if (type == 'datetime') {
//Bug fix: Update routeControl
if (this.map.routeControl)
this.map.routeControl.setMoment( moment(arg) );
for (i in overlays) {
layergroup = overlays[i];
for (j in layergroup) {
......@@ -283,9 +290,9 @@
)
);
//Bug fix: Hide routeControl if not on "desktop" = not using L.Control.TimeSlider
if (!desktop && map.routeControl)
$(map.routeControl._container).css('display', 'none');
//HER //Bug fix: Hide routeControl if not on "desktop" = not using L.Control.TimeSlider
//HER if (!desktop && map.routeControl)
//HER $(map.routeControl._container).css('display', 'none');
// See https://github.com/Leaflet/Leaflet/issues/5179
if (maxBounds !== undefined) {
......@@ -433,8 +440,8 @@
var dt_check = 10; // How often to check
var dt_max = 30000; // When to give up
var dt_current = 0;
var callback_obj = new DatetimeCallback(overlayMaps);
var callback = callback_obj.changeDatetime;
var callback_obj = new DatetimeCallback(overlayMaps, map);
var callback = $.proxy( callback_obj.changeDatetime, callback_obj);
function checkTimesteps() {
var dates = getTimeSteps(overlayMaps);
if ((dates !== null) && (document.readyState == "complete")) {
......
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