@carto/kepler.gl 0.0.71-alpha.3 → 0.0.71

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 (43) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/components/common/item-selector/accessor.js +2 -2
  3. package/dist/components/common/item-selector/dropdown-list.js +8 -10
  4. package/dist/components/common/item-selector/item-selector.js +2 -2
  5. package/dist/components/common/styled-components.js +13 -21
  6. package/dist/components/kepler-gl.js +2 -2
  7. package/dist/components/map-container.js +22 -148
  8. package/dist/components/plot-container.js +6 -10
  9. package/dist/components/side-panel/layer-panel/color-range-selector.js +8 -43
  10. package/dist/components/side-panel/layer-panel/color-selector.js +1 -7
  11. package/dist/components/side-panel/layer-panel/layer-configurator.js +10 -35
  12. package/dist/constants/color-ranges.js +2 -12
  13. package/dist/constants/default-settings.js +4 -7
  14. package/dist/layers/base-layer.js +45 -139
  15. package/dist/layers/point-layer/point-layer.js +3 -2
  16. package/dist/localization/en.js +2 -5
  17. package/dist/reducers/vis-state-merger.js +2 -16
  18. package/dist/schemas/vis-state-schema.js +2 -2
  19. package/dist/utils/dom-to-image.js +6 -1
  20. package/package.json +2 -1
  21. package/src/components/common/item-selector/accessor.js +1 -1
  22. package/src/components/common/item-selector/dropdown-list.js +15 -24
  23. package/src/components/common/item-selector/item-selector.js +1 -1
  24. package/src/components/common/styled-components.js +2 -33
  25. package/src/components/kepler-gl.js +0 -4
  26. package/src/components/map-container.js +22 -152
  27. package/src/components/plot-container.js +3 -14
  28. package/src/components/side-panel/layer-panel/color-range-selector.js +8 -37
  29. package/src/components/side-panel/layer-panel/color-selector.js +0 -7
  30. package/src/components/side-panel/layer-panel/layer-configurator.js +7 -60
  31. package/src/constants/color-ranges.js +0 -9
  32. package/src/constants/default-settings.js +2 -5
  33. package/src/layers/base-layer.js +27 -93
  34. package/src/layers/layer-factory.d.ts +0 -1
  35. package/src/layers/point-layer/point-layer.js +1 -1
  36. package/src/localization/en.js +1 -4
  37. package/src/reducers/vis-state-merger.js +1 -13
  38. package/src/schemas/vis-state-schema.js +1 -1
  39. package/src/utils/dom-to-image.js +5 -0
  40. package/dist/components/side-panel/layer-panel/hex-column-config.js +0 -84
  41. package/dist/utils/custom-scales.js +0 -28
  42. package/src/components/side-panel/layer-panel/hex-column-config.js +0 -40
  43. package/src/utils/custom-scales.js +0 -20
@@ -32,24 +32,19 @@ import {errorNotification} from 'utils/notifications-utils';
32
32
  // components
33
33
  import MapPopoverFactory from 'components/map/map-popover';
34
34
  import MapControlFactory from 'components/map/map-control';
35
- import {StyledMapContainer, StyledAttrbution} from 'components/common/styled-components';
35
+ import {StyledMapContainer} from 'components/common/styled-components';
36
36
 
37
37
  import EditorFactory from './editor/editor';
38
38
 
39
39
  // utils
40
- import {generateMapboxLayers, updateMapboxLayers} from 'layers/mapbox-utils';
40
+ import {generateMapboxLayers} from 'layers/mapbox-utils';
41
41
  import {setLayerBlending} from 'utils/gl-utils';
42
42
  import {transformRequest} from 'utils/map-style-utils/mapbox-utils';
43
43
  import {renderDeckGlLayer, prepareLayersToRender, prepareLayersForDeck} from 'utils/layer-utils';
44
44
 
45
45
  // default-settings
46
46
  import ThreeDBuildingLayer from 'deckgl-layers/3d-building-layer/3d-building-layer';
47
- import {
48
- FILTER_TYPES,
49
- GEOCODER_LAYER_ID,
50
- MASK_LAYER_ID,
51
- THROTTLE_NOTIFICATION_TIME
52
- } from 'constants/default-settings';
47
+ import {FILTER_TYPES, MASK_LAYER_ID, THROTTLE_NOTIFICATION_TIME} from 'constants/default-settings';
53
48
 
