Comments (6)
Hi @hupe13,
if I toggle all chart legend filter off, the polyline is black. Example.
It should be the intended behavior (somehow related to: #235).
If I comment out these lines
leaflet-elevation/src/control.js
Lines 919 to 922 in ea15556
it works for me too.
Actually, the following should be the real cause:
leaflet-elevation/src/control.js
Lines 912 to 913 in ea15556
Your example works as expected.
Probably not implemented on canvas layers:
where CSS rules must be transposed into JS code, eg: L.Control.Elevation::_fixCanvasPaths()
👋 Raruto
from leaflet-elevation.
Hi Raruto,
after setting map.options.preferCanvas = true;
it works now.
Thank you very much.
from leaflet-elevation.
There are many (other) problems with setting map.options.preferCanvas = true;
in my WordPress plugin.
Actually, the following should be the real cause:
leaflet-elevation/src/control.js
Lines 912 to 913 in ea15556
Yes, it should be:
// toggle layer visibility on empty chart
this._layers.eachLayer(layer => layer.getElement && this._chartEnabled && this.options.polyline.className && _.toggleClass(layer.getElement && layer.getElement(), this.options.polyline.className + ' ' + this.options.theme, this._chartEnabled));
`
from leaflet-elevation.
@hupe13 umph, some additional code explanation would help (it's somewhat a cryptic condition).
Also, if you feel you have the time: 👉 gifcap.dev (just to show the before/after to others).
👋 Raruto
from leaflet-elevation.
The problem in my first post was about the black polyline when all legend filters are turned off. You told me two possibilities to solve the problem:
- setting preferCanvas: true
- the line 913 in /src/control.js
First, I set map.options.preferCanvas = true;
and it seemed to work. Today I know, it works with the default theme colors only. I have some options in my WordPress plugin that allow to change the colors. And if the user does this, this solution does not work. So I analyzed the line 913 and I found the solution above. I changed this corresponding line in my repository. Additionally I must set preferCanvas
to false
and now it works for non default theme colors also.
from leaflet-elevation.
Hi Raruto,
I changed this:
leaflet-elevation/src/control.js
Line 913 in bd9316b
this._layers.eachLayer(layer => layer.getElement && this._chartEnabled && this.options.polyline.className && _.toggleClass(layer.getElement && layer.getElement(), this.options.polyline.className + ' ' + this.options.theme, this._chartEnabled));
I tested it with your example using custom colors. You can see, it works. Toggle Altitude on and off.
from leaflet-elevation.
Related Issues (20)
- Android: Pointer on elevation graph HOT 2
- Change decimal and thousands separator HOT 4
- Updating a track continuously (live tracking) HOT 3
- Unsopperted GeoJSON feature geometry type:Point HOT 1
- Download link HOT 1
- How to show Elevation in decimal? HOT 3
- Marker tooltip with negative elevation HOT 1
- Polyline layer turns black after turning off all legend filters on custom colors HOT 4
- Disable built-in lazy loader (dynamic imports) and load all dependencies statically HOT 8
- Leaflet elevation get track properties (Length, Elevation, time, etc) HOT 1
- Unable to Display Elevation Chart in Angular Project with leaflet-elevation HOT 6
- {{track_info}} not always correctly build HOT 5
- Angular and leaflet-elevation HOT 1
- Elevation profile for drawn line using Leaflet Drawn polyline HOT 2
- How to sort `L.gpxGroup` tracks in alphabetical order? HOT 8
- [How to] hide track on map | 100% chart width | dynamically change gpx data HOT 8
- hotline and linearGradient HOT 2
- [How to] get a callback when file gpx is loaded? HOT 3
- ruler on leaflet-elevation_hoverable-tracks.html HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaflet-elevation.