Skip to content

Commit

Permalink
Merge pull request #85 from Element84/mparks/leaflet-editable
Browse files Browse the repository at this point in the history
Adds Leaflet.Editable to Map component
  • Loading branch information
parksjr authored Mar 1, 2024
2 parents 50318d4 + 90cb787 commit 21584bc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
15 changes: 13 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "fogg",
"description": "Gatsby theme for mapping!",
"version": "0.5.0",
"version": "0.5.1-0",
"author": "Element 84, Inc.",
"publishConfig": {
"registry": "https://registry.npmjs.com/"
Expand All @@ -27,6 +27,7 @@
"gatsby-source-filesystem": "^4.21.0",
"leaflet-active-area": "^1.2.1",
"leaflet-draw": "^1.0.4",
"leaflet-editable": "^1.2.0",
"memoizee": "^0.4.15",
"mkdirp": "^1.0.4",
"moment": "^2.29.1",
Expand Down
4 changes: 3 additions & 1 deletion src/components/Map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Map as BaseMap, LayersControl, ZoomControl } from 'react-leaflet';
import 'proj4';
import 'proj4leaflet';
import 'leaflet-active-area';
import 'leaflet-editable';

import MapService from '../../models/map-service';
import { LayersContext } from '../../context';
Expand Down Expand Up @@ -125,7 +126,8 @@ const Map = (props) => {
maxZoom: maxZoom || baseMaxZoom,
minZoom: minZoom || baseMinZoom,
maxNativeZoom: baseMaxNativeZoom,
zoomControl: false
zoomControl: false,
editable: true
};

// Only set up a new CRS if one is provided, otherwise fallback to the leaflet defaults (3857)
Expand Down
3 changes: 2 additions & 1 deletion src/components/MapPreviewDraw/MapPreviewDraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const MapPreviewDraw = ({
*/

function handleOnEdited ({ target } = {}) {
if (typeof onCreated === 'function') {
if (typeof onEdited === 'function') {
onEdited(target, forwardedRef);
}
}
Expand All @@ -109,6 +109,7 @@ const MapPreviewDraw = ({
onEdited={handleOnEdited}
draw={drawOptions}
edit={{
featureGroup: featureRef,
edit: !disableEditControls,
remove: false
}}
Expand Down

0 comments on commit 21584bc

Please sign in to comment.