Replace instanceof checks with other logic
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import {getUid} from '../util.js';
|
||||
import {assert} from '../asserts.js';
|
||||
import Feature from '../Feature.js';
|
||||
import GeometryType from '../geom/GeometryType.js';
|
||||
import {scale as scaleCoordinate, add as addCoordinate} from '../coordinate.js';
|
||||
import {listen} from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
@@ -76,7 +77,7 @@ class Cluster extends VectorSource {
|
||||
*/
|
||||
this.geometryFunction = options.geometryFunction || function(feature) {
|
||||
const geometry = /** @type {Point} */ (feature.getGeometry());
|
||||
assert(geometry instanceof Point,
|
||||
assert(geometry.getType() == GeometryType.POINT,
|
||||
10); // The default `geometryFunction` can only handle `Point` geometries
|
||||
return geometry;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user