openlayers / openlayers/openlayers
Image layer + RasterSource is not always drawn properly
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 12.6k
- Forks
- 3.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 21
Description
Describe the bug
An Image layer with a Raster source backed by multiple Static image sources fails to be drawn under certain circumstances.
To Reproduce
- Use this sandbox case: https://codesandbox.io/s/simple-forked-nnpfj3?file=/main.js:230-278
- Click on map to add a rectangular image source
- Pan map so that the first image is no longer in the viewport
- Click on map to add another rectangular image source
- No image appears on map
- Only after you zoom out so that both images fit the viewport, will the layer appear
The test case shows that the beforeoperations event is not fired on the raster source step 5.
Also note that the entire layer, raster source and all images are rebuilt after each clicks. The redraw issue seems to somehow be connected with the previous "versions" of the Image layer even though they have been removed from the map.
Expected behavior
Every time the map is clicked, a raster image should appear at the mouse cursor.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox at main.js lines 230-278 and reproduce the click, pan, and second-click sequence. Trace when the raster source is rebuilt and whether the beforeoperations event fires after the first image leaves the viewport. Done means each newly added image appears immediately without zooming out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100