Skip to content

Best way to extend TextLayer? #8620

Closed Answered by dlbnco
dlbnco asked this question in Q&A
Mar 10, 2024 · 3 comments · 1 reply
Discussion options

You must be logged in to vote

I achieved the above by using IconLayer and a canvas as the iconAtlas:

const MOCK_MARKERS = [
  {
    title: 'Sprint',
    lngLat: [12.93011869521977, 43.49301565258902],
    anchor: 'top',
    textAnchor: 'start',
  },
  {
    title: 'Climb',
    lngLat: [12.691684874211667, 43.525184353921055],
    anchor: 'left',
    textAnchor: 'start',
  },
  {
    title: 'Feed',
    lngLat: [12.592471985684547, 43.65109327950044],
    anchor: 'bottom',
    textAnchor: 'middle',
  },
  {
    title: 'Feed',
    lngLat: [12.5346, 43.52081],
    anchor: 'right',
    textAnchor: 'end',
  },
];

const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
ctx.fillStyle = params.li…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@dlbnco
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by dlbnco
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants