@deck.gl/carto 9.2.2 → 9.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "CARTO official integration with Deck.gl. Build geospatial applications using CARTO and Deck.gl.",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "9.2.2",
6
+ "version": "9.2.4",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -75,5 +75,5 @@
75
75
  "@loaders.gl/core": "^4.2.0",
76
76
  "@luma.gl/core": "~9.2.2"
77
77
  },
78
- "gitHead": "9e183d2ce23bb21d655752ed614da0ce5a6a0458"
78
+ "gitHead": "a23f59064b36dcb4428bbb00b5ce70a647842ed3"
79
79
  }
@@ -74,7 +74,7 @@ export function createPointsFromPolygons(
74
74
  ): BinaryPointFeature {
75
75
  const {west, south, east, north} = tileBbox;
76
76
  const tileArea = (east - west) * (north - south);
77
- const minPolygonArea = tileArea * 0.0001; // 0.1% threshold
77
+ const minPolygonArea = tileArea * 0.0001; // 0.01% threshold
78
78
 
79
79
  const positions: number[] = [];
80
80
  const properties: Properties = [];
@@ -196,7 +196,7 @@ function getPolygonArea(polygons: Required<BinaryPolygonFeature>, index: number)
196
196
  let triangleIndex = 0;
197
197
 
198
198
  // Find first triangle of this polygon
199
- // Note: this assumes tirnagles and polygon indices are sorted.
199
+ // Note: this assumes triangles and polygon indices are sorted.
200
200
  // This is true for the current implementation of geojsonToBinary
201
201
  while (triangleIndex < triangles.length) {
202
202
  const i1 = triangles[triangleIndex];
@@ -27,6 +27,8 @@ import {createPointsFromLines, createPointsFromPolygons} from './label-utils';
27
27
  import {createEmptyBinary} from '../utils';
28
28
  import PointLabelLayer from './point-label-layer';
29
29
 
30
+ const MVT_BBOX: GeoBoundingBox = {west: 0, east: 1, south: 0, north: 1};
31
+
30
32
  const defaultProps: DefaultProps<VectorTileLayerProps> = {
31
33
  ...MVTLayer.defaultProps,
32
34
  autoLabels: false,
@@ -205,7 +207,11 @@ export default class VectorTileLayer<
205
207
  ) as BinaryPointFeature;
206
208
  }
207
209
  if (props.data.polygons && props.data.polygons.positions.value.length > 0) {
208
- labelData.points = createPointsFromPolygons(props.data.polygons, tileBbox, props);
210
+ labelData.points = createPointsFromPolygons(
211
+ props.data.polygons,
212
+ this.state.mvt ? MVT_BBOX : tileBbox,
213
+ props
214
+ );
209
215
  }
210
216
 
211
217
  subLayers.push(
@@ -227,7 +233,7 @@ export default class VectorTileLayer<
227
233
  }
228
234
 
229
235
  // Sort layers so that label layers are rendered after the main layer
230
- const validLayers = layers.flat().filter(Boolean) as Layer[];
236
+ const validLayers = (layers || []).flat().filter(Boolean) as Layer[];
231
237
  validLayers.sort((a: Layer, b: Layer) => {
232
238
  const aHasLabel = a.id.includes('labels');
233
239
  const bHasLabel = b.id.includes('labels');