@carto/kepler.gl 0.0.61 → 0.0.63-alpha.simplify-locales
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/CHANGELOG.md +905 -0
- package/README.md +42 -651
- package/dist/components/common/portaled.js +2 -2
- package/dist/components/side-panel/layer-panel/layer-configurator.js +3 -5
- package/dist/constants/default-settings.js +8 -5
- package/dist/layers/base-layer.js +19 -27
- package/dist/layers/geojson-layer/geojson-layer.js +5 -13
- package/dist/layers/icon-layer/icon-layer.js +6 -12
- package/dist/layers/layer-factory.js +1 -9
- package/dist/layers/layer-text-label.js +4 -8
- package/dist/layers/point-layer/point-layer.js +8 -22
- package/dist/localization/en.js +1 -3
- package/dist/localization/index.js +23 -10
- package/dist/localization/locales.js +2 -9
- package/package.json +6 -2
- package/src/.DS_Store +0 -0
- package/src/components/common/portaled.js +1 -1
- package/src/components/side-panel/layer-panel/layer-configurator.js +1 -8
- package/src/constants/default-settings.js +8 -0
- package/src/layers/base-layer.js +15 -26
- package/src/layers/geojson-layer/geojson-layer.js +4 -10
- package/src/layers/icon-layer/icon-layer.js +4 -17
- package/src/layers/layer-factory.d.ts +0 -1
- package/src/layers/layer-factory.js +0 -8
- package/src/layers/layer-text-label.js +5 -8
- package/src/layers/point-layer/point-layer.js +5 -17
- package/src/localization/en.js +0 -2
- package/src/localization/index.js +3 -8
- package/src/localization/locales.js +1 -8
- package/dist/localization/ca.js +0 -458
- package/dist/localization/cn.js +0 -461
- package/dist/localization/es.js +0 -458
- package/dist/localization/fi.js +0 -430
- package/dist/localization/ja.js +0 -459
- package/dist/localization/pt.js +0 -430
- package/dist/localization/ru.js +0 -467
- package/src/localization/ca.js +0 -479
- package/src/localization/cn.js +0 -480
- package/src/localization/es.js +0 -480
- package/src/localization/fi.js +0 -451
- package/src/localization/ja.js +0 -480
- package/src/localization/pt.js +0 -452
- package/src/localization/ru.js +0 -491
|
@@ -33,14 +33,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
33
33
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
34
34
|
// THE SOFTWARE.
|
|
35
35
|
var LOCALES = {
|
|
36
|
-
en: 'English'
|
|
37
|
-
fi: 'Suomi',
|
|
38
|
-
pt: 'Português',
|
|
39
|
-
es: 'Español',
|
|
40
|
-
ca: 'Català',
|
|
41
|
-
ja: '日本語',
|
|
42
|
-
cn: '简体中文',
|
|
43
|
-
ru: 'Русский'
|
|
36
|
+
en: 'English'
|
|
44
37
|
};
|
|
45
38
|
/**
|
|
46
39
|
* Localization can be passed to `KeplerGl` via uiState `locale`.
|
|
@@ -68,4 +61,4 @@ var LOCALE_CODES = Object.keys(LOCALES).reduce(function (acc, key) {
|
|
|
68
61
|
return _objectSpread(_objectSpread({}, acc), {}, (0, _defineProperty2["default"])({}, key, key));
|
|
69
62
|
}, {});
|
|
70
63
|
exports.LOCALE_CODES = LOCALE_CODES;
|
|
71
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
64
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9sb2NhbGl6YXRpb24vbG9jYWxlcy5qcyJdLCJuYW1lcyI6WyJMT0NBTEVTIiwiZW4iLCJMT0NBTEVfQ09ERVMiLCJPYmplY3QiLCJrZXlzIiwicmVkdWNlIiwiYWNjIiwia2V5Il0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVPLElBQU1BLE9BQU8sR0FBRztBQUNyQkMsRUFBQUEsRUFBRSxFQUFFO0FBRGlCLENBQWhCO0FBSVA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mAgYW5kIGBmaWAuIERlZmF1bHQgbGFuZ3VhZ2UgaXMgYGVuYFxuICogQGNvbnN0YW50XG4gKiBAcHVibGljXG4gKiBAZXhhbXBsZVxuICogYGBganNcbiAqIGltcG9ydCB7Y29tYmluZVJlZHVjZXJzfSBmcm9tICdyZWR1eCc7XG4gKiBpbXBvcnQge0xPQ0FMRV9DT0RFU30gZnJvbSAna2VwbGVyLmdsL2xvY2FsaXphdGlvbi9sb2NhbGVzJztcbiAqXG4gKiBjb25zdCBjdXN0b21pemVkS2VwbGVyR2xSZWR1Y2VyID0ga2VwbGVyR2xSZWR1Y2VyXG4gKiAgIC5pbml0aWFsU3RhdGUoe1xuICogICAgIHVpU3RhdGU6IHtcbiAqICAgICAgIC8vIHVzZSBGaW5uaXNoIGxvY2FsZVxuICogICAgICAgbG9jYWxlOiBMT0NBTEVfQ09ERVMuZmlcbiAqICAgICB9XG4gKiAgIH0pO1xuICpcbiAqIGBgYFxuICovXG5cbmV4cG9ydCBjb25zdCBMT0NBTEVfQ09ERVMgPSBPYmplY3Qua2V5cyhMT0NBTEVTKS5yZWR1Y2UoKGFjYywga2V5KSA9PiAoey4uLmFjYywgW2tleV06IGtleX0pLCB7fSk7XG4iXX0=
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@carto/kepler.gl",
|
|
3
3
|
"author": "CARTO",
|
|
4
4
|
"homepage": "https://github.com/CartoDB/carto-kepler#readme",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.63-alpha.simplify-locales",
|
|
6
6
|
"description": "kepler.gl is a webgl based application to visualize large scale location data in the browser",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -270,7 +270,11 @@
|
|
|
270
270
|
"engines": {
|
|
271
271
|
"node": ">=12.0.0"
|
|
272
272
|
},
|
|
273
|
+
"maintainers": [
|
|
274
|
+
"Shan He <heshan0131@gmail.com>",
|
|
275
|
+
"Giuseppe Macri <gmacri@uber.com>"
|
|
276
|
+
],
|
|
273
277
|
"volta": {
|
|
274
278
|
"node": "12.19.0"
|
|
275
279
|
}
|
|
276
|
-
}
|
|
280
|
+
}
|
package/src/.DS_Store
ADDED
|
Binary file
|
|
@@ -232,7 +232,7 @@ export default function LayerConfiguratorFactory(
|
|
|
232
232
|
{...layer.visConfigSettings.radiusRange}
|
|
233
233
|
{...visConfiguratorProps}
|
|
234
234
|
label={false}
|
|
235
|
-
disabled={!layer.config.sizeField
|
|
235
|
+
disabled={!layer.config.sizeField}
|
|
236
236
|
/>
|
|
237
237
|
)}
|
|
238
238
|
<ConfigGroupCollapsibleContent>
|
|
@@ -240,13 +240,6 @@ export default function LayerConfiguratorFactory(
|
|
|
240
240
|
channel={layer.visualChannels.size}
|
|
241
241
|
{...layerChannelConfigProps}
|
|
242
242
|
/>
|
|
243
|
-
{layer.config.sizeField ? (
|
|
244
|
-
<VisConfigSwitch
|
|
245
|
-
{...layer.visConfigSettings.fixedRadius}
|
|
246
|
-
{...visConfiguratorProps}
|
|
247
|
-
disabled={layer.config.visConfig.customMarkers}
|
|
248
|
-
/>
|
|
249
|
-
) : null}
|
|
250
243
|
</ConfigGroupCollapsibleContent>
|
|
251
244
|
</LayerConfigGroup>
|
|
252
245
|
|
|
@@ -460,6 +460,7 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
460
460
|
date: null,
|
|
461
461
|
geojson: null,
|
|
462
462
|
integer: [
|
|
463
|
+
AGGREGATION_TYPES.count,
|
|
463
464
|
AGGREGATION_TYPES.average,
|
|
464
465
|
AGGREGATION_TYPES.maximum,
|
|
465
466
|
AGGREGATION_TYPES.minimum,
|
|
@@ -468,6 +469,7 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
468
469
|
AGGREGATION_TYPES.variance
|
|
469
470
|
],
|
|
470
471
|
real: [
|
|
472
|
+
AGGREGATION_TYPES.count,
|
|
471
473
|
AGGREGATION_TYPES.average,
|
|
472
474
|
AGGREGATION_TYPES.maximum,
|
|
473
475
|
AGGREGATION_TYPES.minimum,
|
|
@@ -481,6 +483,10 @@ export const FIELD_TYPES_AGGREGATORS = {
|
|
|
481
483
|
};
|
|
482
484
|
|
|
483
485
|
export const FIELD_AGGREGATORS = [
|
|
486
|
+
{
|
|
487
|
+
id: AGGREGATION_TYPES.count,
|
|
488
|
+
displayName: 'COUNT'
|
|
489
|
+
},
|
|
484
490
|
{
|
|
485
491
|
id: AGGREGATION_TYPES.average,
|
|
486
492
|
displayName: 'AVG'
|
|
@@ -525,6 +531,7 @@ export const linearFieldScaleFunctions = {
|
|
|
525
531
|
|
|
526
532
|
export const linearFieldAggrScaleFunctions = {
|
|
527
533
|
[CHANNEL_SCALES.colorAggr]: {
|
|
534
|
+
[AGGREGATION_TYPES.count]: [SCALE_TYPES.custom],
|
|
528
535
|
[AGGREGATION_TYPES.average]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
529
536
|
[AGGREGATION_TYPES.maximum]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
530
537
|
[AGGREGATION_TYPES.minimum]: [SCALE_TYPES.quantize, SCALE_TYPES.quantile, SCALE_TYPES.custom],
|
|
@@ -535,6 +542,7 @@ export const linearFieldAggrScaleFunctions = {
|
|
|
535
542
|
},
|
|
536
543
|
|
|
537
544
|
[CHANNEL_SCALES.sizeAggr]: {
|
|
545
|
+
[AGGREGATION_TYPES.count]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
538
546
|
[AGGREGATION_TYPES.average]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
539
547
|
[AGGREGATION_TYPES.maximum]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
|
540
548
|
[AGGREGATION_TYPES.minimum]: [SCALE_TYPES.linear, SCALE_TYPES.sqrt, SCALE_TYPES.log],
|
package/src/layers/base-layer.js
CHANGED
|
@@ -975,10 +975,16 @@ class Layer {
|
|
|
975
975
|
.unknown(UNKNOWN_COLOR);
|
|
976
976
|
}
|
|
977
977
|
|
|
978
|
+
// for `count` aggregation, we domain is actually `[0, Infinity]` so it doesn't make sense
|
|
979
|
+
// to use it, so skip specyfying this domains
|
|
980
|
+
const domainIsInfinite = domain && (domain[0] === 0 && domain[1] === Infinity);
|
|
981
|
+
const scaleFactory = SCALE_FUNC[fixed ? 'linear' : scale];
|
|
978
982
|
// @ts-ignore d3-scale type
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
983
|
+
let result = scaleFactory();
|
|
984
|
+
if (domain && !domainIsInfinite) {
|
|
985
|
+
result = result.domain(domain);
|
|
986
|
+
}
|
|
987
|
+
return result.range(fixed ? domain : range);
|
|
982
988
|
}
|
|
983
989
|
|
|
984
990
|
/**
|
|
@@ -1256,7 +1262,7 @@ class Layer {
|
|
|
1256
1262
|
return objectInfo?.picked && objectInfo?.layer?.props?.id === this.id;
|
|
1257
1263
|
}
|
|
1258
1264
|
|
|
1259
|
-
getRadiusScaleByZoom(mapState
|
|
1265
|
+
getRadiusScaleByZoom(mapState) {
|
|
1260
1266
|
const radiusChannel = Object.values(this.visualChannels).find(vc => vc.property === 'radius');
|
|
1261
1267
|
|
|
1262
1268
|
if (!radiusChannel) {
|
|
@@ -1264,25 +1270,20 @@ class Layer {
|
|
|
1264
1270
|
}
|
|
1265
1271
|
|
|
1266
1272
|
const field = radiusChannel.field;
|
|
1267
|
-
const fixed = fixedRadius === undefined ? this.config.visConfig.fixedRadius : fixedRadius;
|
|
1268
1273
|
const {radius} = this.config.visConfig;
|
|
1269
1274
|
|
|
1270
1275
|
// @ts-ignore
|
|
1271
|
-
return
|
|
1276
|
+
return (this.config[field] ? 1 : radius) * this.getZoomFactor(mapState);
|
|
1272
1277
|
}
|
|
1273
1278
|
|
|
1274
|
-
getRadiusScale(
|
|
1279
|
+
getRadiusScale() {
|
|
1275
1280
|
const radiusChannel = Object.values(this.visualChannels).find(vc => vc.property === 'radius');
|
|
1276
1281
|
|
|
1277
|
-
if (!radiusChannel) {
|
|
1282
|
+
if (!radiusChannel || this.config[radiusChannel.field]) {
|
|
1278
1283
|
return 1;
|
|
1284
|
+
} else {
|
|
1285
|
+
return this.config.visConfig.radius;
|
|
1279
1286
|
}
|
|
1280
|
-
|
|
1281
|
-
const field = radiusChannel.field;
|
|
1282
|
-
const fixed = fixedRadius === undefined ? this.config.visConfig.fixedRadius : fixedRadius;
|
|
1283
|
-
const {radius} = this.config.visConfig;
|
|
1284
|
-
|
|
1285
|
-
return fixed ? 1 : (this.config[field] ? 1 : radius);
|
|
1286
1287
|
}
|
|
1287
1288
|
|
|
1288
1289
|
getMaxMarkerSize() {
|
|
@@ -1292,18 +1293,6 @@ class Layer {
|
|
|
1292
1293
|
return Math.ceil((field && radiusRange ? radiusRange[1] : radius));
|
|
1293
1294
|
}
|
|
1294
1295
|
|
|
1295
|
-
getRadiusUnit(fixedRadius) {
|
|
1296
|
-
const radiusChannel = Object.values(this.visualChannels).find(vc => vc.property === 'radius');
|
|
1297
|
-
|
|
1298
|
-
if (!radiusChannel) {
|
|
1299
|
-
return 'pixels';
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
const fixed = fixedRadius === undefined ? this.config.visConfig.fixedRadius : fixedRadius;
|
|
1303
|
-
|
|
1304
|
-
return fixed ? 'meters' : 'pixels';
|
|
1305
|
-
}
|
|
1306
|
-
|
|
1307
1296
|
shouldCalculateLayerData(props) {
|
|
1308
1297
|
return props.some(p => !this.noneLayerDataAffectingProps.includes(p));
|
|
1309
1298
|
}
|
|
@@ -237,15 +237,11 @@ export default class GeoJsonLayer extends Layer {
|
|
|
237
237
|
|
|
238
238
|
// get bounds from features
|
|
239
239
|
const bounds = getGeojsonBounds(this.dataToFeature);
|
|
240
|
-
// if any of the feature has properties.radius set to be true
|
|
241
|
-
const fixedRadius = Boolean(
|
|
242
|
-
this.dataToFeature.find(d => d && d.properties && d.properties.radius)
|
|
243
|
-
);
|
|
244
240
|
|
|
245
241
|
// keep a record of what type of geometry the collection has
|
|
246
242
|
const featureTypes = getGeojsonFeatureTypes(this.dataToFeature);
|
|
247
243
|
|
|
248
|
-
this.updateMeta({bounds,
|
|
244
|
+
this.updateMeta({bounds, featureTypes});
|
|
249
245
|
}
|
|
250
246
|
|
|
251
247
|
setInitialLayerConfig({dataContainer}) {
|
|
@@ -271,10 +267,8 @@ export default class GeoJsonLayer extends Layer {
|
|
|
271
267
|
renderLayer(opts) {
|
|
272
268
|
const {data, gpuFilter, objectHovered} = opts;
|
|
273
269
|
|
|
274
|
-
const {
|
|
275
|
-
const radiusScale = this.getRadiusScale(
|
|
276
|
-
const radiusUnits = this.getRadiusUnit(fixedRadius);
|
|
277
|
-
|
|
270
|
+
const {featureTypes} = this.meta;
|
|
271
|
+
const radiusScale = this.getRadiusScale();
|
|
278
272
|
const {visConfig} = this.config;
|
|
279
273
|
|
|
280
274
|
const layerProps = {
|
|
@@ -312,7 +306,7 @@ export default class GeoJsonLayer extends Layer {
|
|
|
312
306
|
wrapLongitude: false,
|
|
313
307
|
lineMiterLimit: 2,
|
|
314
308
|
rounded: true,
|
|
315
|
-
radiusUnits,
|
|
309
|
+
radiusUnits: 'pixels',
|
|
316
310
|
lineWidthUnits: 'pixels',
|
|
317
311
|
updateTriggers,
|
|
318
312
|
_subLayerProps: {
|
|
@@ -45,7 +45,6 @@ export const iconOptionalColumns = ['altitude'];
|
|
|
45
45
|
|
|
46
46
|
export const pointVisConfigs = {
|
|
47
47
|
radius: 'radius',
|
|
48
|
-
fixedRadius: 'fixedRadius',
|
|
49
48
|
opacity: 'opacity',
|
|
50
49
|
colorRange: 'colorRange',
|
|
51
50
|
radiusRange: 'radiusRange'
|
|
@@ -245,17 +244,10 @@ export default class IconLayer extends Layer {
|
|
|
245
244
|
}
|
|
246
245
|
|
|
247
246
|
renderLayer(opts) {
|
|
248
|
-
const {data, gpuFilter, objectHovered,
|
|
247
|
+
const {data, gpuFilter, objectHovered, interactionConfig} = opts;
|
|
249
248
|
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const radiusUnits = this.getRadiusUnit(fixedRadius);
|
|
253
|
-
|
|
254
|
-
const layerProps = {
|
|
255
|
-
radiusScale,
|
|
256
|
-
radiusUnits,
|
|
257
|
-
...(fixedRadius ? {} : {radiusMaxPixels: 500})
|
|
258
|
-
};
|
|
249
|
+
const radiusScale = this.getRadiusScale();
|
|
250
|
+
const layerProps = {radiusScale, radiusUnits: 'pixels', radiusMaxPixels: 500};
|
|
259
251
|
|
|
260
252
|
const updateTriggers = {
|
|
261
253
|
getPosition: this.config.columns,
|
|
@@ -265,12 +257,7 @@ export default class IconLayer extends Layer {
|
|
|
265
257
|
|
|
266
258
|
const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
|
|
267
259
|
const brushingProps = this.getBrushingExtensionProps(interactionConfig);
|
|
268
|
-
const getPixelOffset = getTextOffsetByRadius(
|
|
269
|
-
radiusScale,
|
|
270
|
-
data.getRadius,
|
|
271
|
-
mapState,
|
|
272
|
-
fixedRadius
|
|
273
|
-
);
|
|
260
|
+
const getPixelOffset = getTextOffsetByRadius(radiusScale, data.getRadius);
|
|
274
261
|
const extensions = [...defaultLayerProps.extensions, brushingExtension];
|
|
275
262
|
|
|
276
263
|
// shared Props between layer and label layer
|
|
@@ -84,7 +84,6 @@ export type LayerVisConfig = {
|
|
|
84
84
|
strokeWidthRange: VisConfigRange;
|
|
85
85
|
trailLength: VisConfigNumber;
|
|
86
86
|
radius: VisConfigNumber;
|
|
87
|
-
fixedRadius: VisConfigBoolean;
|
|
88
87
|
radiusRange: VisConfigRange;
|
|
89
88
|
clusterRadius: VisConfigNumber;
|
|
90
89
|
clusterRadiusRange: VisConfigRange;
|
|
@@ -120,14 +120,6 @@ export const LAYER_VIS_CONFIGS = {
|
|
|
120
120
|
group: PROPERTY_GROUPS.radius,
|
|
121
121
|
property: 'radius'
|
|
122
122
|
},
|
|
123
|
-
fixedRadius: {
|
|
124
|
-
defaultValue: false,
|
|
125
|
-
type: 'boolean',
|
|
126
|
-
label: 'layerVisConfigs.fixedRadius',
|
|
127
|
-
description: 'layerVisConfigs.fixedRadiusDescription',
|
|
128
|
-
group: PROPERTY_GROUPS.radius,
|
|
129
|
-
property: 'fixedRadius'
|
|
130
|
-
},
|
|
131
123
|
radiusRange: {
|
|
132
124
|
type: 'number',
|
|
133
125
|
defaultValue: [0, 50],
|
|
@@ -18,15 +18,13 @@
|
|
|
18
18
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
19
|
// THE SOFTWARE.
|
|
20
20
|
|
|
21
|
-
import {getDistanceScales} from 'viewport-mercator-project';
|
|
22
21
|
import {notNullorUndefined} from 'utils/data-utils';
|
|
23
22
|
import uniq from 'lodash.uniq';
|
|
24
23
|
|
|
25
24
|
export const defaultPadding = 20;
|
|
26
25
|
|
|
27
|
-
export function getTextOffsetByRadius(radiusScale, getRadius
|
|
26
|
+
export function getTextOffsetByRadius(radiusScale, getRadius) {
|
|
28
27
|
return textLabel => {
|
|
29
|
-
const distanceScale = getDistanceScales(mapState);
|
|
30
28
|
const xMult = textLabel.anchor === 'middle' ? 0 : textLabel.anchor === 'start' ? 1 : -1;
|
|
31
29
|
const yMult = textLabel.alignment === 'center' ? 0 : textLabel.alignment === 'bottom' ? 1 : -1;
|
|
32
30
|
|
|
@@ -37,17 +35,16 @@ export function getTextOffsetByRadius(radiusScale, getRadius, mapState, fixedRad
|
|
|
37
35
|
? textLabel.size
|
|
38
36
|
: textLabel.size;
|
|
39
37
|
|
|
40
|
-
const pixelRadius = fixedRadius ? radiusScale * distanceScale.pixelsPerMeter[0] : radiusScale;
|
|
41
38
|
const padding = defaultPadding;
|
|
42
39
|
|
|
43
40
|
return typeof getRadius === 'function'
|
|
44
41
|
? d => [
|
|
45
|
-
xMult * (getRadius(d) *
|
|
46
|
-
yMult * (getRadius(d) *
|
|
42
|
+
xMult * (getRadius(d) * radiusScale + padding),
|
|
43
|
+
yMult * (getRadius(d) * radiusScale + padding + sizeOffset)
|
|
47
44
|
]
|
|
48
45
|
: [
|
|
49
|
-
xMult * (getRadius *
|
|
50
|
-
yMult * (getRadius *
|
|
46
|
+
xMult * (getRadius * radiusScale + padding),
|
|
47
|
+
yMult * (getRadius * radiusScale + padding + sizeOffset)
|
|
51
48
|
];
|
|
52
49
|
};
|
|
53
50
|
}
|
|
@@ -44,7 +44,6 @@ const brushingExtension = new BrushingExtension();
|
|
|
44
44
|
|
|
45
45
|
export const pointVisConfigs = {
|
|
46
46
|
radius: 'radius',
|
|
47
|
-
fixedRadius: 'fixedRadius',
|
|
48
47
|
customMarkers: 'customMarkers',
|
|
49
48
|
customMarkersUrl: 'customMarkersUrl',
|
|
50
49
|
customMarkersRange: 'customMarkersRange',
|
|
@@ -123,7 +122,6 @@ export default class PointLayer extends Layer {
|
|
|
123
122
|
...super.visualChannels.size,
|
|
124
123
|
property: 'radius',
|
|
125
124
|
range: 'radiusRange',
|
|
126
|
-
fixed: 'fixedRadius',
|
|
127
125
|
channelScaleType: 'radius',
|
|
128
126
|
accessor: 'getRadius',
|
|
129
127
|
defaultValue: 1
|
|
@@ -279,26 +277,16 @@ export default class PointLayer extends Layer {
|
|
|
279
277
|
|
|
280
278
|
// eslint-disable-next-line complexity, max-statements
|
|
281
279
|
renderLayer(opts) {
|
|
282
|
-
const {data, gpuFilter, objectHovered,
|
|
280
|
+
const {data, gpuFilter, objectHovered, interactionConfig} = opts;
|
|
283
281
|
|
|
284
|
-
|
|
285
|
-
const fixedRadius = this.config.visConfig.fixedRadius && Boolean(this.config.sizeField);
|
|
286
|
-
const radiusScale = this.getRadiusScale(fixedRadius);
|
|
287
|
-
const radiusUnits = this.getRadiusUnit(fixedRadius);
|
|
282
|
+
const radiusScale = this.getRadiusScale();
|
|
288
283
|
|
|
289
284
|
const defaultLayerProps = this.getDefaultDeckLayerProps(opts);
|
|
290
285
|
const brushingProps = this.getBrushingExtensionProps(interactionConfig);
|
|
291
|
-
const getPixelOffset = getTextOffsetByRadius(
|
|
292
|
-
radiusScale,
|
|
293
|
-
data.getRadius,
|
|
294
|
-
mapState,
|
|
295
|
-
fixedRadius
|
|
296
|
-
);
|
|
286
|
+
const getPixelOffset = getTextOffsetByRadius(radiusScale, data.getRadius);
|
|
297
287
|
const extensions = [...defaultLayerProps.extensions, brushingExtension];
|
|
298
288
|
|
|
299
|
-
const {latitude, zoom} = mapState;
|
|
300
289
|
const updateTriggers = {
|
|
301
|
-
getPixelOffset: fixedRadius ? {latitude, zoom} : {},
|
|
302
290
|
getPosition: this.config.columns,
|
|
303
291
|
getFilterValue: gpuFilter.filterValueUpdateTriggers,
|
|
304
292
|
...this.getVisualChannelUpdateTriggers()
|
|
@@ -395,7 +383,7 @@ export default class PointLayer extends Layer {
|
|
|
395
383
|
lineWidthScale: this.config.visConfig.thickness,
|
|
396
384
|
// TODO: invent better way to render something when customMarkers are not yet configured
|
|
397
385
|
radiusScale: customMarkersMisConfigured ? radiusScale / 2 : radiusScale,
|
|
398
|
-
|
|
386
|
+
radiusMaxPixels: 500
|
|
399
387
|
};
|
|
400
388
|
|
|
401
389
|
return [
|
|
@@ -404,7 +392,7 @@ export default class PointLayer extends Layer {
|
|
|
404
392
|
...data,
|
|
405
393
|
...commonLayerProps,
|
|
406
394
|
...scatterPlotLayerProps,
|
|
407
|
-
radiusUnits,
|
|
395
|
+
radiusUnits: 'pixels',
|
|
408
396
|
lineWidthUnits: 'pixels',
|
|
409
397
|
updateTriggers,
|
|
410
398
|
extensions
|
package/src/localization/en.js
CHANGED
|
@@ -131,8 +131,6 @@ export default {
|
|
|
131
131
|
strokeWidth: 'Stroke Width (Pixels)',
|
|
132
132
|
strokeWidthRange: 'Stroke Width Range',
|
|
133
133
|
radius: 'Radius',
|
|
134
|
-
fixedRadius: 'Fixed Radius to meter',
|
|
135
|
-
fixedRadiusDescription: 'Map radius to absolute radius in meters, e.g. 5 to 5 meters',
|
|
136
134
|
radiusRange: 'Radius Range',
|
|
137
135
|
clusterRadius: 'Cluster Radius in Pixels',
|
|
138
136
|
radiusRangePixels: 'Radius Range in pixels',
|
|
@@ -20,17 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
import en from './en';
|
|
22
22
|
import {flattenMessages} from 'utils/locale-utils';
|
|
23
|
-
import {LOCALE_CODES} from './locales';
|
|
24
23
|
|
|
25
24
|
const enFlat = flattenMessages(en);
|
|
26
25
|
|
|
27
|
-
export const messages =
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[key]: key === 'en' ? enFlat : {...enFlat, ...flattenMessages(require(`./${key}`).default)}
|
|
31
|
-
}),
|
|
32
|
-
{}
|
|
33
|
-
);
|
|
26
|
+
export const messages = {
|
|
27
|
+
en: enFlat
|
|
28
|
+
};
|
|
34
29
|
|
|
35
30
|
export {LOCALE_CODES, LOCALES} from './locales';
|
|
36
31
|
|