mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-26 03:26:41 +07:00
finally saving things
This commit is contained in:
parent
e0f5d0238a
commit
47e4f4a97d
22 changed files with 277 additions and 38 deletions
|
@ -168,16 +168,17 @@ export class Editor {
|
|||
this.changeMode(MODES.NONE);
|
||||
};
|
||||
|
||||
setData = ({ route, stickers, format = 'old', owner }) => {
|
||||
setData = ({ route, stickers, version = 1, owner }) => {
|
||||
console.log('setting?', stickers);
|
||||
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 }),
|
||||
stickers.map(sticker => this.stickers.createSticker({
|
||||
latlng: sticker.latlng,
|
||||
angle: parseStickerAngle({ sticker, version }),
|
||||
sticker: parseStickerStyle({ sticker, version }),
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -185,7 +186,11 @@ export class Editor {
|
|||
this.owner = owner;
|
||||
}
|
||||
|
||||
this.map.map.fitBounds(this.poly.poly.getBounds());
|
||||
if (!route || route.length <= 1) return;
|
||||
|
||||
const bounds = this.poly.poly.getBounds();
|
||||
|
||||
if (Object.values(bounds)) this.map.map.fitBounds(bounds);
|
||||
};
|
||||
|
||||
startEditing = () => {
|
||||
|
@ -194,5 +199,10 @@ export class Editor {
|
|||
|
||||
stopEditing = () => {
|
||||
this.poly.poly.disableEdit();
|
||||
}
|
||||
};
|
||||
|
||||
dumpData = () => ({
|
||||
route: this.poly.dumpData(),
|
||||
stickers: this.stickers.dumpData(),
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue