Comments (8)
Commenting out this line fixes the initial crash, but I don't know what it's purpose is so I guess there may be other side effects to doing so?
That is the svg
group (line + label + text) displayed when the mouse hovers the graph.
If there is existing GeoJSON data in the control and the
clear()
method is called, this error appears.
Could you also provide a concrete example? (in v1.0.6 i've fixed another problem related to empty draggings, but i havent found anything about what you say)
from leaflet-elevation.
Thanks for your prompt reply. I think I've figured it out - it's my own fault because I'm using your excellent control in a more "creative" way.
The _clearPath()
method is failing in my instance, because the control is bound to an existing and more complex GeoJSON path layer (bound with addData()
), not your default path created by the control using one of the methods like loadGeoJSON()
. Therefore it appears the control is trying to hide a path that doesn't exist, or is incomplete..
The loop at line 93 It deletes a single layer successfully for the overlay (appears over the path when the chart is hovered over), but then fails on the next layer, which I presume is the path itself?
My workaround solution is to call just the private method _clearData()
instead of the public method clear()
, so _clearPath()
(and _clearChart()
) are never called.
from leaflet-elevation.
it's my own fault because I'm using your excellent control in a more "creative" way.
As you can see the addData()
function is already public, there is nothing strange in using it.
The loop at line 93 It deletes a single layer successfully for the overlay (appears over the path when the chart is hovered over), but then fails on the next layer, which I presume is the path itself?
Which loop are you referring to?
This example shows more or less the behavior you described.
from leaflet-elevation.
Sorry, that should be 983
_clearPath: function() {
this._hidePositionMarker();
for (let id in this._layers) {
L.DomUtil.removeClass(this._layers[id]._path, this.options.polyline.className);
L.DomUtil.removeClass(this._layers[id]._path, this.options.theme);
}
}
In the debugger it loops twice, crashing on the second iteration.
from leaflet-elevation.
In the debugger it loops twice, crashing on the second iteration.
I would not be wrong, but that loop should only run once per geoJSON track.
Basically it should remove these css classes to the map path:
<path class="elevation-polyline lightblue-theme"></path>
from leaflet-elevation.
Here's my theory for what it's worth!
In the Fiddle the GeoJSON layer has no custom events or styling. The mouseover event triggers an overlay on the line, which you indicated earlier is the layer than clear is trying to remove the class from?
If there is custom events/styling (as in mine), this layer doesn't appear when the mouse is over the path because the default mouseover event has been overridden. That's fine as It still appears when there is a mouseover on the graph. but maybe _focusG hasn't been created, or the class not applied?
Therefore when trying to clean up without checking first that it exists, we get the error. Looks like that's all it needs to do,
from leaflet-elevation.
Without a concrete example it is difficult to know ...
from leaflet-elevation.
True. Not a big deal as far as I am concerned, because the workaround works OK. I just thought it might help someone else who might encounter the same problem.
If you're interested, www.britainbybike.com (not currently complete or 24/7)
from leaflet-elevation.
Related Issues (20)
- Large parts of leaflet-holtine are black HOT 13
- Integration with Bootstrap framework (v3.3.7) HOT 2
- Omitting the `<ele>` tag in gpx file throws Uncaught DOMException: CanvasGradient.addColorStop: Invalid color HOT 2
- GDPR compliance - usage without unpkg.com HOT 8
- Skip distance in chart between multiple tracks HOT 7
- Hide file url and encrypt gpx data HOT 9
- How to add the Download button to a gpxGroup map HOT 2
- Android: Pointer on elevation graph HOT 2
- Change decimal and thousands separator HOT 4
- Polyline layer turns black after turning off all legend filters (`legend: true` + `preferCanvas: false`) HOT 6
- 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
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.