first import attempts

This commit is contained in:
muerwre 2018-08-29 12:05:09 +07:00
parent 8da254ff9b
commit f7e8da1f1f
9 changed files with 57 additions and 6 deletions

View file

@ -6,6 +6,8 @@ import { Router } from '$modules/Router';
import { Shotter } from '$modules/Shotter';
import { DEFAULT_LOGO } from '$constants/logos';
import { parseStickerAngle, parseStickerStyle } from '$utils/import';
export class Editor {
constructor({
container,
@ -165,4 +167,19 @@ export class Editor {
this.setLogo(logo);
this.changeMode(MODES.NONE);
}
setData = ({ route, stickers, format = 'old' }) => {
if (route) {
this.poly.setPoints(route);
}
if (stickers) {
stickers.map(({ latlng, ang: angle, style }) => this.stickers.createSticker({
latlng,
angle: parseStickerAngle({ angle, format }),
sticker: parseStickerStyle({ style, format }),
}));
}
this.map.map.fitBounds(this.poly.poly.getBounds());
}
}