Raruto / leaflet-elevation

Leaflet plugin that allows to add elevation profiles using d3js
GNU General Public License v3.0
255 stars 85 forks source link

Add missing icons for closeBtn #192

Closed hupe13 closed 2 years ago

hupe13 commented 2 years ago

match the color of the themes

hupe13 commented 2 years ago

Ignore the commits, see only the changed files. I did something wrong.

In README.md you should write:

// closeBtn: true || false
Raruto commented 2 years ago

Thanks for the contribution, in this regard I think that we could handle all the possible variations with a single svg file (e.g. via a css variable passed to an svg file?), essentially it isn't always the same shape but filled with different colors?

Raruto commented 2 years ago

Check if something is missing from version 2.2.3

https://github.com/Raruto/leaflet-elevation/commit/5a88a70d316bc985f42b3fe3b54dab0fd9ef20f1

hupe13 commented 2 years ago

Please change the line https://github.com/Raruto/leaflet-elevation/blob/13fc8023be4a537616f371f112478859b739ee25/src/control.js#L26 to consider the valid url of the file elevation.svg. The files leaflet-elevation.js resp. leaflet-elevation.min.js are in an extra directory "dist" of my installation. So this works for me: __btnIcon: document.currentScript.src+'/../../images/elevation.svg', But this is not true for all.

Thank you very much.

Raruto commented 2 years ago

Although they are "private attributes", there are already several ways to accomplish this:

L.Control.Elevation.include({
  __btnIcon: document.currentScript.src + '/../../images/elevation.svg',
  __modulesFolder: document.currentScript.src + '/../../src/handlers/',
});
L.Control.Elevation.prototype.__btnIcon = document.currentScript.src + '/../../images/elevation.svg';
L.Control.Elevation.prototype.__modulesFolder = document.currentScript.src + '/../../src/handlers/';
L.Control.Elevation.addInitHook(function() {
  this.__btnIcon = document.currentScript.src + '/../../images/elevation.svg';
  this.__modulesFolder = document.currentScript.src + '/../../src/handlers/';
});

Reference:

hupe13 commented 2 years ago

Thank you very much! Now this works.