Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update featuresGeojsonChange event to match new geojsonChange behavior #479

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

jessicamcinchak
Copy link
Member

Follows on from #466

Changes:

  • Similar to drawMode - the clickFeatures functionality dispatches geojson & area events which should stay consistent with recent changes we've made to event dispatching - so we're deprecating featuresAreaChange event and instead setting "area" directly on the featuresGeojsonChange event data "properties"
  • Deprecates areaUnit prop and simply sets both "area.squareMetres" and "area.hectares" anywhere we calculate the area (these field names & new number type are more consistent with ODP Schema too)

Copy link

netlify bot commented Aug 24, 2024

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit 2dd8b0b
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/66cc5cf0b2d28a00088843cf
😎 Deploy Preview https://deploy-preview-479--oslmap.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

src/components/my-map/index.ts Outdated Show resolved Hide resolved
Comment on lines +556 to +560
sketch.set(
"area.squareMetres",
calculateArea(sketchGeom, "m2"),
);
sketch.set("area.hectares", calculateArea(sketchGeom, "ha"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi: There's a setProperties() that allows multiple values to be set at once. No better or worse, just sharing!

Comment on lines +30 to +34
switch (unit) {
case "m2":
return squareMetres;
case "ha":
return hectares;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Co-authored-by: Dafydd Llŷr Pearson <[email protected]>
@jessicamcinchak jessicamcinchak merged commit 24d64e8 into main Aug 26, 2024
5 checks passed
@jessicamcinchak jessicamcinchak deleted the jess/deprecate-featuresAreaChange-areaUnit branch August 26, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants