@raruto/leaflet-elevation 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -13
- package/dist/leaflet-elevation.js +17 -16
- package/dist/leaflet-elevation.js.map +1 -1
- package/dist/leaflet-elevation.min.js +1 -1
- package/dist/leaflet-elevation.min.js.map +1 -1
- package/package.json +1 -1
- package/src/components.js +4 -2
- package/src/control.js +1 -1
- package/src/marker.js +15 -15
package/package.json
CHANGED
package/src/components.js
CHANGED
|
@@ -116,9 +116,11 @@ export const PositionMarker = ({
|
|
|
116
116
|
}) => {
|
|
117
117
|
return g => {
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
g.attr("class", "height-focus-group");
|
|
120
|
+
|
|
121
|
+
let line = g.select('.height-focus.line');
|
|
120
122
|
let circle = g.select('.height-focus.circle-lower');
|
|
121
|
-
let text
|
|
123
|
+
let text = g.select('.height-focus-label');
|
|
122
124
|
|
|
123
125
|
if (!line.node()) line = g.append('svg:line');
|
|
124
126
|
if (!circle.node()) circle = g.append('svg:circle');
|
package/src/control.js
CHANGED
|
@@ -17,7 +17,7 @@ export const Elevation = L.Control.Elevation = L.Control.extend({
|
|
|
17
17
|
__TOGEOJSON: 'https://unpkg.com/@tmcw/togeojson@4.5.0/dist/togeojson.umd.js',
|
|
18
18
|
__LGEOMUTIL: 'https://unpkg.com/leaflet-geometryutil@0.9.3/src/leaflet.geometryutil.js',
|
|
19
19
|
__LALMOSTOVER: 'https://unpkg.com/leaflet-almostover@1.0.1/src/leaflet.almostover.js',
|
|
20
|
-
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.9.
|
|
20
|
+
__LDISTANCEM: 'https://unpkg.com/@raruto/leaflet-elevation@1.9.3/libs/leaflet-distance-marker.min.js',
|
|
21
21
|
|
|
22
22
|
/*
|
|
23
23
|
* Add data to the diagram either from GPX or GeoJSON and update the axis domain and data
|
package/src/marker.js
CHANGED
|
@@ -10,8 +10,6 @@ export var Marker = L.Class.extend({
|
|
|
10
10
|
switch(this.options.marker) {
|
|
11
11
|
case 'elevation-line':
|
|
12
12
|
// this._container = d3.create("g").attr("class", "height-focus-group");
|
|
13
|
-
this._container = d3.select(map.getPane('elevationPane')).select("svg > g")
|
|
14
|
-
.attr("class", "height-focus-group");
|
|
15
13
|
break;
|
|
16
14
|
case 'position-marker':
|
|
17
15
|
// this._marker = L.circleMarker([0, 0], { pane: 'overlayPane', radius: 6, fillColor: '#fff', fillOpacity:1, color: '#000', weight:1, interactive: false });
|
|
@@ -27,7 +25,7 @@ export var Marker = L.Class.extend({
|
|
|
27
25
|
addTo: function(map) {
|
|
28
26
|
this._map = map;
|
|
29
27
|
switch(this.options.marker) {
|
|
30
|
-
case 'elevation-line': this._container.call(D3.PositionMarker({}));
|
|
28
|
+
case 'elevation-line': this._container = d3.select(map.getPane('elevationPane')).select("svg > g").call(D3.PositionMarker({})); break;
|
|
31
29
|
case 'position-marker': this._marker.addTo(map, { pane: 'overlayPane' }); break;
|
|
32
30
|
}
|
|
33
31
|
return this;
|
|
@@ -49,18 +47,20 @@ export var Marker = L.Class.extend({
|
|
|
49
47
|
|
|
50
48
|
switch(this.options.marker) {
|
|
51
49
|
case 'elevation-line':
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
if (this._container) {
|
|
51
|
+
let point = this._map.latLngToLayerPoint(this._latlng);
|
|
52
|
+
point = L.extend({}, props.item, this._map._rotate ? this._map.rotatedPointToMapPanePoint(point) : point);
|
|
53
|
+
|
|
54
|
+
this._container.classed("leaflet-hidden", false);
|
|
55
|
+
this._container.call(D3.PositionMarker({
|
|
56
|
+
theme : this.options.theme,
|
|
57
|
+
xCoord: point.x,
|
|
58
|
+
yCoord: point.y,
|
|
59
|
+
length: point.y - (this._height() / props.maxElevation * point.z), // normalized Y
|
|
60
|
+
labels: this._labels,
|
|
61
|
+
item: point
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
64
|
break;
|
|
65
65
|
case 'position-marker':
|
|
66
66
|
_.removeClass(this._marker.getElement(), 'leaflet-hidden');
|