fixed overlapping OSMlayer
This commit is contained in:
@@ -16,10 +16,6 @@ export const PUT = async (req: Request) => {
|
||||
);
|
||||
}
|
||||
|
||||
const positionLog = await prisma.positionLog.create({
|
||||
data: position,
|
||||
});
|
||||
|
||||
const activeAircraft = await prisma.connectedAircraft.findFirst({
|
||||
where: {
|
||||
userId: session.user.id,
|
||||
@@ -33,6 +29,16 @@ export const PUT = async (req: Request) => {
|
||||
},
|
||||
});
|
||||
|
||||
if (!activeAircraft) {
|
||||
return Response.json(
|
||||
{ message: "No active aircraft found" },
|
||||
{ status: 400 },
|
||||
);
|
||||
}
|
||||
const positionLog = await prisma.positionLog.create({
|
||||
data: position,
|
||||
});
|
||||
|
||||
await prisma.connectedAircraft.update({
|
||||
where: {
|
||||
id: activeAircraft?.id,
|
||||
|
||||
@@ -41,13 +41,14 @@ export const SearchElements = () => {
|
||||
element: (typeof searchElements)[1];
|
||||
isActive?: boolean;
|
||||
}) => {
|
||||
const ref = useRef<any>(null);
|
||||
const ref = useRef<L.Polygon>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (ref.current) {
|
||||
ref.current.on("click", () => {
|
||||
const center = ref.current.getBounds().getCenter();
|
||||
if (searchPopup?.elementId !== element.wayID) {
|
||||
console.log("click");
|
||||
const center = ref.current?.getBounds().getCenter();
|
||||
if (center && searchPopup?.elementId !== element.wayID) {
|
||||
setSearchPopup({
|
||||
lat: center.lat,
|
||||
lng: center.lng,
|
||||
@@ -130,6 +131,16 @@ export const SearchElements = () => {
|
||||
);
|
||||
})}
|
||||
{searchElements.map((element, i) => {
|
||||
if (
|
||||
missions.data?.some(
|
||||
(mission) =>
|
||||
(mission.addressOSMways as (OSMWay | null)[])
|
||||
.filter((e): e is OSMWay => e !== null)
|
||||
.some((e) => e.wayID === element.wayID) &&
|
||||
openMissionMarker.some((m) => m.id === mission.id),
|
||||
)
|
||||
)
|
||||
return null;
|
||||
return (
|
||||
<SearchElement
|
||||
key={`mission-elem-${element.wayID}-${i}`}
|
||||
|
||||
Reference in New Issue
Block a user