Repository navigation
Per-tile glyph and icon atlases - #5190
Conversation
kkaefer
left a comment
There was a problem hiding this comment.
Overall, this is tricky to review given its size and the many file renames. Could you please provide a short list of the fundamental changes/steps you did and whether there's anything in particular that you're concerned about or that could use a second pair of eyes?
|
|
||
| - `Map#addImage` now requires the image as an `HTMLImageElement`, `ImageData`, or object with `width`, `height`, and | ||
| `data` properties with the same format as `ImageData`. It no longer accepts a raw `ArrayBufferView` in the second | ||
| argument and `width` and `height` options in the third argument. |
There was a problem hiding this comment.
Is there a particular reason for this change or just API cleanliness?
There was a problem hiding this comment.
I made it internally at first, in order to simplify SpriteAtlas#addImage, and then realized it's just inherently a better design to separate required and optional parameters, and how we should have made the public API from the beginning. Though it's a breaking change, I think it's worth it now, with low usage. In the future it probably wouldn't be.
|
Sure.
|
kkaefer
left a comment
There was a problem hiding this comment.
Overall this is a great change! Reviewed the code but didn't find any issues with it. It could benefit from some more comments that make the flow of information clearer.
| const halfAdvance = glyph.advance / 2; | ||
| // The rects have an addditional buffer that is not included in their size; | ||
| const glyphPadding = 1.0; | ||
| const rectBuffer = 3.0 + glyphPadding; |
Can you please ticket this so we can track it? |
Second parameter provides required options (image data, width and height), third parameter provides optional options.
Ports mapbox/mapbox-gl-native#9213; see that PR for extended explanation.
A breaking change to
Map#addImageis included as a prerequisite; see the first commit.Fixes #4876, fixes #141, fixes #4797.
Launch Checklist