mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
redux: map centering from saga
This commit is contained in:
parent
5d14a753f7
commit
2f4029bbd8
3 changed files with 9 additions and 3 deletions
|
@ -220,11 +220,14 @@ export class Editor {
|
|||
|
||||
if (owner) this.owner = owner;
|
||||
|
||||
if (!route || route.length <= 1) return;
|
||||
// if (!route || route.length <= 1) return;
|
||||
};
|
||||
|
||||
fitDrawing = () => {
|
||||
if (this.poly.isEmpty()) return;
|
||||
|
||||
const bounds = this.poly.poly.getBounds();
|
||||
|
||||
if (route && bounds && Object.values(bounds)) this.map.map.fitBounds(bounds);
|
||||
if (bounds && Object.values(bounds)) this.map.map.fitBounds(bounds);
|
||||
};
|
||||
|
||||
setInitialData = () => {
|
||||
|
|
|
@ -159,4 +159,6 @@ export class Poly {
|
|||
clearArrows = () => this.arrows.clearLayers();
|
||||
|
||||
dumpData = () => this.latlngs;
|
||||
|
||||
isEmpty = () => !this.latlngs || Object.values(this.latlngs).length < 0;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,7 @@ function* mapInitSaga() {
|
|||
|
||||
if (map) {
|
||||
yield editor.setData(map);
|
||||
yield editor.fitDrawing();
|
||||
yield put(setChanged(false));
|
||||
|
||||
if (mode && mode === 'edit') {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue