@carto/kepler.gl 0.0.18-alpha.0 → 0.0.21

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.
Files changed (32) hide show
  1. package/dist/components/common/checkbox.js +2 -2
  2. package/dist/components/common/info-helper.js +4 -3
  3. package/dist/components/kepler-gl.js +9 -5
  4. package/dist/components/map-container.js +16 -2
  5. package/dist/components/plot-container.js +5 -3
  6. package/dist/components/side-panel/layer-panel/layer-config-group.js +21 -5
  7. package/dist/components/side-panel/layer-panel/layer-configurator.js +10 -4
  8. package/dist/components/side-panel/layer-panel/vis-config-switch.js +2 -1
  9. package/dist/constants/default-settings.js +5 -3
  10. package/dist/deckgl-layers/cluster-layer/cluster-layer.js +9 -4
  11. package/dist/layers/aggregation-layer.js +6 -3
  12. package/dist/layers/base-layer.js +9 -5
  13. package/dist/localization/en.js +3 -2
  14. package/dist/utils/layer-utils.js +17 -3
  15. package/package.json +14 -14
  16. package/src/components/common/checkbox.js +5 -1
  17. package/src/components/common/info-helper.js +2 -2
  18. package/src/components/kepler-gl.d.ts +1 -0
  19. package/src/components/kepler-gl.js +15 -3
  20. package/src/components/map-container.js +14 -1
  21. package/src/components/plot-container.js +3 -2
  22. package/src/components/side-panel/layer-panel/layer-config-group.js +19 -5
  23. package/src/components/side-panel/layer-panel/layer-configurator.js +9 -0
  24. package/src/components/side-panel/layer-panel/vis-config-switch.js +1 -0
  25. package/src/constants/default-settings.js +2 -0
  26. package/src/deckgl-layers/cluster-layer/cluster-layer.js +12 -2
  27. package/src/layers/aggregation-layer.js +5 -1
  28. package/src/layers/base-layer.js +6 -3
  29. package/src/localization/en.js +2 -1
  30. package/src/utils/layer-utils.d.ts +7 -0
  31. package/src/utils/layer-utils.js +15 -3
  32. package/umd/keplergl.min.js +180 -181
@@ -218,7 +218,15 @@ export default class ClusterLayer extends AggregationLayer {
218
218
  const {cpuAggregator} = this.state;
219
219
 
220
220
  // base layer props
221
- const {visible, opacity, pickable, autoHighlight, highlightColor} = this.props;
221
+ const {
222
+ visible,
223
+ opacity,
224
+ pickable,
225
+ autoHighlight,
226
+ highlightColor,
227
+ maskId,
228
+ extensions
229
+ } = this.props;
222
230
  const updateTriggers = this._getSublayerUpdateTriggers();
223
231
  const accessors = this._getSubLayerAccessors();
224
232
 
@@ -236,7 +244,9 @@ export default class ClusterLayer extends AggregationLayer {
236
244
  autoHighlight,
237
245
  highlightColor,
238
246
  updateTriggers,
239
- ...accessors
247
+ ...accessors,
248
+ maskId,
249
+ extensions
240
250
  });
241
251
  }
242
252
  }
@@ -20,6 +20,7 @@
20
20
 
21
21
  import memoize from 'lodash.memoize';
22
22
  import Layer from './base-layer';
23
+ import {getMaskExtensionProps} from 'utils/layer-utils';
23
24
  import {hexToRgb} from 'utils/color-utils';
24
25
  import {aggregate} from 'utils/aggregate-utils';
