diff --git a/src/ol/CanvasMap.js b/src/ol/CanvasMap.js index b43fae5ac4..16f0ffa828 100644 --- a/src/ol/CanvasMap.js +++ b/src/ol/CanvasMap.js @@ -6,7 +6,7 @@ import PluggableMap from './PluggableMap.js'; import PluginType from './PluginType.js'; import {defaults as defaultControls} from './control.js'; import {defaults as defaultInteractions} from './interaction.js'; -import _ol_obj_ from './obj.js'; +import {assign} from './obj.js'; import {register, registerMultiple} from './plugins.js'; import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; import CanvasMapRenderer from './renderer/canvas/Map.js'; @@ -73,7 +73,7 @@ registerMultiple(PluginType.LAYER_RENDERER, [ * @api */ const CanvasMap = function(options) { - options = _ol_obj_.assign({}, options); + options = assign({}, options); delete options.renderer; if (!options.controls) { options.controls = defaultControls(); diff --git a/src/ol/Map.js b/src/ol/Map.js index c4a6647883..50035aeb57 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -6,7 +6,7 @@ import PluggableMap from './PluggableMap.js'; import PluginType from './PluginType.js'; import {defaults as defaultControls} from './control.js'; import {defaults as defaultInteractions} from './interaction.js'; -import _ol_obj_ from './obj.js'; +import {assign} from './obj.js'; import {register, registerMultiple} from './plugins.js'; import CanvasImageLayerRenderer from './renderer/canvas/ImageLayer.js'; import CanvasMapRenderer from './renderer/canvas/Map.js'; @@ -85,7 +85,7 @@ registerMultiple(PluginType.LAYER_RENDERER, [ * @api */ const Map = function(options) { - options = _ol_obj_.assign({}, options); + options = assign({}, options); if (!options.controls) { options.controls = defaultControls(); } diff --git a/src/ol/Object.js b/src/ol/Object.js index f8d3b7d785..4d07db7b78 100644 --- a/src/ol/Object.js +++ b/src/ol/Object.js @@ -5,7 +5,7 @@ import {getUid, inherits} from './index.js'; import ObjectEventType from './ObjectEventType.js'; import Observable from './Observable.js'; import Event from './events/Event.js'; -import _ol_obj_ from './obj.js'; +import {assign} from './obj.js'; /** * @classdesc @@ -124,7 +124,7 @@ BaseObject.prototype.getKeys = function() { * @api */ BaseObject.prototype.getProperties = function() { - return _ol_obj_.assign({}, this.values_); + return assign({}, this.values_); }; diff --git a/src/ol/View.js b/src/ol/View.js index d3f30e86e8..82af07c54a 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -18,7 +18,7 @@ import GeometryType from './geom/GeometryType.js'; import {fromExtent as polygonFromExtent} from './geom/Polygon.js'; import SimpleGeometry from './geom/SimpleGeometry.js'; import {clamp, modulo} from './math.js'; -import _ol_obj_ from './obj.js'; +import {assign} from './obj.js'; import {createProjection, METERS_PER_UNIT} from './proj.js'; import Units from './proj/Units.js'; @@ -89,7 +89,7 @@ const DEFAULT_MIN_ZOOM = 0; const View = function(opt_options) { BaseObject.call(this); - const options = _ol_obj_.assign({}, opt_options); + const options = assign({}, opt_options); /** * @private @@ -217,7 +217,7 @@ View.prototype.applyOptions_ = function(options) { * @return {olx.ViewOptions} New options updated with the current view state. */ View.prototype.getUpdatedOptions_ = function(newOptions) { - const options = _ol_obj_.assign({}, this.options_); + const options = assign({}, this.options_); // preserve resolution (or zoom) if (options.resolution !== undefined) { @@ -232,7 +232,7 @@ View.prototype.getUpdatedOptions_ = function(newOptions) { // preserve rotation options.rotation = this.getRotation(); - return _ol_obj_.assign({}, options, newOptions); + return assign({}, options, newOptions); }; diff --git a/src/ol/events.js b/src/ol/events.js index 76e0f570ee..d52702e25d 100644 --- a/src/ol/events.js +++ b/src/ol/events.js @@ -1,7 +1,7 @@ /** * @module ol/events */ -import _ol_obj_ from './obj.js'; +import {clear} from './obj.js'; const _ol_events_ = {}; @@ -93,7 +93,7 @@ _ol_events_.removeListeners_ = function(target, type) { if (listeners) { for (let i = 0, ii = listeners.length; i < ii; ++i) { target.removeEventListener(type, listeners[i].boundListener); - _ol_obj_.clear(listeners[i]); + clear(listeners[i]); } listeners.length = 0; const listenerMap = target.ol_lm; @@ -223,7 +223,7 @@ _ol_events_.unlistenByKey = function(key) { _ol_events_.removeListeners_(key.target, key.type); } } - _ol_obj_.clear(key); + clear(key); } }; diff --git a/src/ol/format/EsriJSON.js b/src/ol/format/EsriJSON.js index 7d270a23fa..ce0f6111ec 100644 --- a/src/ol/format/EsriJSON.js +++ b/src/ol/format/EsriJSON.js @@ -18,7 +18,7 @@ import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; import _ol_geom_flat_deflate_ from '../geom/flat/deflate.js'; import _ol_geom_flat_orient_ from '../geom/flat/orient.js'; -import _ol_obj_ from '../obj.js'; +import {assign, isEmpty} from '../obj.js'; import {get as getProjection} from '../proj.js'; /** @@ -73,7 +73,7 @@ EsriJSON.readGeometry_ = function(object, opt_options) { } else if (object.rings) { const layout = EsriJSON.getGeometryLayout_(object); const rings = EsriJSON.convertRings_(object.rings, layout); - object = /** @type {EsriJSONGeometry} */(_ol_obj_.assign({}, object)); + object = /** @type {EsriJSONGeometry} */(assign({}, object)); if (rings.length === 1) { type = GeometryType.POLYGON; object.rings = rings[0]; @@ -632,7 +632,7 @@ EsriJSON.prototype.writeFeatureObject = function( } const properties = feature.getProperties(); delete properties[feature.getGeometryName()]; - if (!_ol_obj_.isEmpty(properties)) { + if (!isEmpty(properties)) { object['attributes'] = properties; } else { object['attributes'] = {}; diff --git a/src/ol/format/Feature.js b/src/ol/format/Feature.js index 803d40740a..af12784f1b 100644 --- a/src/ol/format/Feature.js +++ b/src/ol/format/Feature.js @@ -2,7 +2,7 @@ * @module ol/format/Feature */ import Geometry from '../geom/Geometry.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection, equivalent as equivalentProjection, transformExtent} from '../proj.js'; /** @@ -65,7 +65,7 @@ FeatureFormat.prototype.getReadOptions = function(source, opt_options) { * Updated options. */ FeatureFormat.prototype.adaptOptions = function(options) { - return _ol_obj_.assign({ + return assign({ dataProjection: this.defaultDataProjection, featureProjection: this.defaultFeatureProjection }, options); diff --git a/src/ol/format/GML2.js b/src/ol/format/GML2.js index 8a23ae76c5..fdd2c452b1 100644 --- a/src/ol/format/GML2.js +++ b/src/ol/format/GML2.js @@ -7,7 +7,7 @@ import {transformWithOptions} from '../format/Feature.js'; import GMLBase from '../format/GMLBase.js'; import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection, transformExtent} from '../proj.js'; import _ol_xml_ from '../xml.js'; @@ -268,7 +268,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) { } } } - const item = _ol_obj_.assign({}, context); + const item = assign({}, context); item.node = node; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (item), context.serializers, @@ -285,7 +285,7 @@ GML2.prototype.writeFeatureElement = function(node, feature, objectStack) { */ GML2.prototype.writeGeometryElement = function(node, geometry, objectStack) { const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); - const item = _ol_obj_.assign({}, context); + const item = assign({}, context); item.node = node; let value; if (Array.isArray(geometry)) { diff --git a/src/ol/format/GML3.js b/src/ol/format/GML3.js index 1f2f88895f..1fc3eb4edf 100644 --- a/src/ol/format/GML3.js +++ b/src/ol/format/GML3.js @@ -13,7 +13,7 @@ import LineString from '../geom/LineString.js'; import MultiLineString from '../geom/MultiLineString.js'; import MultiPolygon from '../geom/MultiPolygon.js'; import Polygon from '../geom/Polygon.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection, transformExtent} from '../proj.js'; import _ol_xml_ from '../xml.js'; @@ -951,7 +951,7 @@ GML3.prototype.writeCurveSegments_ = function(node, line, objectStack) { */ GML3.prototype.writeGeometryElement = function(node, geometry, objectStack) { const context = /** @type {olx.format.WriteOptions} */ (objectStack[objectStack.length - 1]); - const item = _ol_obj_.assign({}, context); + const item = assign({}, context); item.node = node; let value; if (Array.isArray(geometry)) { @@ -1009,7 +1009,7 @@ GML3.prototype.writeFeatureElement = function(node, feature, objectStack) { } } } - const item = _ol_obj_.assign({}, context); + const item = assign({}, context); item.node = node; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (item), context.serializers, @@ -1033,7 +1033,7 @@ GML3.prototype.writeFeatureMembers_ = function(node, features, objectStack) { serializers[featureNS] = {}; serializers[featureNS][featureType] = _ol_xml_.makeChildAppender( this.writeFeatureElement, this); - const item = _ol_obj_.assign({}, context); + const item = assign({}, context); item.node = node; _ol_xml_.pushSerializeAndPop(/** @type {ol.XmlNodeStackItem} */ (item), @@ -1206,7 +1206,7 @@ GML3.prototype.writeGeometryNode = function(geometry, opt_options) { curve: this.curve_, surface: this.surface_, multiSurface: this.multiSurface_, multiCurve: this.multiCurve_}; if (opt_options) { - _ol_obj_.assign(context, opt_options); + assign(context, opt_options); } this.writeGeometryElement(geom, geometry, [context]); return geom; @@ -1251,7 +1251,7 @@ GML3.prototype.writeFeaturesNode = function(features, opt_options) { featureType: this.featureType }; if (opt_options) { - _ol_obj_.assign(context, opt_options); + assign(context, opt_options); } this.writeFeatureMembers_(node, features, [context]); return node; diff --git a/src/ol/format/GMLBase.js b/src/ol/format/GMLBase.js index ba99c01cd9..d83087121c 100644 --- a/src/ol/format/GMLBase.js +++ b/src/ol/format/GMLBase.js @@ -17,7 +17,7 @@ import MultiPoint from '../geom/MultiPoint.js'; import MultiPolygon from '../geom/MultiPolygon.js'; import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection} from '../proj.js'; import _ol_xml_ from '../xml.js'; @@ -584,7 +584,7 @@ GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) { featureNS: this.featureNS }; if (opt_options) { - _ol_obj_.assign(options, this.getReadOptions(node, opt_options)); + assign(options, this.getReadOptions(node, opt_options)); } const features = this.readFeaturesInternal(node, [options]); return features || []; diff --git a/src/ol/format/GeoJSON.js b/src/ol/format/GeoJSON.js index 9ed1e7aae6..3e6cabc00d 100644 --- a/src/ol/format/GeoJSON.js +++ b/src/ol/format/GeoJSON.js @@ -16,7 +16,7 @@ import MultiPoint from '../geom/MultiPoint.js'; import MultiPolygon from '../geom/MultiPolygon.js'; import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; -import _ol_obj_ from '../obj.js'; +import {assign, isEmpty} from '../obj.js'; import {get as getProjection} from '../proj.js'; /** @@ -216,7 +216,7 @@ function writeEmptyGeometryCollectionGeometry(geometry) { */ function writeGeometryCollectionGeometry(geometry, opt_options) { const geometries = geometry.getGeometriesArray().map(function(geometry) { - const options = _ol_obj_.assign({}, opt_options); + const options = assign({}, opt_options); delete options.featureProjection; return writeGeometry(geometry, options); }); @@ -492,7 +492,7 @@ GeoJSON.prototype.writeFeatureObject = function(feature, opt_options) { } const properties = feature.getProperties(); delete properties[feature.getGeometryName()]; - if (!_ol_obj_.isEmpty(properties)) { + if (!isEmpty(properties)) { object.properties = properties; } else { object.properties = null; diff --git a/src/ol/format/OSMXML.js b/src/ol/format/OSMXML.js index a26536dbf5..b85d2486d7 100644 --- a/src/ol/format/OSMXML.js +++ b/src/ol/format/OSMXML.js @@ -11,7 +11,7 @@ import GeometryLayout from '../geom/GeometryLayout.js'; import LineString from '../geom/LineString.js'; import Point from '../geom/Point.js'; import Polygon from '../geom/Polygon.js'; -import _ol_obj_ from '../obj.js'; +import {isEmpty} from '../obj.js'; import {get as getProjection} from '../proj.js'; import _ol_xml_ from '../xml.js'; @@ -55,7 +55,7 @@ OSMXML.readNode_ = function(node, objectStack) { const values = _ol_xml_.pushParseAndPop({ tags: {} }, OSMXML.NODE_PARSERS_, node, objectStack); - if (!_ol_obj_.isEmpty(values.tags)) { + if (!isEmpty(values.tags)) { const geometry = new Point(coordinates); transformWithOptions(geometry, false, options); const feature = new Feature(geometry); diff --git a/src/ol/format/WFS.js b/src/ol/format/WFS.js index 724a51917d..a423f27e2d 100644 --- a/src/ol/format/WFS.js +++ b/src/ol/format/WFS.js @@ -10,7 +10,7 @@ import _ol_format_filter_ from '../format/filter.js'; import XMLFeature from '../format/XMLFeature.js'; import XSD from '../format/XSD.js'; import Geometry from '../geom/Geometry.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection} from '../proj.js'; import _ol_xml_ from '../xml.js'; @@ -153,8 +153,7 @@ WFS.prototype.readFeaturesFromNode = function(node, opt_options) { 'featureType': this.featureType_, 'featureNS': this.featureNS_ }); - _ol_obj_.assign(context, this.getReadOptions(node, - opt_options ? opt_options : {})); + assign(context, this.getReadOptions(node, opt_options ? opt_options : {})); const objectStack = [context]; this.gmlFormat_.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS][ 'featureMember'] = @@ -599,7 +598,7 @@ WFS.writeQuery_ = function(node, featureType, objectStack) { _ol_xml_.setAttributeNS(node, WFS.XMLNS, 'xmlns:' + featurePrefix, featureNS); } - const item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); + const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, WFS.QUERY_SERIALIZERS_, @@ -916,7 +915,7 @@ WFS.writeFilter = function(filter) { */ WFS.writeGetFeature_ = function(node, featureTypes, objectStack) { const context = /** @type {Object} */ (objectStack[objectStack.length - 1]); - const item = /** @type {ol.XmlNodeStackItem} */ (_ol_obj_.assign({}, context)); + const item = /** @type {ol.XmlNodeStackItem} */ (assign({}, context)); item.node = node; _ol_xml_.pushSerializeAndPop(item, WFS.GETFEATURE_SERIALIZERS_, @@ -1025,7 +1024,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes, obj = {node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; - _ol_obj_.assign(obj, baseObj); + assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Insert'), inserts, @@ -1035,7 +1034,7 @@ WFS.prototype.writeTransaction = function(inserts, updates, deletes, obj = {node: node, 'featureNS': options.featureNS, 'featureType': options.featureType, 'featurePrefix': featurePrefix, 'gmlVersion': gmlVersion, 'hasZ': options.hasZ, 'srsName': options.srsName}; - _ol_obj_.assign(obj, baseObj); + assign(obj, baseObj); _ol_xml_.pushSerializeAndPop(obj, WFS.TRANSACTION_SERIALIZERS_, _ol_xml_.makeSimpleNodeFactory('Update'), updates, diff --git a/src/ol/format/WMSGetFeatureInfo.js b/src/ol/format/WMSGetFeatureInfo.js index 72502cdf86..dc91a2e4ed 100644 --- a/src/ol/format/WMSGetFeatureInfo.js +++ b/src/ol/format/WMSGetFeatureInfo.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import {extend, includes} from '../array.js'; import GML2 from '../format/GML2.js'; import XMLFeature from '../format/XMLFeature.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import _ol_xml_ from '../xml.js'; /** @@ -158,7 +158,7 @@ WMSGetFeatureInfo.prototype.readFeatures; WMSGetFeatureInfo.prototype.readFeaturesFromNode = function(node, opt_options) { const options = {}; if (opt_options) { - _ol_obj_.assign(options, this.getReadOptions(node, opt_options)); + assign(options, this.getReadOptions(node, opt_options)); } return this.readFeatures_(node, [options]); }; diff --git a/src/ol/geom/GeometryCollection.js b/src/ol/geom/GeometryCollection.js index 664714cfb3..4294fda6df 100644 --- a/src/ol/geom/GeometryCollection.js +++ b/src/ol/geom/GeometryCollection.js @@ -7,7 +7,7 @@ import EventType from '../events/EventType.js'; import {createOrUpdateEmpty, closestSquaredDistanceXY, extend, getCenter} from '../extent.js'; import Geometry from '../geom/Geometry.js'; import GeometryType from '../geom/GeometryType.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; /** * @classdesc @@ -162,7 +162,7 @@ GeometryCollection.prototype.getGeometriesArray = function() { */ GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) { if (this.simplifiedGeometryRevision != this.getRevision()) { - _ol_obj_.clear(this.simplifiedGeometryCache); + clear(this.simplifiedGeometryCache); this.simplifiedGeometryMaxMinSquaredTolerance = 0; this.simplifiedGeometryRevision = this.getRevision(); } diff --git a/src/ol/geom/SimpleGeometry.js b/src/ol/geom/SimpleGeometry.js index 3ab9b421d1..409f490597 100644 --- a/src/ol/geom/SimpleGeometry.js +++ b/src/ol/geom/SimpleGeometry.js @@ -7,7 +7,7 @@ import {createOrUpdateFromFlatCoordinates, getCenter} from '../extent.js'; import Geometry from '../geom/Geometry.js'; import GeometryLayout from '../geom/GeometryLayout.js'; import _ol_geom_flat_transform_ from '../geom/flat/transform.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; /** * @classdesc @@ -145,7 +145,7 @@ SimpleGeometry.prototype.getLayout = function() { */ SimpleGeometry.prototype.getSimplifiedGeometry = function(squaredTolerance) { if (this.simplifiedGeometryRevision != this.getRevision()) { - _ol_obj_.clear(this.simplifiedGeometryCache); + clear(this.simplifiedGeometryCache); this.simplifiedGeometryMaxMinSquaredTolerance = 0; this.simplifiedGeometryRevision = this.getRevision(); } diff --git a/src/ol/interaction/Pointer.js b/src/ol/interaction/Pointer.js index 93e3abf9ac..fb242c681c 100644 --- a/src/ol/interaction/Pointer.js +++ b/src/ol/interaction/Pointer.js @@ -6,7 +6,7 @@ import {FALSE} from '../functions.js'; import MapBrowserEventType from '../MapBrowserEventType.js'; import MapBrowserPointerEvent from '../MapBrowserPointerEvent.js'; import Interaction from '../interaction/Interaction.js'; -import _ol_obj_ from '../obj.js'; +import {getValues} from '../obj.js'; /** * @classdesc @@ -133,7 +133,7 @@ PointerInteraction.prototype.updateTrackedPointers_ = function(mapBrowserEvent) // update only when there was a pointerdown event for this pointer this.trackedPointers_[id] = event; } - this.targetPointers = _ol_obj_.getValues(this.trackedPointers_); + this.targetPointers = getValues(this.trackedPointers_); } }; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index 041283a962..84c21ad51f 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -11,7 +11,7 @@ import {TRUE} from '../functions.js'; import GeometryType from '../geom/GeometryType.js'; import Interaction from '../interaction/Interaction.js'; import VectorLayer from '../layer/Vector.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; import VectorSource from '../source/Vector.js'; import Style from '../style/Style.js'; @@ -215,7 +215,7 @@ Select.handleEvent = function(mapBrowserEvent) { // Replace the currently selected feature(s) with the feature(s) at the // pixel, or clear the selected feature(s) if there is no feature at // the pixel. - _ol_obj_.clear(this.featureLayerAssociation_); + clear(this.featureLayerAssociation_); map.forEachFeatureAtPixel(mapBrowserEvent.pixel, ( /** diff --git a/src/ol/interaction/Snap.js b/src/ol/interaction/Snap.js index aafdca67ae..e098282829 100644 --- a/src/ol/interaction/Snap.js +++ b/src/ol/interaction/Snap.js @@ -12,7 +12,7 @@ import {TRUE, FALSE} from '../functions.js'; import GeometryType from '../geom/GeometryType.js'; import {fromCircle} from '../geom/Polygon.js'; import PointerInteraction from '../interaction/Pointer.js'; -import _ol_obj_ from '../obj.js'; +import {getValues} from '../obj.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; import RBush from '../structs/RBush.js'; @@ -611,7 +611,7 @@ Snap.handleEvent_ = function(evt) { * @private */ Snap.handleUpEvent_ = function(evt) { - const featuresToUpdate = _ol_obj_.getValues(this.pendingFeatures_); + const featuresToUpdate = getValues(this.pendingFeatures_); if (featuresToUpdate.length) { featuresToUpdate.forEach(this.updateFeature_.bind(this)); this.pendingFeatures_ = {}; diff --git a/src/ol/layer/Base.js b/src/ol/layer/Base.js index 1879cd3952..e0368f0991 100644 --- a/src/ol/layer/Base.js +++ b/src/ol/layer/Base.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import BaseObject from '../Object.js'; import LayerProperty from '../layer/Property.js'; import {clamp} from '../math.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; /** * @classdesc @@ -28,7 +28,7 @@ const BaseLayer = function(options) { /** * @type {Object.} */ - const properties = _ol_obj_.assign({}, options); + const properties = assign({}, options); properties[LayerProperty.OPACITY] = options.opacity !== undefined ? options.opacity : 1; properties[LayerProperty.VISIBLE] = diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 3711d554d7..32292d0f17 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -11,7 +11,7 @@ import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {getIntersection} from '../extent.js'; import BaseLayer from '../layer/Base.js'; -import _ol_obj_ from '../obj.js'; +import {assign, clear} from '../obj.js'; import SourceState from '../source/State.js'; @@ -38,8 +38,7 @@ const Property = { const LayerGroup = function(opt_options) { const options = opt_options || {}; - const baseOptions = /** @type {olx.layer.GroupOptions} */ - (_ol_obj_.assign({}, options)); + const baseOptions = /** @type {olx.layer.GroupOptions} */ (assign({}, options)); delete baseOptions.layers; let layers = options.layers; @@ -107,7 +106,7 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) { for (const id in this.listenerKeys_) { this.listenerKeys_[id].forEach(_ol_events_.unlistenByKey); } - _ol_obj_.clear(this.listenerKeys_); + clear(this.listenerKeys_); const layersArray = layers.getArray(); let i, ii, layer; diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 0972668981..0a4e691f39 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -7,7 +7,7 @@ import BaseObject from '../Object.js'; import {createCanvasContext2D} from '../dom.js'; import VectorLayer from '../layer/Vector.js'; import {clamp} from '../math.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import RenderEventType from '../render/EventType.js'; import Icon from '../style/Icon.js'; import Style from '../style/Style.js'; @@ -47,7 +47,7 @@ const DEFAULT_GRADIENT = ['#00f', '#0ff', '#0f0', '#ff0', '#f00']; const Heatmap = function(opt_options) { const options = opt_options ? opt_options : {}; - const baseOptions = _ol_obj_.assign({}, options); + const baseOptions = assign({}, options); delete baseOptions.gradient; delete baseOptions.radius; diff --git a/src/ol/layer/Layer.js b/src/ol/layer/Layer.js index db938ed941..7ce757d145 100644 --- a/src/ol/layer/Layer.js +++ b/src/ol/layer/Layer.js @@ -7,7 +7,7 @@ import {getUid, inherits} from '../index.js'; import BaseObject from '../Object.js'; import BaseLayer from '../layer/Base.js'; import LayerProperty from '../layer/Property.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import RenderEventType from '../render/EventType.js'; import SourceState from '../source/State.js'; @@ -35,7 +35,7 @@ import SourceState from '../source/State.js'; */ const Layer = function(options) { - const baseOptions = _ol_obj_.assign({}, options); + const baseOptions = assign({}, options); delete baseOptions.source; BaseLayer.call(this, /** @type {olx.layer.BaseOptions} */ (baseOptions)); diff --git a/src/ol/layer/Tile.js b/src/ol/layer/Tile.js index 1ff1a4860f..952b112f11 100644 --- a/src/ol/layer/Tile.js +++ b/src/ol/layer/Tile.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; import Layer from '../layer/Layer.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; /** * @classdesc @@ -24,7 +24,7 @@ import _ol_obj_ from '../obj.js'; const TileLayer = function(opt_options) { const options = opt_options ? opt_options : {}; - const baseOptions = _ol_obj_.assign({}, options); + const baseOptions = assign({}, options); delete baseOptions.preload; delete baseOptions.useInterimTilesOnError; diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index cd3febfd96..e5f379c0bf 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import LayerType from '../LayerType.js'; import Layer from '../layer/Layer.js'; import _ol_layer_VectorRenderType_ from '../layer/VectorRenderType.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import Style from '../style/Style.js'; @@ -35,7 +35,7 @@ const VectorLayer = function(opt_options) { const options = opt_options ? opt_options : /** @type {olx.layer.VectorOptions} */ ({}); - const baseOptions = _ol_obj_.assign({}, options); + const baseOptions = assign({}, options); delete baseOptions.style; delete baseOptions.renderBuffer; diff --git a/src/ol/layer/VectorTile.js b/src/ol/layer/VectorTile.js index 44a4b28c81..dd03debdb9 100644 --- a/src/ol/layer/VectorTile.js +++ b/src/ol/layer/VectorTile.js @@ -7,7 +7,7 @@ import {assert} from '../asserts.js'; import _ol_layer_TileProperty_ from '../layer/TileProperty.js'; import VectorLayer from '../layer/Vector.js'; import _ol_layer_VectorTileRenderType_ from '../layer/VectorTileRenderType.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; /** * @classdesc @@ -35,7 +35,7 @@ const VectorTileLayer = function(opt_options) { } options.renderMode = renderMode; - const baseOptions = _ol_obj_.assign({}, options); + const baseOptions = assign({}, options); delete baseOptions.preload; delete baseOptions.useInterimTilesOnError; diff --git a/src/ol/obj.js b/src/ol/obj.js index 2b5c0ec970..ef6ecf3fcf 100644 --- a/src/ol/obj.js +++ b/src/ol/obj.js @@ -1,7 +1,6 @@ /** * @module ol/obj */ -const _ol_obj_ = {}; /** @@ -13,7 +12,7 @@ const _ol_obj_ = {}; * @param {...Object} var_sources The source object(s). * @return {!Object} The modified target object. */ -_ol_obj_.assign = (typeof Object.assign === 'function') ? Object.assign : function(target, var_sources) { +export const assign = (typeof Object.assign === 'function') ? Object.assign : function(target, var_sources) { if (target === undefined || target === null) { throw new TypeError('Cannot convert undefined or null to object'); } @@ -37,11 +36,11 @@ _ol_obj_.assign = (typeof Object.assign === 'function') ? Object.assign : functi * Removes all properties from an object. * @param {Object} object The object to clear. */ -_ol_obj_.clear = function(object) { +export function clear(object) { for (const property in object) { delete object[property]; } -}; +} /** @@ -50,13 +49,13 @@ _ol_obj_.clear = function(object) { * @return {!Array} The property values. * @template K,V */ -_ol_obj_.getValues = function(object) { +export function getValues(object) { const values = []; for (const property in object) { values.push(object[property]); } return values; -}; +} /** @@ -64,11 +63,10 @@ _ol_obj_.getValues = function(object) { * @param {Object} object The object to check. * @return {boolean} The object is empty. */ -_ol_obj_.isEmpty = function(object) { +export function isEmpty(object) { let property; for (property in object) { return false; } return !property; -}; -export default _ol_obj_; +} diff --git a/src/ol/proj/transforms.js b/src/ol/proj/transforms.js index 8815d151f3..6d3536fd11 100644 --- a/src/ol/proj/transforms.js +++ b/src/ol/proj/transforms.js @@ -1,7 +1,7 @@ /** * @module ol/proj/transforms */ -import _ol_obj_ from '../obj.js'; +import {isEmpty} from '../obj.js'; /** @@ -51,7 +51,7 @@ export function remove(source, destination) { const destinationCode = destination.getCode(); const transform = transforms[sourceCode][destinationCode]; delete transforms[sourceCode][destinationCode]; - if (_ol_obj_.isEmpty(transforms[sourceCode])) { + if (isEmpty(transforms[sourceCode])) { delete transforms[sourceCode]; } return transform; diff --git a/src/ol/render/canvas.js b/src/ol/render/canvas.js index 9c8f8d8154..cf62150e1c 100644 --- a/src/ol/render/canvas.js +++ b/src/ol/render/canvas.js @@ -3,7 +3,7 @@ */ import {getFontFamilies} from '../css.js'; import {createCanvasContext2D} from '../dom.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; import LRUCache from '../structs/LRUCache.js'; import _ol_transform_ from '../transform.js'; const _ol_render_canvas_ = {}; @@ -155,7 +155,7 @@ _ol_render_canvas_.checkFont = (function() { if (checked[font] < retries) { if (isAvailable(font)) { checked[font] = retries; - _ol_obj_.clear(_ol_render_canvas_.textHeights_); + clear(_ol_render_canvas_.textHeights_); // Make sure that loaded fonts are picked up by Safari _ol_render_canvas_.measureContext_ = null; labelCache.clear(); diff --git a/src/ol/render/canvas/Replay.js b/src/ol/render/canvas/Replay.js index 113d88ae07..e3f5c90dfd 100644 --- a/src/ol/render/canvas/Replay.js +++ b/src/ol/render/canvas/Replay.js @@ -13,7 +13,7 @@ import _ol_geom_flat_length_ from '../../geom/flat/length.js'; import _ol_geom_flat_textpath_ from '../../geom/flat/textpath.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_has_ from '../../has.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import VectorContext from '../VectorContext.js'; import _ol_render_canvas_ from '../canvas.js'; import _ol_render_canvas_Instruction_ from '../canvas/Instruction.js'; @@ -556,7 +556,7 @@ CanvasReplay.prototype.replay_ = function( transform, this.pixelCoordinates_); _ol_transform_.setFromArray(this.renderedTransform_, transform); } - const skipFeatures = !_ol_obj_.isEmpty(skippedFeaturesHash); + const skipFeatures = !isEmpty(skippedFeaturesHash); let i = 0; // instruction index const ii = instructions.length; // end of instructions let d = 0; // data index diff --git a/src/ol/render/canvas/ReplayGroup.js b/src/ol/render/canvas/ReplayGroup.js index 6f5c085620..73d3613484 100644 --- a/src/ol/render/canvas/ReplayGroup.js +++ b/src/ol/render/canvas/ReplayGroup.js @@ -6,7 +6,7 @@ import {numberSafeCompareFunction} from '../../array.js'; import {createCanvasContext2D} from '../../dom.js'; import {buffer, createEmpty, extendCoordinate} from '../../extent.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import ReplayGroup from '../ReplayGroup.js'; import ReplayType from '../ReplayType.js'; import CanvasReplay from '../canvas/Replay.js'; @@ -434,7 +434,7 @@ CanvasReplayGroup.prototype.getReplays = function() { * @inheritDoc */ CanvasReplayGroup.prototype.isEmpty = function() { - return _ol_obj_.isEmpty(this.replaysByZIndex_); + return isEmpty(this.replaysByZIndex_); }; diff --git a/src/ol/render/webgl/CircleReplay.js b/src/ol/render/webgl/CircleReplay.js index 05f0d75590..49b194b54a 100644 --- a/src/ol/render/webgl/CircleReplay.js +++ b/src/ol/render/webgl/CircleReplay.js @@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js'; import {equals} from '../../array.js'; import {asArray} from '../../color.js'; import {intersects} from '../../extent.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_render_webgl_circlereplay_defaultshader_ from '../webgl/circlereplay/defaultshader.js'; import _ol_render_webgl_circlereplay_defaultshader_Locations_ from '../webgl/circlereplay/defaultshader/Locations.js'; @@ -246,7 +246,7 @@ WebGLCircleReplay.prototype.shutDownProgram = function(gl, locations) { * @inheritDoc */ WebGLCircleReplay.prototype.drawReplay = function(gl, context, skippedFeaturesHash, hitDetection) { - if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { + if (!isEmpty(skippedFeaturesHash)) { this.drawReplaySkipping_(gl, context, skippedFeaturesHash); } else { //Draw by style groups to minimize drawElements() calls. diff --git a/src/ol/render/webgl/LineStringReplay.js b/src/ol/render/webgl/LineStringReplay.js index cba35d6684..e0d2dbabd7 100644 --- a/src/ol/render/webgl/LineStringReplay.js +++ b/src/ol/render/webgl/LineStringReplay.js @@ -8,7 +8,7 @@ import {intersects} from '../../extent.js'; import _ol_geom_flat_orient_ from '../../geom/flat/orient.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; import _ol_geom_flat_topology_ from '../../geom/flat/topology.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import _ol_render_webgl_ from '../webgl.js'; import WebGLReplay from '../webgl/Replay.js'; import _ol_render_webgl_linestringreplay_defaultshader_ from '../webgl/linestringreplay/defaultshader.js'; @@ -506,7 +506,7 @@ WebGLLineStringReplay.prototype.drawReplay = function(gl, context, skippedFeatur gl.depthFunc(gl.NOTEQUAL); } - if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { + if (!isEmpty(skippedFeaturesHash)) { this.drawReplaySkipping_(gl, context, skippedFeaturesHash); } else { //Draw by style groups to minimize drawElements() calls. diff --git a/src/ol/render/webgl/PolygonReplay.js b/src/ol/render/webgl/PolygonReplay.js index 9cbe834e86..d127a26673 100644 --- a/src/ol/render/webgl/PolygonReplay.js +++ b/src/ol/render/webgl/PolygonReplay.js @@ -5,7 +5,7 @@ import {getUid, inherits} from '../../index.js'; import {equals} from '../../array.js'; import {asArray} from '../../color.js'; import {intersects} from '../../extent.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import _ol_geom_flat_contains_ from '../../geom/flat/contains.js'; import _ol_geom_flat_orient_ from '../../geom/flat/orient.js'; import _ol_geom_flat_transform_ from '../../geom/flat/transform.js'; @@ -924,7 +924,7 @@ WebGLPolygonReplay.prototype.drawReplay = function(gl, context, skippedFeaturesH gl.depthFunc(gl.NOTEQUAL); } - if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { + if (!isEmpty(skippedFeaturesHash)) { this.drawReplaySkipping_(gl, context, skippedFeaturesHash); } else { //Draw by style groups to minimize drawElements() calls. diff --git a/src/ol/render/webgl/ReplayGroup.js b/src/ol/render/webgl/ReplayGroup.js index 4e04289346..db0c78a5f2 100644 --- a/src/ol/render/webgl/ReplayGroup.js +++ b/src/ol/render/webgl/ReplayGroup.js @@ -4,7 +4,7 @@ import {inherits} from '../../index.js'; import {numberSafeCompareFunction} from '../../array.js'; import {buffer, createOrUpdateFromCoordinate} from '../../extent.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import _ol_render_replay_ from '../replay.js'; import ReplayGroup from '../ReplayGroup.js'; import WebGLCircleReplay from '../webgl/CircleReplay.js'; @@ -127,7 +127,7 @@ WebGLReplayGroup.prototype.getReplay = function(zIndex, replayType) { * @inheritDoc */ WebGLReplayGroup.prototype.isEmpty = function() { - return _ol_obj_.isEmpty(this.replaysByZIndex_); + return isEmpty(this.replaysByZIndex_); }; diff --git a/src/ol/render/webgl/TextureReplay.js b/src/ol/render/webgl/TextureReplay.js index 6efc3e9ae4..7035c785a1 100644 --- a/src/ol/render/webgl/TextureReplay.js +++ b/src/ol/render/webgl/TextureReplay.js @@ -3,7 +3,7 @@ */ import {getUid, inherits} from '../../index.js'; import {intersects} from '../../extent.js'; -import _ol_obj_ from '../../obj.js'; +import {isEmpty} from '../../obj.js'; import _ol_render_webgl_texturereplay_defaultshader_ from '../webgl/texturereplay/defaultshader.js'; import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../webgl/texturereplay/defaultshader/Locations.js'; import WebGLReplay from '../webgl/Replay.js'; @@ -331,9 +331,8 @@ WebGLTextureReplay.prototype.drawReplay = function(gl, context, skippedFeaturesH const textures = hitDetection ? this.getHitDetectionTextures() : this.getTextures(); const groupIndices = hitDetection ? this.hitDetectionGroupIndices : this.groupIndices; - if (!_ol_obj_.isEmpty(skippedFeaturesHash)) { - this.drawReplaySkipping( - gl, context, skippedFeaturesHash, textures, groupIndices); + if (!isEmpty(skippedFeaturesHash)) { + this.drawReplaySkipping(gl, context, skippedFeaturesHash, textures, groupIndices); } else { let i, ii, start; for (i = 0, ii = textures.length, start = 0; i < ii; ++i) { diff --git a/src/ol/renderer/canvas/ImageLayer.js b/src/ol/renderer/canvas/ImageLayer.js index 3a5f3b18da..baba5a0f12 100644 --- a/src/ol/renderer/canvas/ImageLayer.js +++ b/src/ol/renderer/canvas/ImageLayer.js @@ -9,7 +9,7 @@ import ViewHint from '../../ViewHint.js'; import {equals} from '../../array.js'; import {getHeight, getIntersection, getWidth, isEmpty} from '../../extent.js'; import _ol_layer_VectorRenderType_ from '../../layer/VectorRenderType.js'; -import _ol_obj_ from '../../obj.js'; +import {assign} from '../../obj.js'; import {getLayerRendererPlugins} from '../../plugins.js'; import RendererType from '../Type.js'; import IntermediateCanvasRenderer from '../canvas/IntermediateCanvas.js'; @@ -137,12 +137,12 @@ CanvasImageLayerRenderer.prototype.prepareFrame = function(frameState, layerStat const vectorRenderer = this.vectorRenderer_; if (vectorRenderer) { const context = vectorRenderer.context; - const imageFrameState = /** @type {olx.FrameState} */ (_ol_obj_.assign({}, frameState, { + const imageFrameState = /** @type {olx.FrameState} */ (assign({}, frameState, { size: [ getWidth(renderedExtent) / viewResolution, getHeight(renderedExtent) / viewResolution ], - viewState: /** @type {olx.ViewState} */ (_ol_obj_.assign({}, frameState.viewState, { + viewState: /** @type {olx.ViewState} */ (assign({}, frameState.viewState, { rotation: 0 })) })); diff --git a/src/ol/source/CartoDB.js b/src/ol/source/CartoDB.js index a0eb0c1fe0..a262b79539 100644 --- a/src/ol/source/CartoDB.js +++ b/src/ol/source/CartoDB.js @@ -2,7 +2,7 @@ * @module ol/source/CartoDB */ import {inherits} from '../index.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import SourceState from '../source/State.js'; import XYZ from '../source/XYZ.js'; @@ -74,7 +74,7 @@ CartoDB.prototype.getConfig = function() { * @api */ CartoDB.prototype.updateConfig = function(config) { - _ol_obj_.assign(this.config_, config); + assign(this.config_, config); this.initializeMap_(); }; diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index db617cb67e..c805bf79ea 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -7,7 +7,7 @@ import {assert} from '../asserts.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getHeight, getWidth} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import ImageSource from '../source/Image.js'; import {appendParams} from '../uri.js'; @@ -136,7 +136,7 @@ ImageArcGISRest.prototype.getImageInternal = function(extent, resolution, pixelR 'FORMAT': 'PNG32', 'TRANSPARENT': true }; - _ol_obj_.assign(params, this.params_); + assign(params, this.params_); extent = extent.slice(); const centerX = (extent[0] + extent[2]) / 2; @@ -264,7 +264,7 @@ ImageArcGISRest.prototype.setUrl = function(url) { * @api */ ImageArcGISRest.prototype.updateParams = function(params) { - _ol_obj_.assign(this.params_, params); + assign(this.params_, params); this.image_ = null; this.changed(); }; diff --git a/src/ol/source/ImageMapGuide.js b/src/ol/source/ImageMapGuide.js index 4b128ef038..87ea2df91c 100644 --- a/src/ol/source/ImageMapGuide.js +++ b/src/ol/source/ImageMapGuide.js @@ -6,7 +6,7 @@ import _ol_Image_ from '../Image.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getCenter, getHeight, getWidth, scaleFromCenter} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import ImageSource from '../source/Image.js'; import {appendParams} from '../uri.js'; @@ -193,7 +193,7 @@ ImageMapGuide.getScale = function(extent, size, metersPerUnit, dpi) { * @api */ ImageMapGuide.prototype.updateParams = function(params) { - _ol_obj_.assign(this.params_, params); + assign(this.params_, params); this.changed(); }; @@ -223,7 +223,7 @@ ImageMapGuide.prototype.getUrl = function(baseUrl, params, extent, size, project 'SETVIEWCENTERX': center[0], 'SETVIEWCENTERY': center[1] }; - _ol_obj_.assign(baseParams, params); + assign(baseParams, params); return appendParams(baseUrl, baseParams); }; diff --git a/src/ol/source/ImageWMS.js b/src/ol/source/ImageWMS.js index 4db630d0a2..8529267284 100644 --- a/src/ol/source/ImageWMS.js +++ b/src/ol/source/ImageWMS.js @@ -9,7 +9,7 @@ import {assert} from '../asserts.js'; import _ol_events_ from '../events.js'; import EventType from '../events/EventType.js'; import {containsExtent, getCenter, getForViewAndSize, getHeight, getWidth} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection, transform} from '../proj.js'; import _ol_reproj_ from '../reproj.js'; import ImageSource from '../source/Image.js'; @@ -156,7 +156,7 @@ ImageWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, proje 'TRANSPARENT': true, 'QUERY_LAYERS': this.params_['LAYERS'] }; - _ol_obj_.assign(baseParams, this.params_, params); + assign(baseParams, this.params_, params); const x = Math.floor((coordinate[0] - extent[0]) / resolution); const y = Math.floor((extent[3] - coordinate[1]) / resolution); @@ -223,7 +223,7 @@ ImageWMS.prototype.getImageInternal = function(extent, resolution, pixelRatio, p 'FORMAT': 'image/png', 'TRANSPARENT': true }; - _ol_obj_.assign(params, this.params_); + assign(params, this.params_); this.imageSize_[0] = Math.round(getWidth(requestExtent) / imageResolution); this.imageSize_[1] = Math.round(getHeight(requestExtent) / imageResolution); @@ -355,7 +355,7 @@ ImageWMS.prototype.setUrl = function(url) { * @api */ ImageWMS.prototype.updateParams = function(params) { - _ol_obj_.assign(this.params_, params); + assign(this.params_, params); this.updateV13_(); this.image_ = null; this.changed(); diff --git a/src/ol/source/Raster.js b/src/ol/source/Raster.js index 79dc011807..ee81b6f835 100644 --- a/src/ol/source/Raster.js +++ b/src/ol/source/Raster.js @@ -12,7 +12,7 @@ import {Processor} from 'pixelworks'; import {equals, getCenter, getHeight, getWidth} from '../extent.js'; import ImageLayer from '../layer/Image.js'; import TileLayer from '../layer/Tile.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import CanvasImageLayerRenderer from '../renderer/canvas/ImageLayer.js'; import CanvasTileLayerRenderer from '../renderer/canvas/TileLayer.js'; import ImageSource from '../source/Image.js'; @@ -189,11 +189,9 @@ RasterSource.prototype.setOperation = function(operation, opt_lib) { */ RasterSource.prototype.updateFrameState_ = function(extent, resolution, projection) { - const frameState = /** @type {olx.FrameState} */ ( - _ol_obj_.assign({}, this.frameState_)); + const frameState = /** @type {olx.FrameState} */ (assign({}, this.frameState_)); - frameState.viewState = /** @type {olx.ViewState} */ ( - _ol_obj_.assign({}, frameState.viewState)); + frameState.viewState = /** @type {olx.ViewState} */ (assign({}, frameState.viewState)); const center = getCenter(extent); diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index e1f196d0af..e4efff9e8e 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -4,7 +4,7 @@ import {inherits} from '../index.js'; import {createEmpty} from '../extent.js'; import {modulo} from '../math.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import _ol_size_ from '../size.js'; import TileImage from '../source/TileImage.js'; import _ol_tilecoord_ from '../tilecoord.js'; @@ -166,7 +166,7 @@ TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, 'FORMAT': 'PNG32', 'TRANSPARENT': true }; - _ol_obj_.assign(baseParams, this.params_); + assign(baseParams, this.params_); return this.getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, baseParams); @@ -179,7 +179,7 @@ TileArcGISRest.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, * @api */ TileArcGISRest.prototype.updateParams = function(params) { - _ol_obj_.assign(this.params_, params); + assign(this.params_, params); this.setKey(this.getKeyForParams_()); }; export default TileArcGISRest; diff --git a/src/ol/source/TileWMS.js b/src/ol/source/TileWMS.js index eaa1df5706..6c68682f9e 100644 --- a/src/ol/source/TileWMS.js +++ b/src/ol/source/TileWMS.js @@ -6,7 +6,7 @@ import {DEFAULT_WMS_VERSION} from './common.js'; import {inherits} from '../index.js'; import {assert} from '../asserts.js'; import {buffer, createEmpty} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {modulo} from '../math.js'; import {get as getProjection, transform, transformExtent} from '../proj.js'; import _ol_reproj_ from '../reproj.js'; @@ -148,7 +148,7 @@ TileWMS.prototype.getGetFeatureInfoUrl = function(coordinate, resolution, projec 'TRANSPARENT': true, 'QUERY_LAYERS': this.params_['LAYERS'] }; - _ol_obj_.assign(baseParams, this.params_, params); + assign(baseParams, this.params_, params); const x = Math.floor((coordinate[0] - tileExtent[0]) / tileResolution); const y = Math.floor((tileExtent[3] - coordinate[1]) / tileResolution); @@ -317,7 +317,7 @@ TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, project 'FORMAT': 'image/png', 'TRANSPARENT': true }; - _ol_obj_.assign(baseParams, this.params_); + assign(baseParams, this.params_); return this.getRequestUrl_(tileCoord, tileSize, tileExtent, pixelRatio, projection, baseParams); @@ -329,7 +329,7 @@ TileWMS.prototype.fixedTileUrlFunction = function(tileCoord, pixelRatio, project * @api */ TileWMS.prototype.updateParams = function(params) { - _ol_obj_.assign(this.params_, params); + assign(this.params_, params); this.updateV13_(); this.setKey(this.getKeyForParams_()); }; diff --git a/src/ol/source/Vector.js b/src/ol/source/Vector.js index b02b5807d6..4b8da23c6a 100644 --- a/src/ol/source/Vector.js +++ b/src/ol/source/Vector.js @@ -15,7 +15,7 @@ import {containsExtent, equals} from '../extent.js'; import {xhr} from '../featureloader.js'; import {TRUE} from '../functions.js'; import _ol_loadingstrategy_ from '../loadingstrategy.js'; -import _ol_obj_ from '../obj.js'; +import {isEmpty, getValues} from '../obj.js'; import Source from '../source/Source.js'; import SourceState from '../source/State.js'; import VectorEventType from '../source/VectorEventType.js'; @@ -506,8 +506,8 @@ VectorSource.prototype.getFeatures = function() { features = this.featuresCollection_.getArray(); } else if (this.featuresRtree_) { features = this.featuresRtree_.getAll(); - if (!_ol_obj_.isEmpty(this.nullGeometryFeatures_)) { - extend(features, _ol_obj_.getValues(this.nullGeometryFeatures_)); + if (!isEmpty(this.nullGeometryFeatures_)) { + extend(features, getValues(this.nullGeometryFeatures_)); } } return /** @type {Array.} */ (features); @@ -722,8 +722,7 @@ VectorSource.prototype.handleFeatureChange_ = function(event) { * @return {boolean} Is empty. */ VectorSource.prototype.isEmpty = function() { - return this.featuresRtree_.isEmpty() && - _ol_obj_.isEmpty(this.nullGeometryFeatures_); + return this.featuresRtree_.isEmpty() && isEmpty(this.nullGeometryFeatures_); }; diff --git a/src/ol/source/WMTS.js b/src/ol/source/WMTS.js index 182f34ce8a..a95f994c74 100644 --- a/src/ol/source/WMTS.js +++ b/src/ol/source/WMTS.js @@ -5,7 +5,7 @@ import {inherits} from '../index.js'; import {expandUrl, createFromTileUrlFunctions, nullTileUrlFunction} from '../tileurlfunction.js'; import {find, findIndex, includes} from '../array.js'; import {containsExtent} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {assign} from '../obj.js'; import {get as getProjection, equivalent, transformExtent} from '../proj.js'; import TileImage from '../source/TileImage.js'; import WMTSRequestEncoding from '../source/WMTSRequestEncoding.js'; @@ -92,7 +92,7 @@ const WMTS = function(options) { }; if (requestEncoding == WMTSRequestEncoding.KVP) { - _ol_obj_.assign(context, { + assign(context, { 'Service': 'WMTS', 'Request': 'GetTile', 'Version': this.version_, @@ -135,7 +135,7 @@ const WMTS = function(options) { 'TileCol': tileCoord[1], 'TileRow': -tileCoord[2] - 1 }; - _ol_obj_.assign(localContext, dimensions); + assign(localContext, dimensions); let url = template; if (requestEncoding == WMTSRequestEncoding.KVP) { url = appendParams(url, localContext); @@ -280,7 +280,7 @@ WMTS.prototype.getKeyForDimensions_ = function() { * @api */ WMTS.prototype.updateDimensions = function(dimensions) { - _ol_obj_.assign(this.dimensions_, dimensions); + assign(this.dimensions_, dimensions); this.setKey(this.getKeyForDimensions_()); }; diff --git a/src/ol/structs/PriorityQueue.js b/src/ol/structs/PriorityQueue.js index c876855270..7531d2d820 100644 --- a/src/ol/structs/PriorityQueue.js +++ b/src/ol/structs/PriorityQueue.js @@ -2,7 +2,7 @@ * @module ol/structs/PriorityQueue */ import {assert} from '../asserts.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; /** * Priority queue. @@ -67,7 +67,7 @@ PriorityQueue.DROP = Infinity; PriorityQueue.prototype.clear = function() { this.elements_.length = 0; this.priorities_.length = 0; - _ol_obj_.clear(this.queuedElements_); + clear(this.queuedElements_); }; diff --git a/src/ol/structs/RBush.js b/src/ol/structs/RBush.js index 5c3ea43bd0..90afa86aef 100644 --- a/src/ol/structs/RBush.js +++ b/src/ol/structs/RBush.js @@ -4,7 +4,7 @@ import {getUid} from '../index.js'; import rbush from 'rbush'; import {createOrUpdate, equals} from '../extent.js'; -import _ol_obj_ from '../obj.js'; +import {isEmpty} from '../obj.js'; /** * Wrapper around the RBush by Vladimir Agafonkin. @@ -193,7 +193,7 @@ RBush.prototype.forEach_ = function(values, callback, opt_this) { * @return {boolean} Is empty. */ RBush.prototype.isEmpty = function() { - return _ol_obj_.isEmpty(this.items_); + return isEmpty(this.items_); }; diff --git a/src/ol/tilegrid.js b/src/ol/tilegrid.js index e7c11bdce0..141129d376 100644 --- a/src/ol/tilegrid.js +++ b/src/ol/tilegrid.js @@ -5,7 +5,7 @@ import {DEFAULT_MAX_ZOOM, DEFAULT_TILE_SIZE} from './tilegrid/common.js'; import _ol_size_ from './size.js'; import {containsCoordinate, createOrUpdate, getCorner, getHeight, getWidth} from './extent.js'; import Corner from './extent/Corner.js'; -import _ol_obj_ from './obj.js'; +import {assign} from './obj.js'; import {get as getProjection, METERS_PER_UNIT} from './proj.js'; import Units from './proj/Units.js'; import TileGrid from './tilegrid/TileGrid.js'; @@ -80,7 +80,7 @@ _ol_tilegrid_.createForExtent = function(extent, opt_maxZoom, opt_tileSize, opt_ */ _ol_tilegrid_.createXYZ = function(opt_options) { const options = /** @type {olx.tilegrid.TileGridOptions} */ ({}); - _ol_obj_.assign(options, opt_options !== undefined ? + assign(options, opt_options !== undefined ? opt_options : /** @type {olx.tilegrid.XYZOptions} */ ({})); if (options.extent === undefined) { options.extent = getProjection('EPSG:3857').getExtent(); diff --git a/src/ol/webgl/Context.js b/src/ol/webgl/Context.js index 2ced8e78b9..b4dbfe3a71 100644 --- a/src/ol/webgl/Context.js +++ b/src/ol/webgl/Context.js @@ -5,7 +5,7 @@ import {WEBGL_EXTENSIONS, getUid, inherits} from '../index.js'; import Disposable from '../Disposable.js'; import {includes} from '../array.js'; import _ol_events_ from '../events.js'; -import _ol_obj_ from '../obj.js'; +import {clear} from '../obj.js'; import _ol_webgl_ from '../webgl.js'; import ContextEventType from '../webgl/ContextEventType.js'; @@ -247,9 +247,9 @@ _ol_webgl_Context_.prototype.getProgram = function( * FIXME empy description for jsdoc */ _ol_webgl_Context_.prototype.handleWebGLContextLost = function() { - _ol_obj_.clear(this.bufferCache_); - _ol_obj_.clear(this.shaderCache_); - _ol_obj_.clear(this.programCache_); + clear(this.bufferCache_); + clear(this.shaderCache_); + clear(this.programCache_); this.currentProgram_ = null; this.hitDetectionFramebuffer_ = null; this.hitDetectionTexture_ = null; diff --git a/test/rendering/ol/layer/image.test.js b/test/rendering/ol/layer/image.test.js index b7929c1c55..50ed67827b 100644 --- a/test/rendering/ol/layer/image.test.js +++ b/test/rendering/ol/layer/image.test.js @@ -1,7 +1,7 @@ import Map from '../../../../src/ol/Map.js'; import View from '../../../../src/ol/View.js'; import ImageLayer from '../../../../src/ol/layer/Image.js'; -import _ol_obj_ from '../../../../src/ol/obj.js'; +import {assign} from '../../../../src/ol/obj.js'; import {get as getProjection, transform, transformExtent} from '../../../../src/ol/proj.js'; import Static from '../../../../src/ol/source/ImageStatic.js'; import _ol_tilegrid_ from '../../../../src/ol/tilegrid.js'; @@ -56,7 +56,7 @@ describe('ol.rendering.layer.Image', function() { const options = { source: source }; - _ol_obj_.assign(options, layerOptions); + assign(options, layerOptions); map.addLayer(new ImageLayer(options)); }); } diff --git a/test/rendering/ol/layer/tile.test.js b/test/rendering/ol/layer/tile.test.js index da11991f08..f3da771674 100644 --- a/test/rendering/ol/layer/tile.test.js +++ b/test/rendering/ol/layer/tile.test.js @@ -3,7 +3,7 @@ import View from '../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import Point from '../../../../src/ol/geom/Point.js'; import TileLayer from '../../../../src/ol/layer/Tile.js'; -import _ol_obj_ from '../../../../src/ol/obj.js'; +import {assign} from '../../../../src/ol/obj.js'; import {transform} from '../../../../src/ol/proj.js'; import TileImage from '../../../../src/ol/source/TileImage.js'; import XYZ from '../../../../src/ol/source/XYZ.js'; @@ -65,7 +65,7 @@ describe('ol.rendering.layer.Tile', function() { const options = { source: source }; - _ol_obj_.assign(options, layerOptions[i] || layerOptions); + assign(options, layerOptions[i] || layerOptions); map.addLayer(new TileLayer(options)); }); } diff --git a/test/rendering/ol/layer/vectortile.test.js b/test/rendering/ol/layer/vectortile.test.js index 93f9770237..b4fdea27d9 100644 --- a/test/rendering/ol/layer/vectortile.test.js +++ b/test/rendering/ol/layer/vectortile.test.js @@ -5,7 +5,7 @@ import MVT from '../../../../src/ol/format/MVT.js'; import Point from '../../../../src/ol/geom/Point.js'; import VectorLayer from '../../../../src/ol/layer/Vector.js'; import VectorTileLayer from '../../../../src/ol/layer/VectorTile.js'; -import _ol_obj_ from '../../../../src/ol/obj.js'; +import {assign} from '../../../../src/ol/obj.js'; import VectorSource from '../../../../src/ol/source/Vector.js'; import VectorTileSource from '../../../../src/ol/source/VectorTile.js'; import CircleStyle from '../../../../src/ol/style/Circle.js'; @@ -61,7 +61,7 @@ describe('ol.rendering.layer.VectorTile', function() { const options = { source: source }; - _ol_obj_.assign(options, layerOptions); + assign(options, layerOptions); map.addLayer(new VectorTileLayer(options)); } diff --git a/test/spec/ol/feature.test.js b/test/spec/ol/feature.test.js index cdac229adc..ca131bc043 100644 --- a/test/spec/ol/feature.test.js +++ b/test/spec/ol/feature.test.js @@ -1,6 +1,6 @@ import Feature from '../../../src/ol/Feature.js'; import Point from '../../../src/ol/geom/Point.js'; -import _ol_obj_ from '../../../src/ol/obj.js'; +import {isEmpty} from '../../../src/ol/obj.js'; import Style from '../../../src/ol/style/Style.js'; @@ -85,7 +85,7 @@ describe('ol.Feature', function() { it('is empty by default', function() { const feature = new Feature(); const properties = feature.getProperties(); - expect(_ol_obj_.isEmpty(properties)).to.be(true); + expect(isEmpty(properties)).to.be(true); }); }); diff --git a/test/spec/ol/layer/group.test.js b/test/spec/ol/layer/group.test.js index 19426813d4..df1020af09 100644 --- a/test/spec/ol/layer/group.test.js +++ b/test/spec/ol/layer/group.test.js @@ -4,7 +4,7 @@ import Collection from '../../../../src/ol/Collection.js'; import * as _ol_extent_ from '../../../../src/ol/extent.js'; import LayerGroup from '../../../../src/ol/layer/Group.js'; import Layer from '../../../../src/ol/layer/Layer.js'; -import _ol_obj_ from '../../../../src/ol/obj.js'; +import {assign} from '../../../../src/ol/obj.js'; import MapRenderer from '../../../../src/ol/renderer/Map.js'; import Source from '../../../../src/ol/source/Source.js'; @@ -373,9 +373,9 @@ describe('ol.layer.Group', function() { expect(layerStatesArray[0]).to.eql(layer1.getLayerState()); // layer state should match except for layer reference - const layerState = _ol_obj_.assign({}, layerStatesArray[0]); + const layerState = assign({}, layerStatesArray[0]); delete layerState.layer; - const groupState = _ol_obj_.assign({}, layerGroup.getLayerState()); + const groupState = assign({}, layerGroup.getLayerState()); delete groupState.layer; expect(layerState).to.eql(groupState); @@ -421,14 +421,14 @@ describe('ol.layer.Group', function() { // compare layer state to group state // layer state should match except for layer reference - let layerState = _ol_obj_.assign({}, layerStatesArray[0]); + let layerState = assign({}, layerStatesArray[0]); delete layerState.layer; - const groupState = _ol_obj_.assign({}, layerGroup.getLayerState()); + const groupState = assign({}, layerGroup.getLayerState()); delete groupState.layer; expect(layerState).to.eql(groupState); // layer state should be transformed (and we ignore layer reference) - layerState = _ol_obj_.assign({}, layerStatesArray[1]); + layerState = assign({}, layerStatesArray[1]); delete layerState.layer; expect(layerState).to.eql({ opacity: 0.25, diff --git a/test/spec/ol/objectutil.test.js b/test/spec/ol/objectutil.test.js index 487409769d..040a2de51f 100644 --- a/test/spec/ol/objectutil.test.js +++ b/test/spec/ol/objectutil.test.js @@ -1,11 +1,11 @@ -import _ol_obj_ from '../../../src/ol/obj.js'; +import {assign, clear, isEmpty, getValues} from '../../../src/ol/obj.js'; describe('ol.obj.assign()', function() { it('is an alias for Object.assign() where available', function() { if (typeof Object.assign === 'function') { - expect(_ol_obj_.assign).to.be(Object.assign); + expect(assign).to.be(Object.assign); } }); @@ -21,7 +21,7 @@ describe('ol.obj.assign()', function() { targetProp1: 'targetValue1' }; - const assigned = _ol_obj_.assign(target, source); + const assigned = assign(target, source); expect(assigned).to.be(target); expect(assigned.sourceProp1).to.be('sourceValue1'); expect(assigned.sourceProp2).to.be('sourceValue2'); @@ -30,13 +30,13 @@ describe('ol.obj.assign()', function() { }); it('throws a TypeError with `undefined` as target', function() { - expect(_ol_obj_.assign).withArgs(undefined).to.throwException(function(e) { + expect(assign).withArgs(undefined).to.throwException(function(e) { expect(e).to.be.a(TypeError); }); }); it('throws a TypeError with `null` as target', function() { - expect(_ol_obj_.assign).withArgs(null).to.throwException(function(e) { + expect(assign).withArgs(null).to.throwException(function(e) { expect(e).to.be.a(TypeError); }); }); @@ -46,8 +46,6 @@ describe('ol.obj.assign()', function() { describe('ol.obj.clear()', function() { it('removes all properties from an object', function() { - const clear = _ol_obj_.clear; - const isEmpty = _ol_obj_.isEmpty; expect(isEmpty(clear({foo: 'bar'}))).to.be(true); expect(isEmpty(clear({foo: 'bar', num: 42}))).to.be(true); expect(isEmpty(clear({}))).to.be(true); @@ -59,8 +57,8 @@ describe('ol.obj.clear()', function() { describe('ol.obj.getValues()', function() { it('gets a list of property values from an object', function() { - expect(_ol_obj_.getValues({foo: 'bar', num: 42}).sort()).to.eql([42, 'bar']); - expect(_ol_obj_.getValues(null)).to.eql([]); + expect(getValues({foo: 'bar', num: 42}).sort()).to.eql([42, 'bar']); + expect(getValues(null)).to.eql([]); }); }); @@ -68,10 +66,10 @@ describe('ol.obj.getValues()', function() { describe('ol.obj.isEmpty()', function() { it('checks if an object has any properties', function() { - expect(_ol_obj_.isEmpty({})).to.be(true); - expect(_ol_obj_.isEmpty(null)).to.be(true); - expect(_ol_obj_.isEmpty({foo: 'bar'})).to.be(false); - expect(_ol_obj_.isEmpty({foo: false})).to.be(false); + expect(isEmpty({})).to.be(true); + expect(isEmpty(null)).to.be(true); + expect(isEmpty({foo: 'bar'})).to.be(false); + expect(isEmpty({foo: false})).to.be(false); }); }); diff --git a/test/spec/ol/pointer/touchsource.test.js b/test/spec/ol/pointer/touchsource.test.js index d834b48644..97bf833045 100644 --- a/test/spec/ol/pointer/touchsource.test.js +++ b/test/spec/ol/pointer/touchsource.test.js @@ -2,8 +2,9 @@ import _ol_events_ from '../../../../src/ol/events.js'; import Event from '../../../../src/ol/events/Event.js'; import EventTarget from '../../../../src/ol/events/EventTarget.js'; import _ol_has_ from '../../../../src/ol/has.js'; -import _ol_obj_ from '../../../../src/ol/obj.js'; +import {assign} from '../../../../src/ol/obj.js'; import PointerEventHandler from '../../../../src/ol/pointer/PointerEventHandler.js'; + describe('ol.pointer.TouchSource', function() { let handler; let target; @@ -123,7 +124,7 @@ describe('ol.pointer.TouchSource', function() { touches = touches !== undefined ? touches : changedTouches; const event = new Event(type); - _ol_obj_.assign(event, { + assign(event, { touches: touches, changedTouches: changedTouches }); diff --git a/test/spec/ol/render/canvas/index.test.js b/test/spec/ol/render/canvas/index.test.js index 5975b4f27d..8b79717426 100644 --- a/test/spec/ol/render/canvas/index.test.js +++ b/test/spec/ol/render/canvas/index.test.js @@ -1,5 +1,5 @@ import _ol_events_ from '../../../../../src/ol/events.js'; -import _ol_obj_ from '../../../../../src/ol/obj.js'; +import {clear} from '../../../../../src/ol/obj.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; @@ -13,7 +13,7 @@ describe('ol.render.canvas', function() { describe('ol.render.canvas.checkFont()', function() { beforeEach(function() { - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); _ol_render_canvas_.getMeasureContext(); _ol_render_canvas_.measureTextHeight('12px sans-serif'); }); diff --git a/test/spec/ol/renderer/canvas/vectorlayer.test.js b/test/spec/ol/renderer/canvas/vectorlayer.test.js index 1e12a46c81..f50a21f2ee 100644 --- a/test/spec/ol/renderer/canvas/vectorlayer.test.js +++ b/test/spec/ol/renderer/canvas/vectorlayer.test.js @@ -5,7 +5,7 @@ import View from '../../../../../src/ol/View.js'; import * as _ol_extent_ from '../../../../../src/ol/extent.js'; import Point from '../../../../../src/ol/geom/Point.js'; import VectorLayer from '../../../../../src/ol/layer/Vector.js'; -import _ol_obj_ from '../../../../../src/ol/obj.js'; +import {clear} from '../../../../../src/ol/obj.js'; import {get as getProjection} from '../../../../../src/ol/proj.js'; import _ol_render_canvas_ from '../../../../../src/ol/render/canvas.js'; import CanvasVectorLayerRenderer from '../../../../../src/ol/renderer/canvas/VectorLayer.js'; @@ -85,7 +85,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }); it('does not re-render for unavailable fonts', function(done) { - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); const map = new Map({ view: new View({ center: [0, 0], @@ -116,7 +116,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }); it('does not re-render for available fonts', function(done) { - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); const map = new Map({ view: new View({ center: [0, 0], @@ -147,7 +147,7 @@ describe('ol.renderer.canvas.VectorLayer', function() { }); it('re-renders for fonts that become available', function(done) { - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); head.appendChild(font); const map = new Map({ view: new View({ diff --git a/test/spec/ol/renderer/canvas/vectortilelayer.test.js b/test/spec/ol/renderer/canvas/vectortilelayer.test.js index 9c205c3757..009303e0fb 100644 --- a/test/spec/ol/renderer/canvas/vectortilelayer.test.js +++ b/test/spec/ol/renderer/canvas/vectortilelayer.test.js @@ -1,5 +1,5 @@ import {getUid, inherits} from '../../../../../src/ol/index.js'; -import _ol_obj_ from '../../../../../src/ol/obj.js'; +import {clear} from '../../../../../src/ol/obj.js'; import Feature from '../../../../../src/ol/Feature.js'; import Map from '../../../../../src/ol/Map.js'; import TileState from '../../../../../src/ol/TileState.js'; @@ -154,7 +154,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('does not re-render for unavailable fonts', function(done) { map.renderSync(); - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); layerStyle[0].getText().setFont('12px "Unavailable font",sans-serif'); layer.changed(); const revision = layer.getRevision(); @@ -166,7 +166,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('does not re-render for available fonts', function(done) { map.renderSync(); - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); layerStyle[0].getText().setFont('12px sans-serif'); layer.changed(); const revision = layer.getRevision(); @@ -178,7 +178,7 @@ describe('ol.renderer.canvas.VectorTileLayer', function() { it('re-renders for fonts that become available', function(done) { map.renderSync(); - _ol_obj_.clear(_ol_render_canvas_.checkedFonts_); + clear(_ol_render_canvas_.checkedFonts_); head.appendChild(font); layerStyle[0].getText().setFont('12px "Dancing Script",sans-serif'); layer.changed();