faster track redraw

This commit is contained in:
Fedor Katurov 2020-01-24 17:48:07 +07:00
parent c4aede5833
commit 5604d8716b
2 changed files with 7 additions and 2 deletions

View file

@ -20,13 +20,13 @@ const GpxPolyline: FC<IProps> = ({ latlngs, color }) => {
setLayer(item); setLayer(item);
return () => MainMap.removeLayer(item); return () => MainMap.removeLayer(item);
}, [MainMap, color, latlngs]); }, [MainMap]);
useEffect(() => { useEffect(() => {
if (!layer) return; if (!layer) return;
layer.setLatLngs(latlngs); layer.setLatLngs(latlngs);
layer.options.color = color; layer.setStyle({ color });
}, [latlngs, layer, color]); }, [latlngs, layer, color]);
return null; return null;

View file

@ -52,6 +52,11 @@
width: 8px; width: 8px;
height: 8px; height: 8px;
border-radius: 100%; border-radius: 100%;
cursor: pointer;
// span {
// }
} }
} }