Skip to content

Commit

Permalink
Merge branch 'EMC-44-point-poly-polished' into 'develop'
Browse files Browse the repository at this point in the history
Round lon-lat and restrict to single shape

Closes EMC-44

See merge request eip/catalogue!574
  • Loading branch information
iwalmsley committed Feb 7, 2024
2 parents 7f6b19b + 3e6a082 commit ddfcf8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions web/less/editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,13 @@
font-size: 0.9em;
}
}

// Hide the leaflet 'save' button as it is never used: https://stackoverflow.com/questions/51360283/how-to-remove-save-option-from-leaflet-draw-api-delete-button
.leaflet-draw-actions li:first-child a[title="Save changes"] {
visibility: hidden;
width: 0;
padding: 0;
}
}

.editor-buttons {
Expand Down
7 changes: 6 additions & 1 deletion web/src/editor/src/geometryMap/GeometryView.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,14 @@ export default ObjectInputView.extend({
this.map.addControl(this.drawControl)
baseMaps.Map.addTo(this.map)

const rounding = function (key, val) {
if (typeof val === 'number') { return val.toFixed(5) }
return val
}

this.listenTo(this.map, L.Draw.Event.CREATED, function (event) {
const layer = event.layer
const geoJson = JSON.stringify(layer.toGeoJSON())
const geoJson = JSON.stringify(layer.toGeoJSON(), rounding)
this.model.setGeometry(geoJson)
this.drawButtons = false
this.map.removeControl(this.drawControl)
Expand Down

0 comments on commit ddfcf8b

Please sign in to comment.