mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
stickers stops dragging
This commit is contained in:
parent
fca52df9f5
commit
58eefd5670
10 changed files with 388 additions and 175 deletions
39
src/containers/map/Stickers/index.tsx
Normal file
39
src/containers/map/Stickers/index.tsx
Normal file
|
@ -0,0 +1,39 @@
|
|||
import * as React from "react";
|
||||
import { IStickerDump } from "$modules/Sticker";
|
||||
import { Layer, FeatureGroup, Map } from "leaflet";
|
||||
import { MapContext } from "$utils/context";
|
||||
import { Sticker } from "$containers/map/Sticker";
|
||||
|
||||
interface IProps {
|
||||
stickers: IStickerDump[];
|
||||
is_editing: boolean;
|
||||
map: Map;
|
||||
}
|
||||
|
||||
// const { FC, useContext, useState, useEffect } = React;
|
||||
|
||||
const Stickers: React.FC<IProps> = React.memo(({ stickers, is_editing, map }) => {
|
||||
const [layer, setLayer] = React.useState<FeatureGroup>(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!map) return;
|
||||
|
||||
setLayer(new FeatureGroup().addTo(map));
|
||||
}, [map]);
|
||||
|
||||
return (
|
||||
<div>
|
||||
{layer &&
|
||||
stickers.map((sticker, index) => (
|
||||
<Sticker
|
||||
map={map}
|
||||
sticker={sticker}
|
||||
key={`${sticker.set}.${sticker.sticker}.${index}`}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
// return null;
|
||||
});
|
||||
|
||||
export { Stickers };
|
Loading…
Add table
Add a link
Reference in a new issue