mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
fixed marker dragging
This commit is contained in:
parent
3109f49cc4
commit
4e167c9759
8 changed files with 53 additions and 67 deletions
|
@ -1,5 +1,5 @@
|
|||
import React, { useEffect, useCallback, useRef, useState } from 'react';
|
||||
import { marker, Marker } from 'leaflet';
|
||||
import { DivIcon, marker, Marker } from 'leaflet';
|
||||
import { IStickerDump } from '~/redux/map/types';
|
||||
import { STICKERS } from '~/constants/stickers';
|
||||
import { StickerDesc } from '~/components/StickerDesc';
|
||||
|
@ -110,7 +110,7 @@ const Sticker: React.FC<IProps> = ({
|
|||
|
||||
MainMap.enableClicks();
|
||||
},
|
||||
[onChange, sticker, MainMap]
|
||||
[onChange, sticker]
|
||||
);
|
||||
|
||||
const onDrag = React.useCallback(
|
||||
|
@ -183,7 +183,7 @@ const Sticker: React.FC<IProps> = ({
|
|||
document.removeEventListener('mousemove', onDrag);
|
||||
document.removeEventListener('mouseup', onDragStop);
|
||||
};
|
||||
}, [dragging, onDrag]);
|
||||
}, [dragging, onDrag, onDragStop]);
|
||||
|
||||
// Initial leaflet marker creation, when element (dom element div) is ready
|
||||
React.useEffect(() => {
|
||||
|
@ -199,7 +199,7 @@ const Sticker: React.FC<IProps> = ({
|
|||
return () => {
|
||||
item.remove();
|
||||
};
|
||||
}, [element]);
|
||||
}, [sticker.latlng, element]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!layer) return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue