diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-03-11 17:55:38 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-03-11 17:55:38 +0100 |
commit | 9871808ec9cf2b569ebd24caa78925cd63a646cd (patch) | |
tree | a8737efb0b1e4249d4a7957cc4d08c0737777c22 | |
parent | eb8f529d4145c9b9afba499f7604c0aebdcb4b0f (diff) | |
download | Chimère-9871808ec9cf2b569ebd24caa78925cd63a646cd.tar.bz2 Chimère-9871808ec9cf2b569ebd24caa78925cd63a646cd.zip |
JS: fix bad cache for clustering
-rw-r--r-- | chimere/static/chimere/js/jquery.chimere.js | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 65c8819..032e6f1 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -1154,6 +1154,13 @@ function transformCoordToLonLat(coord) { } methods._activateEdition(map_id, new_edition_type); }, + reinitClustering: function(map_id){ + settings[map_id].clusterSource.getSource().clear(); + settings[map_id]._styleCache = {}; + settings[map_id]._remindOldStyle = {}; + settings[map_id]._remindUpdated = {}; + settings[map_id]._currentRemind = -1; + }, enableClustering: function(map_id){ // Style clusters and hide items inside clusters settings[map_id]._styleCache = {}; @@ -1654,7 +1661,7 @@ function transformCoordToLonLat(coord) { settings[map_id].dbFeatures.clear(); settings[map_id].vectors.clear(); if (settings[map_id].enable_clustering){ - settings[map_id].clusterSource.getSource().clear(); + methods.reinitClustering(map_id); } if (!data.features) data.features = []; if (data.zoom_need_reload){ @@ -1710,7 +1717,7 @@ function transformCoordToLonLat(coord) { settings[map_id].dbFeatures.clear(); settings[map_id].vectors.clear(); if (settings[map_id].enable_clustering){ - settings[map_id].clusterSource.getSource().clear(); + methods.reinitClustering(map_id); } }, /* @@ -2003,23 +2010,21 @@ function transformCoordToLonLat(coord) { return settings[map_id].iconStyles[i]; } } - if (!iconStyle){ - var icon_url = MEDIA_URL + properties.icon_path; - var size = [properties.icon_width, properties.icon_height]; - var anchor = [properties.icon_offset_x, - properties.icon_offset_y]; - var iconStyle = new ol.style.Style({ - image: new ol.style.Icon({ - anchor: anchor, - anchorXUnits: 'pixels', - anchorYUnits: 'pixels', - src: icon_url, - size: size - }) - }); - settings[map_id].iconStyles[properties.icon_path] = iconStyle; - return iconStyle; - } + var icon_url = MEDIA_URL + properties.icon_path; + var size = [properties.icon_width, properties.icon_height]; + var anchor = [properties.icon_offset_x, + properties.icon_offset_y]; + var iconStyle = new ol.style.Style({ + image: new ol.style.Icon({ + anchor: anchor, + anchorXUnits: 'pixels', + anchorYUnits: 'pixels', + src: icon_url, + size: size + }) + }); + settings[map_id].iconStyles[properties.icon_path] = iconStyle; + return iconStyle; }, _getExtraIconStyle: function(map_id, extra_icons){ var extra_icons_style; |