From 2ef4bc3af6a9e3e33491e4372eaa000ffe4c91e3 Mon Sep 17 00:00:00 2001 From: viglino Date: Thu, 14 Dec 2023 09:56:54 +0100 Subject: [PATCH] [UPD] --- examples/control/map.switcher.image.html | 2 +- examples/storymap/map.control.timeinterval.html | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/control/map.switcher.image.html b/examples/control/map.switcher.image.html index 410cdcbc..67be97f4 100644 --- a/examples/control/map.switcher.image.html +++ b/examples/control/map.switcher.image.html @@ -78,7 +78,7 @@

ol-ext: Layerswitcher image

var vector = new ol.layer.Vector({ name: '1914-18', - preview: "http://www.culture.gouv.fr/Wave/image/memoire/2445/sap40_z0004141_v.jpg", + preview: '//wsrv.nl/?url=http://www.culture.gouv.fr/Wave/image/memoire/2445/sap40_z0004141_v.jpg', source: vectorSource }); diff --git a/examples/storymap/map.control.timeinterval.html b/examples/storymap/map.control.timeinterval.html index 14c41c69..828fd32e 100644 --- a/examples/storymap/map.control.timeinterval.html +++ b/examples/storymap/map.control.timeinterval.html @@ -113,6 +113,9 @@

ol-ext: Timeline control

var cache = {}; function style(select){ return function(f) { + // Is hidden + if (!f.get('visible')) return []; + // Display feature on the map var style = cache[f.get('img')+'-'+select]; if (!style) { var img = new ol.style.Photo({ @@ -126,7 +129,8 @@

ol-ext: Timeline control

onload: function() { f.changed(); } }) style = cache[f.get('img')+'-'+select] = new ol.style.Style({ - image: img + image: img, + zIndex: select ? 1 : 0 }) } return style; @@ -189,10 +193,10 @@

ol-ext: Timeline control

// Filter features visibility vectorSource.getFeatures().forEach(function(f) { var date = new Date(f.get('date')); - if (datee.dateEnd) { - f.setStyle([]); + if (date < e.dateStart || date > e.dateEnd) { + f.set('visible', false) } else { - f.setStyle(); + f.set('visible', true) } }); }); @@ -207,7 +211,7 @@

ol-ext: Timeline control

tline.setDate(f.get('date')); // Show info var info = $("#select").html(""); - $("").attr('src',f.get("img")).appendTo(info); + $("").attr('src', '//wsrv.nl/?url=' + f.get("img")).appendTo(info); $("

").text(f.get("text")).appendTo(info); $("

").text(f.get("commune")+" ("+f.get("region")+" - " + (new Date(f.get("date"))).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'})