Skip to content

Commit

Permalink
Merge pull request #68 from mit-jp/aesthetic-changes
Browse files Browse the repository at this point in the history
different fix for decimal places < 0 bug on map editor
  • Loading branch information
ethanrdsch authored Dec 15, 2023
2 parents 1df784c + 43d7728 commit dbbf299
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions frontend/src/editor/MapOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,10 @@ function MapOptions({ mapVisualization }: { mapVisualization: MapVisualization }
value={mapVisualization.legend_ticks ?? ''}
onChange={(e) => {
let legendTicks: number | undefined = parseInt(e.target.value, 10)
if (Number.isNaN(legendTicks) || legendTicks < 0) {
if (Number.isNaN(legendTicks)) {
legendTicks = undefined
} else if (legendTicks <= 0) {
legendTicks = 0
}
updateMap({ ...mapVisualization, legend_ticks: legendTicks })
}}
Expand All @@ -209,8 +211,10 @@ function MapOptions({ mapVisualization }: { mapVisualization: MapVisualization }
value={mapVisualization.legend_decimals ?? mapVisualization.decimals}
onChange={(e) => {
let legendDecimals: number | undefined = parseInt(e.target.value, 10)
if (Number.isNaN(legendDecimals) || legendDecimals < 0) {
if (Number.isNaN(legendDecimals)) {
legendDecimals = undefined
} else if (legendDecimals <= 0) {
legendDecimals = 0
}
updateMap({ ...mapVisualization, legend_decimals: legendDecimals })
}}
Expand Down

0 comments on commit dbbf299

Please sign in to comment.