Add imageRatio option for VectorImage layers
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
* @module ol/layer/VectorImage
|
||||
*/
|
||||
import BaseVectorLayer from './BaseVector.js';
|
||||
import {assign} from '../obj.js';
|
||||
import CanvasVectorImageLayerRenderer from '../renderer/canvas/VectorImageLayer.js';
|
||||
|
||||
/**
|
||||
* @typedef {import("./BaseVector.js").Options} Options
|
||||
* @property {number} [imageRatio=1] Ratio by which the rendered extent should be larger than the
|
||||
* viewport extent A larger ratio avoids cut images during panning, but will cause a decrease in performance.
|
||||
*/
|
||||
|
||||
|
||||
@@ -23,7 +26,25 @@ class VectorImageLayer extends BaseVectorLayer {
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : /** @type {Options} */ ({});
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
delete baseOptions.imageRatio;
|
||||
super(opt_options);
|
||||
|
||||
/**
|
||||
* @type {number}
|
||||
* @private
|
||||
*/
|
||||
this.imageRatio_ = options.imageRatio !== undefined ? options.imageRatio : 1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {number} Ratio between rendered extent size and viewport extent size.
|
||||
*/
|
||||
getImageRatio() {
|
||||
return this.imageRatio_;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user