Store rendererd source on the layer instead of the layer state
This commit is contained in:
@@ -57,7 +57,6 @@ import {listen, unlistenByKey} from '../events.js';
|
||||
* @typedef {Object} State
|
||||
* @property {import("./Layer.js").default} layer Layer.
|
||||
* @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
|
||||
* @property {import("../source/Source.js").default|undefined} source Source being rendered (only for multi-source layers).
|
||||
* @property {boolean} visible Visible.
|
||||
* @property {boolean} managed Managed.
|
||||
* @property {import("../extent.js").Extent} [extent] Extent.
|
||||
|
||||
@@ -325,6 +325,12 @@ class WebGLTileLayer extends BaseTileLayer {
|
||||
*/
|
||||
this.sources_ = options.sources;
|
||||
|
||||
/**
|
||||
* @type {SourceType|null}
|
||||
* @private
|
||||
*/
|
||||
this.renderedSource_ = null;
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
@@ -373,10 +379,7 @@ class WebGLTileLayer extends BaseTileLayer {
|
||||
* @return {SourceType} The source being rendered.
|
||||
*/
|
||||
getRenderSource() {
|
||||
return (
|
||||
/** @type {SourceType} */ (this.getLayerState().source) ||
|
||||
this.getSource()
|
||||
);
|
||||
return this.renderedSource_ || this.getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,7 +429,7 @@ class WebGLTileLayer extends BaseTileLayer {
|
||||
const layerRenderer = this.getRenderer();
|
||||
let canvas;
|
||||
for (let i = 0, ii = sources.length; i < ii; ++i) {
|
||||
this.getLayerState().source = sources[i];
|
||||
this.renderedSource_ = sources[i];
|
||||
if (layerRenderer.prepareFrame(frameState)) {
|
||||
canvas = layerRenderer.renderFrame(frameState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user