From b3a8a3b25f2591200033705342c7f95f1db0f14d Mon Sep 17 00:00:00 2001 From: csawatzky Date: Thu, 28 Aug 2025 10:50:05 -0600 Subject: [PATCH] added option to the field minimap and the field bounds for the options to adjust the bounds to make them squared for longer/taller fields --- src/field/FieldList.tsx | 2 +- src/field/Fieldminimap.tsx | 6 ++++-- src/models/Field.ts | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/field/FieldList.tsx b/src/field/FieldList.tsx index 8b03843..6b074f8 100644 --- a/src/field/FieldList.tsx +++ b/src/field/FieldList.tsx @@ -136,7 +136,7 @@ const columns: Column[] = [ render: row => { return ( - + ) } diff --git a/src/field/Fieldminimap.tsx b/src/field/Fieldminimap.tsx index 0752610..d657ae5 100644 --- a/src/field/Fieldminimap.tsx +++ b/src/field/Fieldminimap.tsx @@ -9,10 +9,12 @@ import { GeometryMapping } from "models/GeometryMapping"; interface Props { field: Field + squared?: boolean + borderSpacing?: number } export default function FieldMinimap(props: Props) { - const { field } = props + const { field, squared, borderSpacing } = props const MAPBOX_TOKEN = import.meta.env.VITE_MAPBOX_ACCESS_TOKEN; const [geoCollection, setGeoCollection] = useState(); @@ -42,7 +44,7 @@ export default function FieldMinimap(props: Props) { latDiff){ + //if the longitude is the narrow bound apply half of the diff between the diffs to the min and max lats + let halfDiff = (longDiff - latDiff)/2 + minLat = minLat - halfDiff + maxLat = maxLat + halfDiff + } else { + //if the longitude is not the narrow bound apply half of the diff between the diffs to the min and max longs + let halfDiff = (latDiff - longDiff)/2 + minLong = minLong - halfDiff + maxLong = maxLong + halfDiff + } } if(spacing){ minLong = minLong - spacing @@ -194,7 +206,6 @@ export class Field { new LngLat(minLong, minLat), new LngLat(maxLong, maxLat) ); - // return[southWest, northEast] } public grainName(): string {