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

ImageSource: updateImage() doesn't render properly if the size of the image changes to a smaller size #13306

Open
rory-orennia opened this issue Oct 22, 2024 · 4 comments

Comments

@rory-orennia
Copy link

rory-orennia commented Oct 22, 2024

mapbox-gl-js version: 3.7.0 or 3.8.0

browser: Vivaldi, but it doesn't matter

Steps to Trigger Behavior

  1. Call source.updateImage() on an image source while using an image that has a new size
  2. See that the rendering is off now
  3. Change the link for the mapbox-gl library to 3.6.0 instead of 3.7.0
  4. Re-run. Both images are fine now

Link to Demonstration

https://jsfiddle.net/kx7mrb62/ -- 3.7.0
https://jsfiddle.net/ha8nbq1m/ -- 3.8.0

  • This has 2 sources slowly diverging left and right and flipping between a 5px and a 24px image. The one on the left uses source.imageUpdate() and the one on the right deletes and re-creates the layer and source every time
  • if you update the mapbox-gl link to use 3.6.0 instead of 3.7.0 both images are identical

Expected Behavior

The image should be re-mapped to the coordinates with it's new size taken into account

Actual Behavior

The Bigger image size works fine, but if the image size shrinks the whole effect breaks

@rory-orennia
Copy link
Author

Side question: Why does mapbox seem to drastically lower the fidelity of images added to the map this way? That 24x24 px emoji in the example above looks like it's been crushed down to a way lower resolution. I'm noticing the same behaviour in our production application

@dmlitvinov
Copy link

dmlitvinov commented Nov 12, 2024

We have same or similar issue when trying to update url source - after update url on map we can see both images (part of older image and part of new image) combined in one polygon

@rory-orennia
Copy link
Author

I see version 3.8.0 was released today. Here's the updated reproduction link as it's still broken in the latest version:
https://jsfiddle.net/ha8nbq1m/

@dmlitvinov
Copy link

Same, tried the new version an hour ago - problem is still there(

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

No branches or pull requests

2 participants