mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
better mouse hinting and ability to drop all markers on polyline
This commit is contained in:
parent
16308996e1
commit
bbd7d6a89a
1 changed files with 23 additions and 1 deletions
|
@ -45,6 +45,28 @@ class InteractivePoly extends Polyline {
|
||||||
this.startDragHinting();
|
this.startDragHinting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setLatLngs = (latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][]) => {
|
||||||
|
super.setLatLngs(latlngs);
|
||||||
|
|
||||||
|
if (this.is_drawing) {
|
||||||
|
// update mouse hinter on latlngs change
|
||||||
|
const constraints = this.constrLine.getLatLngs() as LatLng[];
|
||||||
|
const source = latlngs && latlngs.length > 0 &&
|
||||||
|
this.drawing_direction === 'forward'
|
||||||
|
? latlngs[latlngs.length - 1]
|
||||||
|
: latlngs[0];
|
||||||
|
|
||||||
|
if (!constraints || constraints.length < 2 || !source) {
|
||||||
|
this.setConstraints([]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setConstraints([constraints[0], source as LatLng]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
updateTouchHinter = ({ latlngs }: { latlngs: LatLngLiteral[] }): void => {
|
updateTouchHinter = ({ latlngs }: { latlngs: LatLngLiteral[] }): void => {
|
||||||
this.touchHinter.setLatLngs(latlngs);
|
this.touchHinter.setLatLngs(latlngs);
|
||||||
};
|
};
|
||||||
|
@ -474,7 +496,7 @@ class InteractivePoly extends Polyline {
|
||||||
const index = this.markers.indexOf(target);
|
const index = this.markers.indexOf(target);
|
||||||
const latlngs = this.getLatLngs();
|
const latlngs = this.getLatLngs();
|
||||||
|
|
||||||
if (typeof index === 'undefined' || latlngs.length <= 2) return;
|
if (typeof index === 'undefined' || latlngs.length == 0) return;
|
||||||
|
|
||||||
this.dropMarkerDistanceChange(index);
|
this.dropMarkerDistanceChange(index);
|
||||||
this._map.removeLayer(this.markers[index]);
|
this._map.removeLayer(this.markers[index]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue