From 1f66d7f5780c341873b0c1f7c59b056b72105d44 Mon Sep 17 00:00:00 2001 From: Anastasiia Ivanchenko Date: Tue, 7 Jul 2026 01:09:57 +0300 Subject: [PATCH 1/2] Draw the downloaded 40x40 patch extent on click, with a show/hide toggle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A click does not download a single pixel: it pulls the whole native chunk (40x40 cells = 2° x 2°). This outlines that patch on the map so the user can see what was actually fetched. - New geogrid helper `chunkPatchBounds` computes the geographic box of the native chunk containing the clicked cell; the store's chunk footprint is recorded in `ZARR_STORE.nativeChunks`. - The selection overlay draws the patch as a faint fill with a dashed accent outline, beneath the precise cell marker, in both 2D and globe. - A toggle button in the nav (with a pressed/active state) shows or hides the patch; it is on by default when a point is selected. --- src/components/layout/Nav.tsx | 19 ++++++ src/components/map/EarthMap.tsx | 8 +++ src/components/map/GlobeSelectionOverlay.tsx | 41 +++++++++++- src/components/ui/IconButton.tsx | 18 ++++- src/icons/PatchIcon.tsx | 21 ++++++ src/lib/constants/store.ts | 9 +++ src/lib/map/geogrid.test.ts | 20 ++++++ src/lib/map/geogrid.ts | 70 +++++++++++++++++--- src/lib/map/selectionStyle.ts | 12 ++++ 9 files changed, 205 insertions(+), 13 deletions(-) create mode 100644 src/icons/PatchIcon.tsx diff --git a/src/components/layout/Nav.tsx b/src/components/layout/Nav.tsx index 5b300f6..fa1f637 100644 --- a/src/components/layout/Nav.tsx +++ b/src/components/layout/Nav.tsx @@ -5,6 +5,7 @@ import { EditorViewTabs } from "@/components/layout/EditorViewTabs"; import { NavActions } from "@/components/nav/NavActions"; import { IconButton } from "@/components/ui/IconButton"; import { CrosshairIcon } from "@/icons/CrosshairIcon"; +import { PatchIcon } from "@/icons/PatchIcon"; import type { MapViewMode } from "@/types/map"; type NavProps = { @@ -12,6 +13,8 @@ type NavProps = { onViewModeChange?: (mode: MapViewMode) => void; hasSelection?: boolean; onZoomToSelection?: () => void; + showPatch?: boolean; + onTogglePatch?: () => void; }; export function Nav({ @@ -19,6 +22,8 @@ export function Nav({ onViewModeChange, hasSelection = false, onZoomToSelection, + showPatch = false, + onTogglePatch, }: NavProps) { return (