From 8e0a4c6df60129a519dd0b13b7cf6988fa522bf9 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Wed, 22 Jan 2020 12:15:40 +0700 Subject: [PATCH] fixed sticker mode change --- src/map/Sticker/index.tsx | 3 ++- src/map/Stickers/index.tsx | 5 +++-- src/redux/map/sagas.ts | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/map/Sticker/index.tsx b/src/map/Sticker/index.tsx index 9455097..9c9d8d0 100644 --- a/src/map/Sticker/index.tsx +++ b/src/map/Sticker/index.tsx @@ -39,6 +39,7 @@ const Sticker: React.FC = ({ let angle = useRef(sticker.angle); const element = React.useMemo(() => document.createElement('div'), []); + const stickerArrow = React.useRef(null); const stickerImage = React.useRef(null); @@ -197,7 +198,7 @@ const Sticker: React.FC = ({ React.useEffect(() => { element.className = is_editing ? 'sticker-container' : 'sticker-container inactive'; - }, [element, is_editing]); + }, [element, is_editing, layer]); return createPortal( diff --git a/src/map/Stickers/index.tsx b/src/map/Stickers/index.tsx index d7d98f8..df81d9e 100644 --- a/src/map/Stickers/index.tsx +++ b/src/map/Stickers/index.tsx @@ -3,7 +3,7 @@ import { IStickerDump } from '~/redux/map/types'; import { FeatureGroup, Map } from 'leaflet'; import { Sticker } from '~/map/Sticker'; import { mapSetSticker, mapDropSticker } from '~/redux/map/actions'; -import { MapContainer, MainMap } from '~/constants/map'; +import { MainMap } from '~/constants/map'; interface IProps { stickers: IStickerDump[]; @@ -25,6 +25,8 @@ const Stickers: React.FC = React.memo( return () => MainMap.stickerLayer.removeLayer(item); }, [MainMap]); + console.log(is_editing); + return (
{layer && @@ -40,7 +42,6 @@ const Stickers: React.FC = React.memo( ))}
); - // return null; } ); diff --git a/src/redux/map/sagas.ts b/src/redux/map/sagas.ts index 3f886c1..9825b59 100644 --- a/src/redux/map/sagas.ts +++ b/src/redux/map/sagas.ts @@ -126,7 +126,7 @@ export function* loadMapFromPath() { return; } - yield put(editorSetEditing(mode && mode === 'edit')); + yield put(editorSetEditing(!!(mode && mode === 'edit'))); return; }