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({
|
const activeAircraft = await prisma.connectedAircraft.findFirst({
|
||||||
where: {
|
where: {
|
||||||
userId: session.user.id,
|
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({
|
await prisma.connectedAircraft.update({
|
||||||
where: {
|
where: {
|
||||||
id: activeAircraft?.id,
|
id: activeAircraft?.id,
|
||||||
|
|||||||
@@ -41,13 +41,14 @@ export const SearchElements = () => {
|
|||||||
element: (typeof searchElements)[1];
|
element: (typeof searchElements)[1];
|
||||||
isActive?: boolean;
|
isActive?: boolean;
|
||||||
}) => {
|
}) => {
|
||||||
const ref = useRef<any>(null);
|
const ref = useRef<L.Polygon>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ref.current) {
|
if (ref.current) {
|
||||||
ref.current.on("click", () => {
|
ref.current.on("click", () => {
|
||||||
const center = ref.current.getBounds().getCenter();
|
console.log("click");
|
||||||
if (searchPopup?.elementId !== element.wayID) {
|
const center = ref.current?.getBounds().getCenter();
|
||||||
|
if (center && searchPopup?.elementId !== element.wayID) {
|
||||||
setSearchPopup({
|
setSearchPopup({
|
||||||
lat: center.lat,
|
lat: center.lat,
|
||||||
lng: center.lng,
|
lng: center.lng,
|
||||||
@@ -130,6 +131,16 @@ export const SearchElements = () => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{searchElements.map((element, i) => {
|
{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 (
|
return (
|
||||||
<SearchElement
|
<SearchElement
|
||||||
key={`mission-elem-${element.wayID}-${i}`}
|
key={`mission-elem-${element.wayID}-${i}`}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user