25
26
  import {
@@ -277,11 +278,14 @@ export default class AggregationLayer extends Layer {
277
278
 
278
279
  getDefaultDeckLayerProps(opts) {
279
280
  const baseProp = super.getDefaultDeckLayerProps(opts);
281
+ const maskExtensionProps = getMaskExtensionProps(opts.maskPolygon);
282
+
280
283
  return {
281
284
  ...baseProp,
285
+ ...maskExtensionProps,
282
286
  highlightColor: HIGHLIGH_COLOR_3D,
283
287
  // gpu data filtering is not supported in aggregation layer
284
- extensions: [],
288
+ extensions: [...maskExtensionProps.extensions],
285
289
  autoHighlight: this.config.visConfig.enable3d
286
290
  };
287
291
  }
@@ -54,6 +54,7 @@ import {getLatLngBounds, notNullorUndefined} from 'utils/data-utils';
54
54
  import {getSampleData} from 'utils/table-utils/data-container-utils';
55
55
 
56
56
  import {hexToRgb, getColorGroupByName, reverseColorRange} from 'utils/color-utils';
57
+ import {getMaskExtensionProps} from 'utils/layer-utils';
57
58
 
58
59
  /** @typedef {import('./index').Layer} LayerClass} */
59
60
 
@@ -1078,8 +1079,11 @@ class Layer {
1078
1079
  };
1079
1080
  }
1080
1081
 
1081
- getDefaultDeckLayerProps({idx, gpuFilter, mapState, visible}) {
1082
+ getDefaultDeckLayerProps({idx, gpuFilter, mapState, visible, maskPolygon}) {
1083
+ const maskExtensionProps = getMaskExtensionProps(maskPolygon);
1084
+
1082
1085
  return {
1086
+ ...maskExtensionProps,
1083
1087
  id: this.id,
1084
1088
  idx,
1085
1089
  coordinateSystem: COORDINATE_SYSTEM.LNGLAT,
@@ -1091,9 +1095,8 @@ class Layer {
1091
1095
  opacity: this.config.visConfig.opacity,
1092
1096
  highlightColor: this.config.highlightColor,
1093
1097
  // data filtering
1094
- extensions: [dataFilterExtension],
1098
+ extensions: [dataFilterExtension, ...maskExtensionProps.extensions],
1095
1099
  filterRange: gpuFilter ? gpuFilter.filterRange : undefined,
1096
-
1097
1100
  // layer should be visible and if splitMap, shown in to one of panel
1098
1101
  visible: this.config.isVisible && visible
1099
1102
  };
@@ -119,7 +119,8 @@ export default {
119
119
  trip: 'trip',
120
120
  s2: 'S2',
121
121
  '3d': '3D'
122
- }
122
+ },
123
+ colorRange: 'Palette'
123
124
  },
124
125
  layerVisConfigs: {
125
126
  angle: 'Angle',
@@ -66,4 +66,11 @@ export function prepareLayersForDeck(
66
66
  layerData: VisState['layerData'],
67
67
  ): {
68
68
  [key: string]: boolean;
69
+ }
70
+
71
+ export function getMaskExtensionProps(
72
+ maskPolygon: Array<Array<number>>,
73
+ ): {
74
+ maskId?: string,
75
+ extensions: Array<unknown>
69
76
  }
@@ -19,7 +19,8 @@
19
19
  // THE SOFTWARE.
20
20
 
21
21
  import {OVERLAY_TYPE} from 'layers/base-layer';
22
- import {GEOCODER_LAYER_ID} from 'constants/default-settings';
22
+ import {GEOCODER_LAYER_ID, MASK_LAYER_ID} from 'constants/default-settings';
23
+ import {MaskExtension} from '@deck.gl/extensions';
23
24
 
24
25
  /**
25
26
  * Find default layers from fields
@@ -124,7 +125,8 @@ export function renderDeckGlLayer(props, layerCallbacks, idx) {
124
125
  mapState,
125
126
  interactionConfig,
126
127
  animationConfig,
127
- mapLayers
128
+ mapLayers,
129
+ maskPolygon
128
130
  } = props;
129
131
  const layer = layers[idx];
130
132
  const data = layerData[idx];
@@ -141,7 +143,8 @@ export function renderDeckGlLayer(props, layerCallbacks, idx) {
141
143
  mapState,
142
144
  animationConfig,
143
145
  objectHovered,
144
- visible
146
+ visible,
147
+ maskPolygon
145
148
  });
146
149
  }
147
150
 
@@ -183,3 +186,12 @@ export function prepareLayersToRender(layers, layerData, mapLayers) {
183
186
  {}
184
187
  );
185
188
  }
189
+
190
+ const maskExtension = new MaskExtension();
191
+
192
+ export function getMaskExtensionProps(maskPolygon) {
193
+ return {
194
+ maskId: Boolean(maskPolygon && maskPolygon.length) && MASK_LAYER_ID,
195
+ extensions: [maskExtension]
196
+ };
197
+ }