Use Object.assign
This commit is contained in:
@@ -5,7 +5,6 @@ import BaseObject from '../Object.js';
|
||||
import LayerProperty from './Property.js';
|
||||
import {abstract} from '../util.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {clamp} from '../math.js';
|
||||
|
||||
/**
|
||||
@@ -92,10 +91,10 @@ class BaseLayer extends BaseObject {
|
||||
/**
|
||||
* @type {Object<string, *>}
|
||||
*/
|
||||
const properties = assign({}, options);
|
||||
const properties = Object.assign({}, options);
|
||||
if (typeof options.properties === 'object') {
|
||||
delete properties.properties;
|
||||
assign(properties, options.properties);
|
||||
Object.assign(properties, options.properties);
|
||||
}
|
||||
|
||||
properties[LayerProperty.OPACITY] =
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import Layer from './Layer.js';
|
||||
import TileProperty from './TileProperty.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/***
|
||||
* @template Return
|
||||
@@ -66,7 +65,7 @@ class BaseTileLayer extends Layer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
|
||||
delete baseOptions.preload;
|
||||
delete baseOptions.useInterimTilesOnError;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import Layer from './Layer.js';
|
||||
import RBush from 'rbush';
|
||||
import {assign} from '../obj.js';
|
||||
import {
|
||||
createDefaultStyle,
|
||||
toFunction as toStyleFunction,
|
||||
@@ -91,7 +90,7 @@ class BaseVectorLayer extends Layer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
|
||||
delete baseOptions.style;
|
||||
delete baseOptions.renderBuffer;
|
||||
|
||||
@@ -25,7 +25,6 @@ import {
|
||||
isEmpty,
|
||||
wrapX as wrapExtentX,
|
||||
} from '../extent.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {clamp} from '../math.js';
|
||||
import {degreesToStringHDMS} from '../coordinate.js';
|
||||
import {
|
||||
@@ -170,7 +169,7 @@ class Graticule extends VectorLayer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = assign(
|
||||
const baseOptions = Object.assign(
|
||||
{
|
||||
updateWhileAnimating: true,
|
||||
updateWhileInteracting: true,
|
||||
|
||||
@@ -8,7 +8,7 @@ import Event from '../events/Event.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import ObjectEventType from '../ObjectEventType.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign, clear} from '../obj.js';
|
||||
import {clear} from '../obj.js';
|
||||
import {getIntersection} from '../extent.js';
|
||||
import {getUid} from '../util.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
@@ -92,7 +92,7 @@ class LayerGroup extends BaseLayer {
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options || {};
|
||||
const baseOptions = /** @type {Options} */ (assign({}, options));
|
||||
const baseOptions = /** @type {Options} */ (Object.assign({}, options));
|
||||
delete baseOptions.layers;
|
||||
|
||||
let layers = options.layers;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import BaseVector from './BaseVector.js';
|
||||
import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {clamp} from '../math.js';
|
||||
import {createCanvasContext2D} from '../dom.js';
|
||||
|
||||
@@ -71,7 +70,7 @@ class Heatmap extends BaseVector {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
|
||||
delete baseOptions.gradient;
|
||||
delete baseOptions.radius;
|
||||
|
||||
@@ -6,7 +6,6 @@ import EventType from '../events/EventType.js';
|
||||
import LayerProperty from './Property.js';
|
||||
import RenderEventType from '../render/EventType.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {listen, unlistenByKey} from '../events.js';
|
||||
|
||||
/**
|
||||
@@ -95,7 +94,7 @@ class Layer extends BaseLayer {
|
||||
* @param {Options<SourceType>} options Layer options.
|
||||
*/
|
||||
constructor(options) {
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
delete baseOptions.source;
|
||||
|
||||
super(baseOptions);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import BaseVectorLayer from './BaseVector.js';
|
||||
import CanvasVectorImageLayerRenderer from '../renderer/canvas/VectorImageLayer.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/**
|
||||
* @template {import("../source/Vector.js").default} VectorSourceType
|
||||
@@ -69,7 +68,7 @@ class VectorImageLayer extends BaseVectorLayer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
delete baseOptions.imageRatio;
|
||||
super(baseOptions);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import CanvasVectorTileLayerRenderer from '../renderer/canvas/VectorTileLayer.js
|
||||
import TileProperty from './TileProperty.js';
|
||||
import VectorTileRenderType from './VectorTileRenderType.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/***
|
||||
* @template Return
|
||||
@@ -102,7 +101,7 @@ class VectorTileLayer extends BaseVectorLayer {
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
const baseOptions = /** @type {Object} */ (assign({}, options));
|
||||
const baseOptions = /** @type {Object} */ (Object.assign({}, options));
|
||||
delete baseOptions.preload;
|
||||
delete baseOptions.useInterimTilesOnError;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
*/
|
||||
import Layer from './Layer.js';
|
||||
import WebGLPointsLayerRenderer from '../renderer/webgl/PointsLayer.js';
|
||||
import {assign} from '../obj.js';
|
||||
import {parseLiteralStyle} from '../webgl/ShaderBuilder.js';
|
||||
|
||||
/**
|
||||
@@ -77,7 +76,7 @@ class WebGLPointsLayer extends Layer {
|
||||
* @param {Options<VectorSourceType>} options Options.
|
||||
*/
|
||||
constructor(options) {
|
||||
const baseOptions = assign({}, options);
|
||||
const baseOptions = Object.assign({}, options);
|
||||
|
||||
super(baseOptions);
|
||||
|
||||
@@ -120,7 +119,7 @@ class WebGLPointsLayer extends Layer {
|
||||
* @param {Object<string, number>} variables Variables to update.
|
||||
*/
|
||||
updateStyleVariables(variables) {
|
||||
assign(this.styleVariables_, variables);
|
||||
Object.assign(this.styleVariables_, variables);
|
||||
this.changed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
getStringNumberEquivalent,
|
||||
uniformNameForVariable,
|
||||
} from '../style/expressions.js';
|
||||
import {assign} from '../obj.js';
|
||||
|
||||
/**
|
||||
* @typedef {import("../source/DataTile.js").default|import("../source/TileImage.js").default} SourceType
|
||||
@@ -308,7 +307,7 @@ class WebGLTileLayer extends BaseTileLayer {
|
||||
* @param {Options} opt_options Tile layer options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
const options = opt_options ? assign({}, opt_options) : {};
|
||||
const options = opt_options ? Object.assign({}, opt_options) : {};
|
||||
|
||||
const style = options.style || {};
|
||||
delete options.style;
|
||||
@@ -511,7 +510,7 @@ class WebGLTileLayer extends BaseTileLayer {
|
||||
* @api
|
||||
*/
|
||||
updateStyleVariables(variables) {
|
||||
assign(this.styleVariables_, variables);
|
||||
Object.assign(this.styleVariables_, variables);
|
||||
this.changed();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user