Update the geo-data-exchange dependency with support for gradient normalization

This commit is contained in:
alexcojocaru 2023-12-09 22:09:23 -08:00 committed by Gautier P
parent bd1fe58dbf
commit 135340781d
3 changed files with 28 additions and 5 deletions

View file

@ -167,7 +167,30 @@ BR.Heightgraph = function (map, layersControl, routing, pois) {
} else {
$('#no-elevation-data').hide();
}
var geojsonFeatures = geoDataExchange.buildGeojsonFeatures(track.getLatLngs());
var chartWidth;
if (document.getElementsByClassName('heightgraph-container').length > 0) {
var hgElement = document.getElementsByClassName('heightgraph-container')[0];
if (hgElement.getElementsByTagName('g').length > 0) {
hgGElement = hgElement.getElementsByTagName('g')[0];
if (hgGElement.getElementsByClassName('grid').length > 1) {
hgGRectElement = hgGElement.getElementsByClassName('grid')[1];
chartWidth = hgGRectElement.getBoundingClientRect().width;
}
}
}
// if I cannot get the chart width (e.g. the chart is not visible),
// get the width of the content element - that's close enough
if (typeof chartWidth === 'undefined' || chartWidth === 0) {
var contentElement = document.getElementById('content');
if (contentElement) {
chartWidth = contentElement.getBoundingClientRect().width;
}
}
var geojsonFeatures = geoDataExchange.buildGeojsonFeatures(track.getLatLngs(), {
interpolate: false,
normalize: true,
chartWidthInPixels: chartWidth,
});
this.addData(geojsonFeatures);
// re-add handlers

View file

@ -54,7 +54,7 @@
"datatables": "1.10.18",
"fit-file-writer": "tbsmark86/fit-file-writer#3eebe13",
"font-awesome": "4.7.0",
"geo-data-exchange": "alexcojocaru/geo-data-exchange#v2.0.0",
"geo-data-exchange": "alexcojocaru/geo-data-exchange#v2.1.0",
"i18next": "19.9.2",
"i18next-browser-languagedetector": "7.0.2",
"i18next-xhr-backend": "3.2.2",

View file

@ -5632,9 +5632,9 @@ gensync@^1.0.0-beta.2:
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
geo-data-exchange@alexcojocaru/geo-data-exchange#v2.0.0:
version "2.0.0"
resolved "https://codeload.github.com/alexcojocaru/geo-data-exchange/tar.gz/f3964028483ce194700f98c3d9c241818b54062b"
geo-data-exchange@alexcojocaru/geo-data-exchange#v2.1.0:
version "2.1.0"
resolved "https://codeload.github.com/alexcojocaru/geo-data-exchange/tar.gz/aa1a0bc98f0b3f7233ea3dcbc038bf46a99702d9"
dependencies:
leaflet "^1.5.0"