diff --git a/src/ol/interaction/Draw.js b/src/ol/interaction/Draw.js index 30d7f12c3a..632651b878 100644 --- a/src/ol/interaction/Draw.js +++ b/src/ol/interaction/Draw.js @@ -26,7 +26,7 @@ import PointerInteraction, {handleEvent as handlePointerEvent} from '../interact import InteractionProperty from '../interaction/Property.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import Style from '../style/Style.js'; +import {createEditingStyle} from '../style/Style.js'; /** @@ -377,7 +377,7 @@ inherits(Draw, PointerInteraction); * @return {ol.StyleFunction} Styles. */ function getDefaultStyleFunction() { - const styles = Style.createDefaultEditing(); + const styles = createEditingStyle(); return function(feature, resolution) { return styles[feature.getGeometry().getType()]; }; diff --git a/src/ol/interaction/Extent.js b/src/ol/interaction/Extent.js index 9848cc893c..7acb7bbc06 100644 --- a/src/ol/interaction/Extent.js +++ b/src/ol/interaction/Extent.js @@ -15,7 +15,7 @@ import ExtentEventType from '../interaction/ExtentEventType.js'; import PointerInteraction, {handleEvent as handlePointerEvent} from '../interaction/Pointer.js'; import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; -import Style from '../style/Style.js'; +import {createEditingStyle} from '../style/Style.js'; /** @@ -263,7 +263,7 @@ function handleUpEvent(mapBrowserEvent) { * @return {ol.StyleFunction} Default Extent style */ function getDefaultExtentStyleFunction() { - const style = Style.createDefaultEditing(); + const style = createEditingStyle(); return function(feature, resolution) { return style[GeometryType.POLYGON]; }; @@ -275,7 +275,7 @@ function getDefaultExtentStyleFunction() { * @return {ol.StyleFunction} Default pointer style */ function getDefaultPointerStyleFunction() { - const style = Style.createDefaultEditing(); + const style = createEditingStyle(); return function(feature, resolution) { return style[GeometryType.POINT]; }; diff --git a/src/ol/interaction/Modify.js b/src/ol/interaction/Modify.js index 52e1690ba2..555d415a7c 100644 --- a/src/ol/interaction/Modify.js +++ b/src/ol/interaction/Modify.js @@ -22,7 +22,7 @@ import VectorLayer from '../layer/Vector.js'; import VectorSource from '../source/Vector.js'; import VectorEventType from '../source/VectorEventType.js'; import RBush from '../structs/RBush.js'; -import Style from '../style/Style.js'; +import {createEditingStyle} from '../style/Style.js'; /** * @classdesc @@ -1180,7 +1180,7 @@ Modify.prototype.updateSegmentIndices_ = function( * @return {ol.StyleFunction} Styles. */ Modify.getDefaultStyleFunction = function() { - const style = Style.createDefaultEditing(); + const style = createEditingStyle(); return function(feature, resolution) { return style[GeometryType.POINT]; }; diff --git a/src/ol/interaction/Select.js b/src/ol/interaction/Select.js index c72eca7411..ba27efdc45 100644 --- a/src/ol/interaction/Select.js +++ b/src/ol/interaction/Select.js @@ -13,7 +13,7 @@ import Interaction from '../interaction/Interaction.js'; import VectorLayer from '../layer/Vector.js'; import {clear} from '../obj.js'; import VectorSource from '../source/Vector.js'; -import Style from '../style/Style.js'; +import {createEditingStyle} from '../style/Style.js'; /** @@ -334,7 +334,7 @@ Select.prototype.setMap = function(map) { * @return {ol.StyleFunction} Styles. */ Select.getDefaultStyleFunction = function() { - const styles = Style.createDefaultEditing(); + const styles = createEditingStyle(); extend(styles[GeometryType.POLYGON], styles[GeometryType.LINE_STRING]); extend(styles[GeometryType.GEOMETRY_COLLECTION], styles[GeometryType.LINE_STRING]); diff --git a/src/ol/layer/Vector.js b/src/ol/layer/Vector.js index 494049a44d..eb8f9e22fd 100644 --- a/src/ol/layer/Vector.js +++ b/src/ol/layer/Vector.js @@ -6,7 +6,7 @@ import LayerType from '../LayerType.js'; import Layer from '../layer/Layer.js'; import VectorRenderType from '../layer/VectorRenderType.js'; import {assign} from '../obj.js'; -import Style from '../style/Style.js'; +import {createDefaultStyle, toFunction as toStyleFunction} from '../style/Style.js'; /** @@ -207,9 +207,9 @@ VectorLayer.prototype.setRenderOrder = function(renderOrder) { * @api */ VectorLayer.prototype.setStyle = function(style) { - this.style_ = style !== undefined ? style : Style.defaultFunction; + this.style_ = style !== undefined ? style : createDefaultStyle; this.styleFunction_ = style === null ? - undefined : Style.createFunction(this.style_); + undefined : toStyleFunction(this.style_); this.changed(); }; diff --git a/src/ol/style/Style.js b/src/ol/style/Style.js index e6cb01eab9..748cf67f05 100644 --- a/src/ol/style/Style.js +++ b/src/ol/style/Style.js @@ -32,7 +32,7 @@ const Style = function(opt_options) { * @private * @type {!ol.StyleGeometryFunction} */ - this.geometryFunction_ = Style.defaultGeometryFunction; + this.geometryFunction_ = defaultGeometryFunction; if (options.geometry !== undefined) { this.setGeometry(options.geometry); @@ -249,7 +249,7 @@ Style.prototype.setGeometry = function(geometry) { return /** @type {ol.geom.Geometry} */ (feature.get(geometry)); }; } else if (!geometry) { - this.geometryFunction_ = Style.defaultGeometryFunction; + this.geometryFunction_ = defaultGeometryFunction; } else if (geometry !== undefined) { this.geometryFunction_ = function() { return /** @type {ol.geom.Geometry} */ (geometry); @@ -278,7 +278,7 @@ Style.prototype.setZIndex = function(zIndex) { * A style function, a single style, or an array of styles. * @return {ol.StyleFunction} A style function. */ -Style.createFunction = function(obj) { +export function toFunction(obj) { let styleFunction; if (typeof obj === 'function') { @@ -300,7 +300,7 @@ Style.createFunction = function(obj) { }; } return styleFunction; -}; +} /** @@ -314,7 +314,7 @@ let defaultStyles = null; * @param {number} resolution Resolution. * @return {Array.