mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
added ability to clear router/poly
This commit is contained in:
parent
f2c9cc4abc
commit
7fc53444a8
4 changed files with 23 additions and 3 deletions
|
@ -16,6 +16,8 @@ export class EditorPanel extends React.PureComponent {
|
||||||
|
|
||||||
startShotterMode = () => this.props.editor.changeMode(MODES.SHOTTER);
|
startShotterMode = () => this.props.editor.changeMode(MODES.SHOTTER);
|
||||||
|
|
||||||
|
clearAll = () => this.props.editor.clearAll();
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker
|
mode, routerPoints, editor, totalDistance, estimateTime, activeSticker
|
||||||
|
@ -90,14 +92,13 @@ export class EditorPanel extends React.PureComponent {
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className={classnames({ active: mode === MODES.TRASH })}
|
className={classnames({ active: mode === MODES.TRASH })}
|
||||||
onClick={this.startShotterMode}
|
onClick={this.clearAll}
|
||||||
>
|
>
|
||||||
<Icon icon="icon-trash" />
|
<Icon icon="icon-trash" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="highlighted"
|
className="highlighted"
|
||||||
onClick={this.startShotterMode}
|
|
||||||
>
|
>
|
||||||
<span>СХОРОНИТЬ</span>
|
<span>СХОРОНИТЬ</span>
|
||||||
<Icon icon="icon-save" />
|
<Icon icon="icon-save" />
|
||||||
|
|
|
@ -128,4 +128,11 @@ export class Editor {
|
||||||
this.activeSticker = sticker;
|
this.activeSticker = sticker;
|
||||||
this.setActiveSticker(sticker);
|
this.setActiveSticker(sticker);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clearAll = () => {
|
||||||
|
this.poly.clearAll();
|
||||||
|
this.router.clearAll();
|
||||||
|
|
||||||
|
this.changeMode(MODES.NONE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,14 @@ export class Poly {
|
||||||
];
|
];
|
||||||
|
|
||||||
this.poly.setLatLngs(summary);
|
this.poly.setLatLngs(summary);
|
||||||
|
this.poly.enableEdit();
|
||||||
|
this.poly.editor.reset();
|
||||||
|
this.updateMarks();
|
||||||
|
};
|
||||||
|
|
||||||
|
clearAll = () => {
|
||||||
|
this.poly.setLatLngs([]);
|
||||||
|
this.poly.disableEdit();
|
||||||
this.updateMarks();
|
this.updateMarks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,8 +127,12 @@ export class Router {
|
||||||
const { coordinates } = route;
|
const { coordinates } = route;
|
||||||
this.pushPolyPoints(coordinates);
|
this.pushPolyPoints(coordinates);
|
||||||
const waypoints = this.router.getWaypoints().filter(({ latLng }) => !!latLng);
|
const waypoints = this.router.getWaypoints().filter(({ latLng }) => !!latLng);
|
||||||
this.router.setWaypoints(waypoints[waypoints.length-1]);
|
this.router.setWaypoints(waypoints[waypoints.length - 1]);
|
||||||
|
|
||||||
// this.changeMode(MODES.POLY);
|
// this.changeMode(MODES.POLY);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
clearAll = () => {
|
||||||
|
this.router.setWaypoints([]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue