Skip to content

Commit

Permalink
perf: Reduce tile layer updates.
Browse files Browse the repository at this point in the history
When updating one tile layer's z index, possibly through adding the
layer, other tile layers would needlessly rerender.
  • Loading branch information
manthey committed Apr 5, 2022
1 parent 1544cb9 commit 9d5d32d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# GeoJS Change Log

## Version 1.8.2

### Improvements

- Reduce tile layer updates ([#1196](../../pull/1196))

## Version 1.8.1

### Improvements
Expand Down
5 changes: 4 additions & 1 deletion src/webgl/tileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ var webgl_tileLayer = function () {
* triggered this. If `undefined`, clear the quads but don't redraw.
*/
this._clearQuads = function (evt) {
if (evt && (!evt.layer || !(evt.layer instanceof tileLayer))) {
if (evt && (!evt.layer || !(evt.layer instanceof tileLayer) || !evt.layer.autoshareRenderer() || (
(evt.event === geo_event.layerAdd || evt.event === geo_event.layerRemove) &&
m_this.map().layers().every(l => l === evt.layer || evt.layer.zIndex() > l.zIndex())
))) {
return;
}
m_this.clear();
Expand Down

0 comments on commit 9d5d32d

Please sign in to comment.