54
49
  import {observeDimensions, unobserveDimensions} from '../utils/observe-dimensions';
55
50
  import {LOCALE_CODES} from 'localization/locales';
@@ -81,39 +76,8 @@ const MAP_STYLE = {
81
76
  }
82
77
  };
83
78
 
84
- const MAPBOXGL_STYLE_UPDATE = 'style.load';
85
- const MAPBOXGL_RENDER = 'render';
86
79
  const TRANSITION_DURATION = 0;
87
80
 
88
- export const Attribution = () => (
89
- <StyledAttrbution>
90
- <div className="attrition-logo">
91
- Basemap by:
92
- <a
93
- className="mapboxgl-ctrl-logo"
94
- target="_blank"
95
- rel="noopener noreferrer"
96
- href="https://www.mapbox.com/"
97
- aria-label="Mapbox logo"
98
- />
99
- </div>
100
- <div className="attrition-link">
101
- <a href="https://kepler.gl/policy/" target="_blank" rel="noopener noreferrer">
102
- © kepler.gl |{' '}
103
- </a>
104
- <a href="https://www.mapbox.com/about/maps/" target="_blank" rel="noopener noreferrer">
105
- © Mapbox |{' '}
106
- </a>
107
- <a href="http://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">
108
- © OpenStreetMap |{' '}
109
- </a>
110
- <a href="https://www.mapbox.com/map-feedback/" target="_blank" rel="noopener noreferrer">
111
- <strong>Improve this map</strong>
112
- </a>
113
- </div>
114
- </StyledAttrbution>
115
- );
116
-
117
81
  MapContainerFactory.deps = [MapPopoverFactory, MapControlFactory, EditorFactory];
118
82
 
119
83
  export default function MapContainerFactory(MapPopover, MapControl, Editor) {
@@ -145,7 +109,7 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
145
109
  mapLayers: PropTypes.object,
146
110
  onMapToggleLayer: PropTypes.func,
147
111
  onMapStyleLoaded: PropTypes.func,
148
- onMapRender: PropTypes.func,
112
+ generateThumbnail: PropTypes.func,
149
113
  getMapboxRef: PropTypes.func,
150
114
  index: PropTypes.number,
151
115
  popupSettings: PropTypes.object
@@ -161,10 +125,6 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
161
125
  constructor(props) {
162
126
  super(props);
163
127
 
164
- this.previousLayers = {
165
- // [layers.id]: mapboxLayerConfig
166
- };
167
-
168
128
  this._deck = null;
169
129
  this._ref = createRef();
170
130
 
@@ -187,11 +147,6 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
187
147
  }
188
148
 
189
149
  componentWillUnmount() {
190
- // unbind mapboxgl event listener
191
- if (this._map) {
192
- this._map.off(MAPBOXGL_STYLE_UPDATE);
193
- this._map.off(MAPBOXGL_RENDER);
194
- }
195
150
  unobserveDimensions(this._ref.current);
196
151
  }
197
152
 
@@ -252,41 +207,6 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
252
207
  visStateActions.toggleLayerForMap(mapIndex, layerId);
253
208
  };
254
209
 
