{val.items![item].label} | 45 | ))} 46 |
---|
53 | |
55 | ))}
56 |
Page not available
; 10 | } 11 | 12 | export default ItemForm; 13 | -------------------------------------------------------------------------------- /packages/client/src/pages/ItemList/DrawBboxControl.tsx: -------------------------------------------------------------------------------- 1 | import { useCallback, useEffect, useRef } from 'react'; 2 | 3 | import MapboxDraw from '@mapbox/mapbox-gl-draw'; 4 | import StaticMode from '@mapbox/mapbox-gl-draw-static-mode'; 5 | import DrawRectangle from 'mapbox-gl-draw-rectangle-mode'; 6 | import { GeoJSONFeature, GeoJSONPolygon } from 'stac-ts/src/types/geojson'; 7 | import { Map } from 'maplibre-gl'; 8 | 9 | const addDrawControl = ( 10 | map: Map, 11 | drawingCompleted: (f: GeoJSONFeature) => void 12 | ) => { 13 | const { modes } = MapboxDraw; 14 | 15 | const options = { 16 | modes: { 17 | ...modes, 18 | draw_rectangle: DrawRectangle, 19 | static: StaticMode 20 | }, 21 | boxSelect: false, 22 | displayControlsDefault: false 23 | }; 24 | const draw = new MapboxDraw(options) as any; // eslint-disable-line @typescript-eslint/no-explicit-any 25 | 26 | map.addControl(draw); 27 | map.on('draw.create', (e) => { 28 | const { features } = e; 29 | const feature = features[0]; 30 | map.getCanvas().style.cursor = ''; 31 | setTimeout(() => draw.changeMode('static'), 0); 32 | drawingCompleted(feature); 33 | }); 34 | return draw; 35 | }; 36 | 37 | type DrawBboxControlProps = { 38 | handleDrawComplete: (bbox: number[]) => void; 39 | isEnabled: boolean; 40 | bbox?: number[]; 41 | map: any; // eslint-disable-line @typescript-eslint/no-explicit-any 42 | }; 43 | 44 | function DrawBboxControl({ 45 | map, 46 | handleDrawComplete, 47 | isEnabled, 48 | bbox 49 | }: DrawBboxControlProps) { 50 | const drawControlRef = useRefTest.
50 |This is the sandbox.
16 | 17 |
12 | TestPlugin
13 |
14 | has no edit schema.
15 | {plugin.name}
has no edit schema.
32 | {JSON.stringify(this.props.field, null, 2)}
120 | No items
73 | )} 74 |No items
115 | )} 116 |