-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Per-tile glyph and icon atlases #5190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason for this change or just API cleanliness?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/symbol/quads.js
Outdated
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does 3.0 come from?
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#addImage
is included as a prerequisite; see the first commit.Fixes #4876, fixes #141, fixes #4797.
Launch Checklist