Skip to content

Commit

Permalink
[Measurement] button disabled if there are no coordinates or no circl…
Browse files Browse the repository at this point in the history
…e radius
  • Loading branch information
claire2212 committed Oct 20, 2023
1 parent 044badb commit 445491e
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ export function CustomCircleRange() {
)

const addCustomCircleRange = useCallback(
(nextCoordinates, nextCircleRadius) => {
dispatch(
async (nextCoordinates, nextCircleRadius) => {
if (!nextCoordinates?.length || !nextCircleRadius?.length) {
return
}

await dispatch(
setCircleMeasurementToAdd({
circleCoordinatesToAdd: nextCoordinates,
circleRadiusToAdd: nextCircleRadius
Expand All @@ -100,6 +104,7 @@ export function CustomCircleRange() {
const extent = transformExtent(boundingExtent([formattedCoordinates]), WSG84_PROJECTION, OPENLAYERS_PROJECTION)
dispatch(setFitToExtent(extent))
dispatch(setMeasurementTypeToAdd(undefined))
dispatch(resetCircleMeasurementInDrawing())
},
[dispatch]
)
Expand Down Expand Up @@ -131,6 +136,7 @@ export function CustomCircleRange() {
<br />
<OkButton
data-cy="measurement-circle-add"
disabled={!circleCoordinates?.length || !circleRadius?.length}
onClick={() => addCustomCircleRange(circleCoordinates, circleRadius)}
>
OK
Expand Down

0 comments on commit 445491e

Please sign in to comment.