fixed sticker mode change

This commit is contained in:
Fedor Katurov 2020-01-22 12:15:40 +07:00
parent 60b8fd51a2
commit 8e0a4c6df6
3 changed files with 6 additions and 4 deletions

View file

@ -39,6 +39,7 @@ const Sticker: React.FC<IProps> = ({
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<IProps> = ({
React.useEffect(() => {
element.className = is_editing ? 'sticker-container' : 'sticker-container inactive';
}, [element, is_editing]);
}, [element, is_editing, layer]);
return createPortal(
<React.Fragment>

View file

@ -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<IProps> = React.memo(
return () => MainMap.stickerLayer.removeLayer(item);
}, [MainMap]);
console.log(is_editing);
return (
<div>
{layer &&
@ -40,7 +42,6 @@ const Stickers: React.FC<IProps> = React.memo(
))}
</div>
);
// return null;
}
);

View file

@ -126,7 +126,7 @@ export function* loadMapFromPath() {
return;
}
yield put(editorSetEditing(mode && mode === 'edit'));
yield put(editorSetEditing(!!(mode && mode === 'edit')));
return;
}