fixed undefined sticker issue

This commit is contained in:
muerwre 2019-03-04 16:36:27 +07:00
parent 72f6a63f47
commit 5dde6d88a9

View file

@ -3,6 +3,7 @@ import { IStickerDump, Sticker } from '$modules/Sticker';
import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js'; import { MarkerClusterGroup } from 'leaflet.markercluster/dist/leaflet.markercluster-src.js';
import { clusterIcon } from '$utils/clusterIcon'; import { clusterIcon } from '$utils/clusterIcon';
import { editor, Editor } from "$modules/Editor"; import { editor, Editor } from "$modules/Editor";
import { STICKERS } from "$constants/stickers";
export interface ILatLng { export interface ILatLng {
lat: number, lat: number,
@ -36,6 +37,9 @@ export class Stickers {
createSticker = ({ createSticker = ({
latlng, sticker, angle = 2.2, text = '', set latlng, sticker, angle = 2.2, text = '', set
}: IStickerDump): void => { }: IStickerDump): void => {
if (!STICKERS[set] || !STICKERS[set].layers || !STICKERS[set].layers[sticker + 111]) return;
const marker = new Sticker({ const marker = new Sticker({
latlng, latlng,
angle, angle,