Skip to content

Commit d019947

Browse files
author
farfromrefug
committed
chore(android): better for production
1 parent e1cefe8 commit d019947

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ui-carto/layers/vector.android.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ export abstract class BaseVectorTileLayer<T extends com.carto.layers.VectorTileL
100100
const geometry = feature.getGeometry();
101101
let position = info.getClickPos();
102102
const geoPosIndex = info.getFeaturePosIndex();
103-
let featurePos = geoPosIndex !== -1 && geometry instanceof com.carto.geometry.MultiPointGeometry ? geometry.getGeometry(geoPosIndex).getCenterPos() : geometry.getCenterPos();
103+
let featurePos: com.carto.core.MapPos;
104+
if (geoPosIndex !== -1 && /MultiPoint/.test(geometry.constructor.name)) {
105+
featurePos = (geometry as com.carto.geometry.MultiPointGeometry).getGeometry(geoPosIndex)?.getCenterPos();
106+
}
107+
if (!featurePos) {
108+
featurePos = geometry.getCenterPos();
109+
}
104110
let projection: com.carto.projections.Projection;
105111
const dataSourceProjection = this.getNative().getDataSource().getProjection();
106112
if (this.listenerProjection) {

0 commit comments

Comments
 (0)