Skip to content

feat: add support for drawing and modifying Circle geometry types#465

Merged
jessicamcinchak merged 1 commit intomainfrom
jess/draw-circles
Aug 2, 2024
Merged

feat: add support for drawing and modifying Circle geometry types#465
jessicamcinchak merged 1 commit intomainfrom
jess/draw-circles

Conversation

@jessicamcinchak
Copy link
Copy Markdown
Member

@jessicamcinchak jessicamcinchak commented Jul 25, 2024

Replaces #464 - let's introduce one new shape at a time !

chrome-capture-2024-6-26

Changes:

  • drawType prop now supports Circle in addition to original Polygon (still default) and Point
    • We anticipate using this in Planx to mark the location of trees
  • Supports modifying the circle simply by grabbing any edge and dragging - there will not be visible vertice cues like we have with polygon modify
  • Refactors styling helper methods and swaps out all drawType ternaries to switch statements, which will scale a lot nicer as we support more draw types going forward (for now, the circle is sharing stroke and fill styles with the polygon)

Followup PRs:

  • Dispatch geojson & area change events when drawType="Circle"
    • "Circle" is not a supported GeoJSON type, so we'll transform it to a polygon first to dispatch -
    • We should be able to use an OL helper method like fromCircle() here, but getting some type errors (eg our drawn circle is type "SimplifiedCircle" geometry rather than true "Circle" that will be easier to troubleshoot in a separate followup!)

@netlify
Copy link
Copy Markdown

netlify Bot commented Jul 25, 2024

Deploy Preview for oslmap ready!

Name Link
🔨 Latest commit 53a78b2
🔍 Latest deploy log https://app.netlify.com/sites/oslmap/deploys/66a2d1ee7199040008a62524
😎 Deploy Preview https://deploy-preview-465--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.

@jessicamcinchak
Copy link
Copy Markdown
Member Author

@jessicamcinchak jessicamcinchak marked this pull request as ready for review August 2, 2024 11:00
@jessicamcinchak jessicamcinchak requested a review from a team August 2, 2024 11:00
Copy link
Copy Markdown
Contributor

@RODO94 RODO94 left a comment

Choose a reason for hiding this comment

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

Looks good from what I can see and test, only one wee nit.

return new Style({
image: new Circle({
radius: 9,
fill: new Fill({ color: pointColor }),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: are pointColor and drawColor controlling similar things but relate semantically to different parts. Point referring to the color of your Pointer compared with drawColor which refers to the colour of polygons and shapes which you draw?

Could be cleaner to consolidate them into drawColor unless they are controlling different things.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yep totally agree it'd be nice to consolidate everything into drawColor !

This will technically constitute a breaking change though from the current release - so I vote we handle this in a separate PR where we can adjust behavior and consider marking existing props as @deprecated for upcoming release before straight up removing?

@jessicamcinchak jessicamcinchak merged commit a444ae8 into main Aug 2, 2024
@jessicamcinchak jessicamcinchak deleted the jess/draw-circles branch August 2, 2024 11:59
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