mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
forwards and backwards drawing
This commit is contained in:
parent
bbd7d6a89a
commit
ad676d5fde
11 changed files with 119 additions and 21 deletions
|
@ -45,9 +45,7 @@ class InteractivePoly extends Polyline {
|
|||
this.startDragHinting();
|
||||
}
|
||||
|
||||
setLatLngs = (latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][]) => {
|
||||
super.setLatLngs(latlngs);
|
||||
|
||||
updateConstraintsToLatLngs = (latlngs: LatLngExpression[]) => {
|
||||
if (this.is_drawing) {
|
||||
// update mouse hinter on latlngs change
|
||||
const constraints = this.constrLine.getLatLngs() as LatLng[];
|
||||
|
@ -63,6 +61,12 @@ class InteractivePoly extends Polyline {
|
|||
|
||||
this.setConstraints([constraints[0], source as LatLng]);
|
||||
}
|
||||
}
|
||||
|
||||
setLatLngs = (latlngs: LatLngExpression[] | LatLngExpression[][] | LatLngExpression[][][]) => {
|
||||
super.setLatLngs(latlngs);
|
||||
|
||||
this.updateConstraintsToLatLngs(latlngs as LatLngExpression[]);
|
||||
|
||||
return this;
|
||||
};
|
||||
|
@ -492,6 +496,11 @@ class InteractivePoly extends Polyline {
|
|||
this.constrLine.setLatLngs(coords);
|
||||
};
|
||||
|
||||
setDirection = (direction: 'forward' | 'backward') => {
|
||||
this.drawing_direction = direction;
|
||||
this.updateConstraintsToLatLngs(this.getLatLngs() as LatLngExpression[]);
|
||||
}
|
||||
|
||||
dropMarker = ({ target }: LeafletMouseEvent): void => {
|
||||
const index = this.markers.indexOf(target);
|
||||
const latlngs = this.getLatLngs();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue