router now properly handles poly changes

This commit is contained in:
Fedor Katurov 2018-08-16 15:39:54 +07:00
parent e477f50283
commit 245b559e2d
3 changed files with 40 additions and 4 deletions

View file

@ -12,9 +12,9 @@ export class Editor {
}) {
this.map = new Map({ container });
const { lockMapClicks, map: { map } } = this;
const { lockMapClicks, routerMoveStart, map: { map } } = this;
this.poly = new Poly({ map: this.map.map });
this.poly = new Poly({ map, routerMoveStart });
this.stickers = new Stickers({ map, lockMapClicks });
this.router = new Router({ map, lockMapClicks });
@ -88,4 +88,10 @@ export class Editor {
this.router.startFrom(latlngs.pop());
};
routerMoveStart = () => {
const { _latlngs } = this.poly.poly;
if (_latlngs) this.router.moveStart(_latlngs[_latlngs.length-1]);
}
}