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

Add API to list all images/sprites currently available in the map #6696

Merged
merged 1 commit into from
May 18, 2018

Conversation

ryanhamley
Copy link
Contributor

Launch Checklist

  • briefly describe the changes in this PR
  • Adds method to Map to allow user to list all images/sprites available to the map (via the ImageManager)
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page

Closes #6381

const data = new Uint8Array(width * width * bytesPerPixel);
const imageName = 'gradient';

for (let x = 0; x < width; x++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For readability let's simplify this test image to be just a very simple small image (e.g. a 4 channel 1x1px or 2x2px image).

@@ -266,6 +266,14 @@ class Painter {
return new DepthMode(func || this.context.gl.LEQUAL, mask, [nearDepth, farDepth]);
}

listImages() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although we do technically attach the style's imageManager instance to the Painter, it's more of a member of the Style class, which also manages other ImageManager-related APIs (addImage/getImage/removeImage) — let's move this there.

Copy link
Contributor

@lbud lbud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@ryanhamley ryanhamley merged commit 62721ae into master May 18, 2018
@ryanhamley ryanhamley deleted the 6381-list-images-api branch May 18, 2018 22:22
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.

2 participants