From 7c280a90972f07af3923a81ee7dbbdd8c0df8756 Mon Sep 17 00:00:00 2001 From: stdavis Date: Fri, 22 Nov 2024 08:04:17 -0700 Subject: [PATCH] feat: add coordinates widget (bottom-left) Closes #699 --- src/components/Map.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 2dc77b1d..4f4b98d6 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -32,6 +32,7 @@ import Spinner from '../utah-design-system/Spinner'; import Graphic from '@arcgis/core/Graphic'; import { getDefQueryFromLayerFilterValues } from '../utils'; import { fromJSON } from '@arcgis/core/geometry/support/jsonUtils'; +import CoordinateConversion from '@arcgis/core/widgets/CoordinateConversion'; const stateOfUtahPolygon = new Polygon(stateOfUtah); const stateOfUtahExtent = stateOfUtahPolygon.extent; @@ -199,6 +200,17 @@ export default function MapComponent() { view.current.ui.add(legend, 'top-right'); + const coordinatesExpand = new Expand({ + expandIcon: 'object-detection', + view: view.current, + content: new CoordinateConversion({ + view: view.current, + }), + label: 'Coordinates', + }); + + view.current.ui.add(coordinatesExpand, 'bottom-left'); + view.current.on('click', (event) => { view.current.hitTest(event).then(({ results }) => { // look for hit on search layer