Skip to content

Commit

Permalink
Update the geo-data-exchange dependency with support for gradient nor…
Browse files Browse the repository at this point in the history
…malization
  • Loading branch information
alexcojocaru committed Dec 10, 2023
1 parent 89c7ff3 commit db6284e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
25 changes: 24 additions & 1 deletion js/plugin/Heightgraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5636,9 +5636,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"

Expand Down

0 comments on commit db6284e

Please sign in to comment.