mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-26 03:26:41 +07:00
fixed stickers editing
This commit is contained in:
parent
f2758843bf
commit
76d6cb3717
4 changed files with 17 additions and 3 deletions
|
@ -5,10 +5,11 @@ import icons from '$sprites/icon.svg';
|
|||
import { clusterIcon } from '$utils/clusterIcon';
|
||||
|
||||
export class Stickers {
|
||||
constructor({ map, lockMapClicks, triggerOnChange }) {
|
||||
constructor({ map, lockMapClicks, triggerOnChange, editor }) {
|
||||
this.map = map;
|
||||
this.layer = layerGroup();
|
||||
this.triggerOnChange = triggerOnChange;
|
||||
this.editor = editor;
|
||||
|
||||
this.clusterLayer = L.markerClusterGroup({
|
||||
spiderfyOnMaxZoom: false,
|
||||
|
@ -20,6 +21,8 @@ export class Stickers {
|
|||
iconCreateFunction: clusterIcon,
|
||||
}).addTo(map);
|
||||
|
||||
this.clusterLayer.on('animationend', this.onSpiderify);
|
||||
|
||||
this.lockMapClicks = lockMapClicks;
|
||||
this.stickers = [];
|
||||
|
||||
|
@ -70,6 +73,14 @@ export class Stickers {
|
|||
|
||||
dumpData = () => this.stickers.map(sticker => sticker.dumpData());
|
||||
|
||||
onSpiderify = () => {
|
||||
if (this.editor.getEditing()) {
|
||||
this.startEditing();
|
||||
} else {
|
||||
this.stopEditing();
|
||||
}
|
||||
};
|
||||
|
||||
startEditing = () => {
|
||||
this.stickers.map(sticker => sticker.startEditing());
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue