mirror of
https://git.rezel.net/LudoTech/traque.git
synced 2026-02-09 10:20:16 +01:00
Corrections
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
"use client";
|
||||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useMap } from "react-leaflet";
|
||||
|
||||
export default function useMapPolygonDraw(polygons, addPolygon, removePolygon) {
|
||||
@@ -9,6 +9,11 @@ export default function useMapPolygonDraw(polygons, addPolygon, removePolygon) {
|
||||
const [currentPolygon, setCurrentPolygon] = useState([]);
|
||||
const [highlightNodes, setHighlightNodes] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
setCurrentPolygon([]);
|
||||
setHighlightNodes([]);
|
||||
}, [polygons])
|
||||
|
||||
function latlngEqual(latlng1, latlng2, epsilon = 1e-9) {
|
||||
return Math.abs(latlng1.lat - latlng2.lat) < epsilon && Math.abs(latlng1.lng - latlng2.lng) < epsilon;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user