Skip to content

feat: snap to vector tile basemap features#75

Merged
jessicamcinchak merged 16 commits intomainfrom
jess/snapping
Nov 12, 2021
Merged

feat: snap to vector tile basemap features#75
jessicamcinchak merged 16 commits intomainfrom
jess/snapping

Conversation

@jessicamcinchak
Copy link
Copy Markdown
Member

@jessicamcinchak jessicamcinchak commented Nov 10, 2021

Implementation assumptions:

  • Snapping is only possible if OS Vector Tiles basemap is enabled (not OS Raster basemap or OSM); this requires OS API key
  • Snapping points appear when drawMode is enabled and zoom level > 20
  • Snapping points remain visible after you've closed your shape as reference points, but when modifying you won't get the same pixelTolerance/gravitational pull towards the snaps as you do when in initial drawing mode

Default styles:

  • Drawing cursor is updated to red crosshair rather than dot
  • Snapping points are solid black with a radius of 3 pixels, a bit smaller than drawing cursor and red drawing vertices
  • Drawing vertices will always appear on top of snapping points
  • Color & size are currently not user configurable, but please say so if this is a MVP priority and we can convert to a Lit property!

chrome-capture (3)

Closes #55

@netlify
Copy link
Copy Markdown

netlify Bot commented Nov 10, 2021

✔️ Deploy Preview for oslmap ready!

🔨 Explore the source changes: 577ac9a

🔍 Inspect the deploy log: https://app.netlify.com/sites/oslmap/deploys/618cff4e45bcbf0008281014

😎 Browse the preview: https://deploy-preview-75--oslmap.netlify.app

@jessicamcinchak jessicamcinchak changed the title netlify test feat: snap to vector tile basemap features Nov 10, 2021
@jessicamcinchak jessicamcinchak mentioned this pull request Nov 10, 2021
@jessicamcinchak jessicamcinchak requested review from a team and melzreal November 10, 2021 10:29
@jessicamcinchak
Copy link
Copy Markdown
Member Author

Comment thread src/my-map.ts
}

// extract snap-able points from the basemap, and display them as points on the map
setTimeout(() => {
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.

Is this timeout really necessay?

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.

the timeout helps keep the zoom & pan interactions feeling a lot smoother in my opinion, and a bit more performant to only extract the snap points once a user has settled on location rather than mid-drag

Comment thread tsconfig.json
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"lib": ["es2017", "dom", "dom.iterable"],
"lib": ["es2019", "dom", "dom.iterable"],
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.

Can we keep es2017 just in case?

@jessicamcinchak jessicamcinchak merged commit 941b897 into main Nov 12, 2021
@jessicamcinchak jessicamcinchak deleted the jess/snapping branch November 12, 2021 17:14
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.

Experiment with better snapping defaults while in drawMode

3 participants