255
- _onMapboxStyleUpdate = () => {
256
- // force refresh mapboxgl layers
257
- this.previousLayers = {};
258
- this._updateMapboxLayers();
259
-
260
- if (typeof this.props.onMapStyleLoaded === 'function') {
261
- this.props.onMapStyleLoaded(this._map);
262
- }
263
- };
264
-
265
- _setMapboxMap = mapbox => {
266
- if (!this._map && mapbox) {
267
- this._map = mapbox.getMap();
268
- // i noticed in certain context we don't access the actual map element
269
- if (!this._map) {
270
- return;
271
- }
272
- // bind mapboxgl event listener
273
- this._map.on(MAPBOXGL_STYLE_UPDATE, this._onMapboxStyleUpdate);
274
-
275
- this._map.on(MAPBOXGL_RENDER, () => {
276
- if (typeof this.props.onMapRender === 'function') {
277
- this.props.onMapRender(this._map);
278
- }
279
- });
280
- }
281
-
282
- if (this.props.getMapboxRef) {
283
- // The parent component can gain access to our MapboxGlMap by
284
- // providing this callback. Note that 'mapbox' will be null when the
285
- // ref is unset (e.g. when a split map is closed).
286
- this.props.getMapboxRef(mapbox, this.props.index);
287
- }
288
- };
289
-
290
210
  _onDeckInitialized(gl) {
291
211
  if (this.props.onDeckInitialized) {
292
212
  this.props.onDeckInitialized(this._deck, gl);
@@ -351,6 +271,9 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
351
271
  mapboxApiUrl,
352
272
  maskPolygon
353
273
  } = this.props;
274
+
275
+ const mousePosition = this._mousePosition;
276
+
354
277
  trackers.drawCount?.increment();
355
278
 
356
279
  // initialise layers from props if exists
@@ -407,10 +330,12 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
407
330
  // Limit renders
408
331
  const hasRendered = this._hasRendered;
409
332
  const resetHasRendered = () => (hasRendered.current = false);
333
+
410
334
  return (
411
335
  <DeckGL
412
336
  controller={true}
413
337
  {...this.props.deckGlProps}
338
+ glOptions={{preserveDrawingBuffer: true}}
414
339
  viewState={mapState}
415
340
  onViewStateChange={({viewState}) => {
416
341
  // Limit updates (prevents freezes when dev tools open)
@@ -425,8 +350,15 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
425
350
  resetHasRendered();
426
351
  this._onBeforeRender(opts);
427
352
  }}
428
- onHover={visStateActions.onLayerHover}
353
+ // onHover={visStateActions.onLayerHover}
354
+ onHover={info => {
355
+ visStateActions.onLayerHover(info);
356
+ mousePosition.current = {mousePosition: info.pixel};
357
+ }}
429
358
  onClick={visStateActions.onLayerClick}
359
+ onDragStart={() => {
360
+ mousePosition.current = null;
361
+ }}
430
362
  onError={this._onDeckError}
431
363
  ref={comp => {
432
364
  if (comp && comp.deck && comp.deck !== this._deck) {
@@ -452,23 +384,6 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
452
384
  );
453
385
  }
454
386
 
455
- _updateMapboxLayers() {
456
- const mapboxLayers = this.mapboxLayersSelector(this.props);
457
- if (!Object.keys(mapboxLayers).length && !Object.keys(this.previousLayers).length) {
458
- return;
459
- }
460
-
461
- updateMapboxLayers(this._map, mapboxLayers, this.previousLayers);
462
-
463
- this.previousLayers = mapboxLayers;
464
- }
465
-
466
- _renderMapboxOverlays() {
467
- if (this._map && this._map.isStyleLoaded()) {
468
- this._updateMapboxLayers();
469
- }
470
- }
471
-
472
387
  _onViewportChange = viewState => {
473
388
  trackers.viewportChangeCount?.increment();
474
389
  const {width, height, ...restViewState} = viewState;
@@ -504,8 +419,6 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
504
419
  layers,
505
420
  MapComponent,
506
421
  datasets,
507
- mapboxApiAccessToken,
508
- mapboxApiUrl,
509
422
  mapControls,
510
423
  isExport,
511
424
  locale,
@@ -514,7 +427,8 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
514
427
  interactionConfig,
515
428
  editor,
516
429
  index,
517
- primary
430
+ primary,
431
+ generateThumbnail
518
432
  } = this.props;
519
433
 
520
434
  const layersToRender = this.layersToRenderSelector(this.props);
@@ -525,16 +439,11 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
525
439
  width: '100%',
526
440
  height: '100%',
527
441
  preserveDrawingBuffer: true,
528
- mapboxApiAccessToken,
529
- mapboxApiUrl,
530
- transformRequest
442
+ transformRequest,
443
+ generateThumbnail
531
444
  };
532
445
 
533
- const isEdit = (mapControls.mapDraw || {}).active;
534
-
535
- const hasGeocoderLayer = layers.find(l => l.id === GEOCODER_LAYER_ID);
536
446
  const isSplit = Boolean(mapState.isSplit);
537
- const mousePosition = this._mousePosition;
538
447
 
539
448
  return (
540
449
  <>
@@ -562,50 +471,11 @@ export default function MapContainerFactory(MapPopover, MapControl, Editor) {
562
471
  onSetLocale={uiStateActions.setLocale}
563
472
  onToggleEditorVisibility={visStateActions.toggleEditorVisibility}
564
473
  />
565
- <MapComponent
566
- {...mapProps}
567
- key="bottom"
568
- ref={this._setMapboxMap}
569
- mapStyle={mapStyle.bottomMapStyle}
570
- getCursor={this.props.hoverInfo ? () => 'pointer' : undefined}
571
- onMouseMove={evt => {
572
- // Sending mouse move updates via Redux is expensive. Store
573
- // locally and rely on deck.gl to drive render updates
574
- // See Builder: features/builder/ui/KeplerGl/MapContainer/MapContainer.tsx
575
- mousePosition.current = {mousePosition: evt.point};
576
- }}
577
- >
474
+ <MapComponent {...mapProps} key="bottom" mapStyle={mapStyle.bottomMapStyle}>
578
475
  {PERF_DEBUG && renderPerformanceStats()}
579
476
  {this._renderDeckOverlay(layersForDeck)}
580
- {this._renderMapboxOverlays()}
581
- <Editor
582
- index={index}
583
- datasets={datasets}
584
- editor={editor}
585
- filters={this.polygonFilters(this.props)}
586
- isEnabled={isEdit}
587
- layers={layers}
588
- layersToRender={layersToRender}
589
- onDeleteFeature={visStateActions.deleteFeature}
590
- onSelect={visStateActions.setSelectedFeature}
591
- onUpdate={visStateActions.setFeatures}
592
- onTogglePolygonFilter={visStateActions.setPolygonFilterLayer}
593
- style={{
594
- pointerEvents: isEdit ? 'all' : 'none',
595
- position: 'absolute',
596
- display: editor.visible ? 'block' : 'none'
597
- }}
598
- />
599
477
  </MapComponent>
600
- {mapStyle.topMapStyle || hasGeocoderLayer ? (
601
- <div style={MAP_STYLE.top}>
602
- <MapComponent {...mapProps} key="top" mapStyle={mapStyle.topMapStyle}>
603
- {this._renderDeckOverlay({[GEOCODER_LAYER_ID]: true})}
604
- </MapComponent>
605
- </div>
606
- ) : null}
607
478
  {this._renderMapPopover(layersToRender)}
608
- {!isSplit || index === 1 ? <Attribution /> : null}
609
479
  </>
610
480
  );
611
481
  }
@@ -55,12 +55,6 @@ PlotContainerFactory.deps = [MapContainerFactory, MapsLayoutFactory];
55
55
 
56
56
  // Remove mapbox logo in exported map, because it contains non-ascii characters
57
57
  const StyledPlotContainer = styled.div`
58
- .mapboxgl-ctrl-bottom-left,
59
- .mapboxgl-ctrl-bottom-right,
60
- .mapbox-attribution-container {
61
- display: none;
62
- }
63
-
64
58
  position: absolute;
65
59
  top: ${OUT_OF_SCREEN_POSITION}px;
66
60
  left: ${OUT_OF_SCREEN_POSITION}px;
@@ -83,7 +77,8 @@ export default function PlotContainerFactory(MapContainer, MapsLayout) {
83
77
  class PlotContainer extends Component {
84
78
  constructor(props) {
85
79
  super(props);
86
- this._onMapRender = debounce(this._onMapRender, 500);
80
+ // _onMapRender defined in cloud-native
81
+ this._generateThumbnail = null;
87
82
  this._retrieveNewScreenshot = debounce(this._retrieveNewScreenshot, 500);
88
83
  }
89
84
 
@@ -133,12 +128,6 @@ export default function PlotContainerFactory(MapContainer, MapsLayout) {
133
128
  })
134
129
  );
135
130
 
136
- _onMapRender = map => {
137
- if (map.isStyleLoaded()) {
138
- this._retrieveNewScreenshot();
139
- }
140
- };
141
-
142
131
  _retrieveNewScreenshot = () => {
143
132
  if (this.plottingAreaRef.current) {
144
133
  convertToPng(this.plottingAreaRef.current, {filter: DOM_FILTER_FUNC})
@@ -203,7 +192,7 @@ export default function PlotContainerFactory(MapContainer, MapsLayout) {
203
192
  }
204
193
  },
205
194
  MapComponent: StaticMap,
206
- onMapRender: this._onMapRender,
195
+ generateThumbnail: this._generateThumbnail,
207
196
  isExport: true,
208
197
  deckGlProps,
209
198
  maskPolygon
@@ -29,18 +29,16 @@ import {PanelLabel, Button, Tooltip} from 'components/common/styled-components';
29
29
  import Switch from 'components/common/switch';
30
30
  import ColorPalette from './color-palette';
31
31
  import CustomPalette from './custom-palette';
32
- import {COLOR_RANGES, hexColor} from 'constants/color-ranges';
32
+ import {COLOR_RANGES} from 'constants/color-ranges';
33
33
  import {numberSort} from 'utils/data-utils';
34
34
  import {reverseColorRange} from 'utils/color-utils';
35
35
  import {FormattedMessage} from 'localization';
36
36
  import {SwapHorizontal} from 'components/common/icons';
37
- import HexColumnConfig from './hex-column-config';
38
37
 
39
38
  export const ALL_TYPES = uniq([
40
39
  'all',
41
40
  ...COLOR_RANGES.map(c => c.type).filter(ctype => ctype),
42
- 'custom',
43
- {value: hexColor, divider: true}
41
+ 'custom'
44
42
  ]);
45
43
 
46
44
  export const ALL_STEPS = uniq(COLOR_RANGES.map(d => d.colors.length)).sort(numberSort);
@@ -97,11 +95,9 @@ ColorRangeSelectFactory.deps = [ColorPaletteGroupFactory, PaletteConfigFactory];
97
95
  export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig) {
98
96
  class ColorRangeSelect extends Component {
99
97
  static propTypes = {
100
- fields: PropTypes.arrayOf(PropTypes.any),
101
98
  colorPaletteUI: PropTypes.object.isRequired,
102
99
  selectedColorRange: PropTypes.object.isRequired,
103
100
  onSelectColorRange: PropTypes.func.isRequired,
104
- onSelectColorColumn: PropTypes.func.isRequired,
105
101
  setColorPaletteUI: PropTypes.func.isRequired,
106
102
  // optional
107
103
  colorRanges: PropTypes.arrayOf(PropTypes.any)
@@ -123,7 +119,7 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
123
119
  (colorRanges, type, steps) => {
124
120
  return colorRanges.filter(colorRange => {
125
121
  const isType = type === 'all' || type === colorRange.type;
126
- const isStep = Number(steps || 6) === colorRange.colors.length;
122
+ const isStep = Number(steps) === colorRange.colors.length;
127
123
 
128
124
  return isType && isStep;
129
125
  });
@@ -133,7 +129,7 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
133
129
  _updateConfig = ({key, value}) => {
134
130
  this._setColorRangeConfig({
135
131
  [key]: value,
136
- ...(key === 'type' && {custom: value === 'custom', hexColumn: value === hexColor})
132
+ ...(key === 'type' && {custom: value === 'custom'})
137
133
  });
138
134
  };
139
135
 
@@ -143,12 +139,6 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
143
139
  });
144
140
  };
145
141
 
146
- _onSetHexColorColumn = config => {
147
- this.props.setColorPaletteUI({
148
- customPalette: config
149
- });
150
- };
151
-
152
142
  _setColorRangeConfig = newConfig => {
153
143
  this.props.setColorPaletteUI({
154
144
  colorRangeConfig: newConfig
@@ -158,7 +148,7 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
158
148
  _onCustomPaletteCancel = newConfig => {
159
149
  this.props.setColorPaletteUI({
160
150
  showSketcher: false,
161
- colorRangeConfig: {custom: false, hexColumn: false}
151
+ colorRangeConfig: {custom: false}
162
152
  });
163
153
  };
164
154
 
@@ -168,18 +158,6 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
168
158
  });
169
159
  };
170
160
 
171
- _onSelectColumn = column => {
172
- this.props.onSelectColorColumn(column);
173
- this._setColorRangeConfig({
174
- type: hexColor,
175
- hexColumn: column?.name
176
- });
177
- };
178
-
179
- _handleOnChangePaletteType = ({key, value}) => {
180
- this._updateConfig({key, value});
181
- };
182
-
183
161
  render() {
184
162
  const {customPalette, showSketcher, colorRangeConfig} = this.props.colorPaletteUI;
185
163
  const filteredColorRanges = this.filteredColorRange(this.props);
@@ -190,8 +168,7 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
190
168
  {Object.keys(colorRangeConfig)
191
169
  .filter(
192
170
  key =>
193
- Boolean(CONFIG_SETTINGS[key]) &&
194
- (colorRangeConfig.custom || colorRangeConfig.hexColumn ? key === 'type' : true)
171
+ Boolean(CONFIG_SETTINGS[key]) && (colorRangeConfig.custom ? key === 'type' : true)
195
172
  )
196
173
  .map(key => {
197
174
  return (
@@ -199,8 +176,8 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
199
176
  key={key}
200
177
  label={CONFIG_SETTINGS[key].label || key}
201
178
  config={CONFIG_SETTINGS[key]}
202
- value={colorRangeConfig[key] || 6}
203
- onChange={value => this._handleOnChangePaletteType({key, value})}
179
+ value={colorRangeConfig[key]}
180
+ onChange={value => this._updateConfig({key, value})}
204
181
  />
205
182
  );
206
183
  })}
@@ -216,12 +193,6 @@ export default function ColorRangeSelectFactory(ColorPaletteGroup, PaletteConfig
216
193
  setCustomPalette={this._onSetCustomPalette}
217
194
  onCancel={this._onCustomPaletteCancel}
218
195
  />
219
- ) : colorRangeConfig.hexColumn ? (
220
- <HexColumnConfig
221
- fields={this.props.fields}
222
- value={colorRangeConfig.hexColumn}
223
- onSelectColumn={this._onSelectColumn}
224
- />
225
196
  ) : (
226
197
  <ColorPaletteGroup
227
198
  colorRanges={filteredColorRanges}
@@ -64,7 +64,6 @@ ColorSelectorFactory.deps = [SingleColorPaletteFactory, ColorRangeSelectFactory]
64
64
  function ColorSelectorFactory(SingleColorPalette, ColorRangeSelector) {
65
65
  class ColorSelector extends Component {
66
66
  static propTypes = {
67
- fields: PropTypes.arrayOf(PropTypes.any),
68
67
  colorSets: PropTypes.arrayOf(
69
68
  PropTypes.shape({
70
69
  selectedColor: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.any), PropTypes.object]),
@@ -125,10 +124,6 @@ function ColorSelectorFactory(SingleColorPalette, ColorRangeSelector) {
125
124
  }
126
125
  };
127
126
 
128
- _onSelectColorColumn = column => {
129
- this.props.onSelectHexColorColumn(column);
130
- };
131
-
132
127
  _showDropdown = (e, i) => {
133
128
  e.stopPropagation();
134
129
  e.preventDefault();
@@ -177,9 +172,7 @@ function ColorSelectorFactory(SingleColorPalette, ColorRangeSelector) {
177
172
  <ColorRangeSelector
178
173
  selectedColorRange={colorSets[editing].selectedColor}
179
174
  onSelectColorRange={this._onSelectColor}
180
- onSelectColorColumn={this._onSelectColorColumn}
181
175
  setColorPaletteUI={this.props.setColorUI}
182
- fields={this.props.fields}
183
176
  colorPaletteUI={colorUI}
184
177
  />
185
178
  ) : (
@@ -41,17 +41,12 @@ import TextLabelPanelFactory from './text-label-panel';
41
41
 
42
42
  import {capitalizeFirstLetter} from 'utils/utils';
43
43
 
44
- import {
45
- CHANNEL_SCALES,
46
- CHANNEL_SCALE_SUPPORTED_FIELDS,
47
- SCALE_TYPES
48
- } from 'constants/default-settings';
44
+ import {CHANNEL_SCALES, CHANNEL_SCALE_SUPPORTED_FIELDS} from 'constants/default-settings';
49
45
  import {LAYER_TYPES} from 'layers/types';
50
46
  import {injectIntl} from 'react-intl';
51
47
  import ColorDimensionScaleSelectorFactory from './color-dimension-scale-selector';
52
48
  import ColorSelectorFactory from './color-selector';
53
49
  import LayerAggregationResolutionFactory from './layer-aggregation-resolution';
54
- import {hexColorCustomPalette} from 'constants/color-ranges';
55
50
 
56
51
  const StyledLayerConfigurator = styled.div.attrs({
57
52
  className: 'layer-panel__config'
@@ -177,8 +172,6 @@ export default function LayerConfiguratorFactory(
177
172
  channel={layer.visualChannels.color}
178
173
  {...layerChannelConfigProps}
179
174
  />
180
- </ConfigGroupCollapsibleContent>
181
- <ConfigGroupCollapsibleContent>
182
175
  <VisConfigSlider {...layer.visConfigSettings.opacity} {...visConfiguratorProps} />
183
176
  </ConfigGroupCollapsibleContent>
184
177
  </LayerConfigGroup>
@@ -192,11 +185,7 @@ export default function LayerConfiguratorFactory(
192
185
  disabled={Boolean(layer.config.visConfig.customMarkers)}
193
186
  >
194
187
  {layer.config.strokeColorField ? (
195
- <LayerColorRangeSelector
196
- {...visConfiguratorProps}
197
- property="strokeColorRange"
198
- field="strokeColorField"
199
- />
188
+ <LayerColorRangeSelector {...visConfiguratorProps} property="strokeColorRange" />
200
189
  ) : (
201
190
  <LayerColorSelector
202
191
  {...visConfiguratorProps}
@@ -712,11 +701,7 @@ export default function LayerConfiguratorFactory(
712
701
  collapsible
713
702
  >
714
703
  {layer.config.strokeColorField ? (
715
- <LayerColorRangeSelector
716
- {...visConfiguratorProps}
717
- property="strokeColorRange"
718
- field="strokeColorField"
719
- />
704
+ <LayerColorRangeSelector {...visConfiguratorProps} property="strokeColorRange" />
720
705
  ) : (
721
706
  <LayerColorSelector
722
707
  {...visConfiguratorProps}
@@ -899,11 +884,7 @@ export default function LayerConfiguratorFactory(
899
884
  collapsible
900
885
  >
901
886
  {layer.config.strokeColorField ? (
902
- <LayerColorRangeSelector
903
- {...visConfiguratorProps}
904
- property="strokeColorRange"
905
- field="strokeColorField"
906
- />
887
+ <LayerColorRangeSelector {...visConfiguratorProps} property="strokeColorRange" />
907
888
  ) : (
908
889
  <LayerColorSelector
909
890
  {...visConfiguratorProps}
@@ -1067,14 +1048,13 @@ LayerColorSelectorFactory.deps = [ColorSelectorFactory];
1067
1048
  export function LayerColorSelectorFactory(ColorSelector) {
1068
1049
  class LayerColorSelector extends Component {
1069
1050
  render() {
1070
- const {layer, onChange, selectedColor, property = 'color', setColorUI, fields} = this.props;
1051
+ const {layer, onChange, selectedColor, property = 'color', setColorUI} = this.props;
1071
1052
  return (
1072
1053
  <SidePanelSection>
1073
1054
  <PanelLabel>
1074
1055
  <FormattedMessage id="layer.color" />
1075
1056
  </PanelLabel>
1076
1057
  <ColorSelector
1077
- fields={fields}
1078
1058
  colorSets={[
1079
1059
  {
1080
1060
  selectedColor: selectedColor || layer.config.color,
@@ -1096,22 +1076,13 @@ ArcLayerColorSelectorFactory.deps = [ColorSelectorFactory];
1096
1076
  export function ArcLayerColorSelectorFactory(ColorSelector) {
1097
1077
  class ArcLayerColorSelector extends Component {
1098
1078
  render() {
1099
- const {
1100
- layer,
1101
- onChangeConfig,
1102
- onChangeVisConfig,
1103
- property = 'color',
1104
- setColorUI,
1105
- fields
1106
- } = this.props;
1107
-
1079
+ const {layer, onChangeConfig, onChangeVisConfig, property = 'color', setColorUI} = this.props;
1108
1080
  return (
1109
1081
  <SidePanelSection>
1110
1082
  <PanelLabel>
1111
1083
  <FormattedMessage id="layer.colorRange" />
1112
1084
  </PanelLabel>
1113
1085
  <ColorSelector
1114
- fields={fields}
1115
1086
  colorSets={[
1116
1087
  {
1117
1088
  selectedColor: layer.config.color,
@@ -1138,30 +1109,18 @@ LayerColorRangeSelectorFactory.deps = [ColorSelectorFactory];
1138
1109
  export function LayerColorRangeSelectorFactory(ColorSelector) {
1139
1110
  class LayerColorRangeSelector extends Component {
1140
1111
  render() {
1141
- const {
1142
- layer,
1143
- onChange,
1144
- property = 'colorRange',
1145
- field = 'colorField',
1146
- scale = 'colorScale',
1147
- setColorUI,
1148
- fields
1149
- } = this.props;
1112
+ const {layer, onChange, property = 'colorRange', setColorUI} = this.props;
1150
1113
  return (
1151
1114
  <SidePanelSection>
1152
1115
  <PanelLabel>
1153
1116
  <FormattedMessage id="layer.colorRange" />
1154
1117
  </PanelLabel>
1155
1118
  <ColorSelector
1156
- fields={fields}
1157
1119
  colorSets={[
1158
1120
  {
1159
1121
  selectedColor: layer.config.visConfig[property],
1160
1122
  isRange: true,
1161
1123
  setColor: colorRange => {
1162
- layer.updateLayerConfig({
1163
- [scale]: SCALE_TYPES.ordinal
1164
- });
1165
1124
  const {colorMap} = layer.config.visConfig[property];
1166
1125
  const colorRangeUpdated = colorMap
1167
1126
  ? layer.updateColorMap(property, colorMap, colorRange)
@@ -1172,18 +1131,6 @@ export function LayerColorRangeSelectorFactory(ColorSelector) {
1172
1131
  ]}
1173
1132
  colorUI={layer.config.colorUI[property]}
1174
1133
  setColorUI={newConfig => setColorUI(property, newConfig)}
1175
- onSelectHexColorColumn={colorColumn => {
1176
- layer.updateLayerConfig({
1177
- [field]: {
1178
- ...layer.config[field],
1179
- colorColumn: colorColumn?.name,
1180
- colorColumnIdx: colorColumn?.fieldIdx
1181
- },
1182
- [scale]: SCALE_TYPES.identity
1183
- });
1184
-
1185
- onChange({[property]: hexColorCustomPalette});
1186
- }}
1187
1134
  />
1188
1135
  </SidePanelSection>
1189
1136
  );
@@ -61,12 +61,3 @@ export const DEFAULT_COLOR_RANGE = colorRanges.find(({name}) => name === 'Global
61
61
  category: 'Uber',
62
62
  colors: ['#5A1846', '#900C3F', '#C70039', '#E3611C', '#F1920E', '#FFC300']
63
63
  };
64
-
65
- export const hexColor = 'hexColor';
66
- export const hexColorCustomPalette = {
67
- name: hexColor,
68
- type: hexColor,
69
- colors: [],
70
- category: 'CARTO',
71
- hexColor: true
72
- };
@@ -45,7 +45,6 @@ import {
45
45
  import {getHTMLMapModeTileUrl} from 'utils/utils';
46
46
  import {TOOLTIP_FORMAT_TYPES} from './tooltip';
47
47
  import {LAYER_TYPES} from 'layers/types';
48
- import {scaleIdentity} from 'utils/custom-scales';
49
48
 
50
49
  export const ACTION_PREFIX = '@@kepler.gl/';
51
50
  export const CLOUDFRONT = 'https://d1a3f4spazzrp4.cloudfront.net/kepler.gl';
@@ -311,8 +310,7 @@ export const SCALE_TYPES = keyMirror({
311
310
  point: null,
312
311
  custom: null,
313
312
  // UI-only type, resolving as custom
314
- logarithmic: null,
315
- identity: null
313
+ logarithmic: null
316
314
  });
317
315
 
318
316
  export const SCALE_FUNC = {
@@ -323,8 +321,7 @@ export const SCALE_FUNC = {
323
321
  [SCALE_TYPES.sqrt]: scaleSqrt,
324
322
  [SCALE_TYPES.log]: scaleLog,
325
323
  [SCALE_TYPES.point]: scalePoint,
326
- [SCALE_TYPES.custom]: scaleThreshold,
327
- [SCALE_TYPES.identity]: scaleIdentity
324
+ [SCALE_TYPES.custom]: scaleThreshold
328
325
  };
329
326
 
330
327
  export const ALL_FIELD_TYPES = keyMirror({