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

State labels: new label placing algorithm #977

Merged
merged 4 commits into from
Aug 11, 2023
Merged

State labels: new label placing algorithm #977

merged 4 commits into from
Aug 11, 2023

Conversation

Azgaar
Copy link
Owner

@Azgaar Azgaar commented Aug 11, 2023

Description

New placing algorithm for state labels - now state labels should be less curvy and take more optimal position. Migrated from #842 with a few issues fixed.

Old Algorithm:
Custom implementation of the centerline labeling. Build voronoi to define a centerline and place label based on it.
https://observablehq.com/@veltman/centerline-labeling

Pros:

  • cool
  • fast enough

Cons:

  • complex to tweak
  • places labels in chaotic directions

New algorithm:
For each state we cast rays from the state's pole of inaccessibility to define which label position is optimal. Horizontal positions take advantage, vertical is discouraged.

Pros:

  • simple
  • prefers horizontal positioning
  • fast enough

Const:

  • positions are still not optimal, better detection will take more time

Type of change

  • New feature

Versioning

  • Version is updated
  • Changed files hash is updated

@Azgaar Azgaar self-assigned this Aug 11, 2023
@netlify
Copy link

netlify bot commented Aug 11, 2023

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 2434849
🔍 Latest deploy log https://app.netlify.com/sites/afmg/deploys/64d64c1443a5b30007831b7f
😎 Deploy Preview https://deploy-preview-977--afmg.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.

@Azgaar Azgaar merged commit 87599d1 into master Aug 11, 2023
4 checks passed
@Azgaar Azgaar deleted the draw-state-labels branch August 11, 2023 14:56
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.

1 participant