(fieldData: { name: string; crop: string; cropEmoji: string; area: number; color: string; location: string; group?: string; coordinates: [number, number][][]; })
| 380 | }, [editBoundaryFieldId, mapLoaded, allFields, onCancelEditBoundary]); |
| 381 | |
| 382 | const handleStyleChange = (style: "dark" | "satellite") => { |
| 383 | const map = mapRef.current; |
| 384 | if (!map) return; |
| 385 | setMapLoaded(false); |
| 386 | // Clear NDVI layer/source since style change removes all layers |
| 387 | setGeeNdviTileUrl(null); |
| 388 | map.setStyle(MAP_STYLES[style]); |
| 389 | map.once("style.load", () => { if (style === "satellite") hideExtraLabels(map); setMapLoaded(true); refreshFieldLayers(map, allFields, selectedFields); }); |
| 390 | }; |
| 391 | |
| 392 | const handleLocationSelect = (lng: number, lat: number) => { mapRef.current?.flyTo({ center: [lng, lat], zoom: 13, duration: 2000 }); }; |
| 393 | const handleToggleDraw = () => { if (drawMode) { setDrawMode(false); setDrawVertices([]); } else { setDrawMode(true); setDrawVertices([]); } }; |
| 394 | |
| 395 | const handleSaveNewField = (fieldData: { name: string; crop: string; cropEmoji: string; area: number; color: string; location: string; group?: string; coordinates: [number, number][][]; }) => { |
| 396 | const newField: Field = { id: `custom-${Date.now()}`, ...fieldData }; |
| 397 | console.log("[Virdis Draw] Field saved:", { id: newField.id, name: newField.name, geometry: { type: "Polygon", coordinates: newField.coordinates } }); |
| 398 | onAddField(newField); |
| 399 | setShowNewFieldDialog(false); |
| 400 | setDrawVertices([]); |
| 401 | const map = mapRef.current; |
nothing calls this directly
no outgoing calls
no test coverage detected