Skip to content

Commit 2ba1b63

Browse files
steveohstdavis
authored andcommitted
feat: allow map container to accept a click event
1 parent 3fe9bda commit 2ba1b63

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/components/MapContainer.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1+
import '@ugrc/layer-selector/src/LayerSelector.css';
2+
import cityExtents from './data/cityExtents.json';
3+
14
import Polygon from '@arcgis/core/geometry/Polygon';
5+
import Graphic from '@arcgis/core/Graphic';
26
import VectorTileLayer from '@arcgis/core/layers/VectorTileLayer';
37
import EsriMap from '@arcgis/core/Map';
48
import MapView from '@arcgis/core/views/MapView';
@@ -7,16 +11,13 @@ import { useEffect, useRef, useState } from 'react';
711
import { useMap } from './hooks';
812
import { randomize } from './utils';
913

10-
import '@ugrc/layer-selector/src/LayerSelector.css';
11-
import cityExtents from './data/cityExtents.json';
12-
1314
const { item: randomExtent } = randomize<Graphic>(cityExtents);
1415
const urls = {
1516
landownership:
1617
'https://gis.trustlands.utah.gov/hosting/rest/services/Hosted/Land_Ownership_WM_VectorTile/VectorTileServer',
1718
};
1819

19-
export const MapContainer = () => {
20+
export const MapContainer = ({ onIdentifyClick }: { onIdentifyClick: Function }) => {
2021
const mapNode = useRef(null);
2122
const mapComponent = useRef(null);
2223
const mapView = useRef(null);
@@ -43,9 +44,9 @@ export const MapContainer = () => {
4344

4445
setMapView(mapView.current);
4546

46-
// mapView.current.when(() => {
47-
// mapView.current.on('click', onClick);
48-
// });
47+
mapView.current.when(() => {
48+
mapView.current.on('click', onIdentifyClick);
49+
});
4950

5051
const selectorOptions = {
5152
view: mapView.current,

0 commit comments

Comments
 (0)