[Maps] better style defaults (#52420)

* [Maps] better style defaults

* rename consts
This commit is contained in:
Nathan Reese 2019-12-09 14:38:46 -07:00 committed by GitHub
parent c692689f21
commit a863dca9c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 35 additions and 26 deletions

View file

@ -25,6 +25,7 @@ import { i18n } from '@kbn/i18n';
import { getDataSourceLabel } from '../../../../common/i18n_getters';
import { AbstractESAggSource } from '../es_agg_source';
import { DynamicStyleProperty } from '../../styles/vector/properties/dynamic_style_property';
import { StaticStyleProperty } from '../../styles/vector/properties/static_style_property';
const MAX_GEOTILE_LEVEL = 29;
@ -216,14 +217,14 @@ export class ESGeoGridSource extends AbstractESAggSource {
];
}
_createDefaultLayerDescriptor(options) {
if (this._descriptor.requestType === RENDER_AS.HEATMAP) {
return HeatmapLayer.createDescriptor({
sourceDescriptor: this._descriptor,
...options
});
}
_createHeatmapLayerDescriptor(options) {
return HeatmapLayer.createDescriptor({
sourceDescriptor: this._descriptor,
...options
});
}
_createVectorLayerDescriptor(options) {
const descriptor = VectorLayer.createDescriptor({
sourceDescriptor: this._descriptor,
...options
@ -244,6 +245,18 @@ export class ESGeoGridSource extends AbstractESAggSource {
color: 'Blues'
}
},
[VECTOR_STYLES.LINE_COLOR]: {
type: StaticStyleProperty.type,
options: {
color: '#FFF'
}
},
[VECTOR_STYLES.LINE_WIDTH]: {
type: StaticStyleProperty.type,
options: {
size: 0
}
},
[VECTOR_STYLES.ICON_SIZE]: {
type: DynamicStyleProperty.type,
options: {
@ -253,8 +266,6 @@ export class ESGeoGridSource extends AbstractESAggSource {
name: COUNT_PROP_NAME,
origin: SOURCE_DATA_ID_ORIGIN
},
minSize: 4,
maxSize: 32,
}
}
});
@ -264,15 +275,15 @@ export class ESGeoGridSource extends AbstractESAggSource {
createDefaultLayer(options) {
if (this._descriptor.requestType === RENDER_AS.HEATMAP) {
return new HeatmapLayer({
layerDescriptor: this._createDefaultLayerDescriptor(options),
layerDescriptor: this._createHeatmapLayerDescriptor(options),
source: this
});
}
const layerDescriptor = this._createDefaultLayerDescriptor(options);
const layerDescriptor = this._createVectorLayerDescriptor(options);
const style = new VectorStyle(layerDescriptor.style, this);
return new VectorLayer({
layerDescriptor: layerDescriptor,
layerDescriptor,
source: this,
style
});

View file

@ -146,8 +146,6 @@ export class ESPewPewSource extends AbstractESAggSource {
name: COUNT_PROP_NAME,
origin: SOURCE_DATA_ID_ORIGIN
},
minSize: 4,
maxSize: 32,
}
}
});

View file

@ -7,21 +7,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import { ValidatedDualRange } from 'ui/validated_range';
import { DEFAULT_MIN_SIZE, DEFAULT_MAX_SIZE } from '../../vector_style_defaults';
import { MIN_SIZE, MAX_SIZE } from '../../vector_style_defaults';
import { i18n } from '@kbn/i18n';
export function SizeRangeSelector({ minSize, maxSize, onChange, ...rest }) {
const onSizeChange = ([min, max]) => {
onChange({
minSize: Math.max(DEFAULT_MIN_SIZE, parseInt(min, 10)),
maxSize: Math.min(DEFAULT_MAX_SIZE, parseInt(max, 10)),
minSize: Math.max(MIN_SIZE, parseInt(min, 10)),
maxSize: Math.min(MAX_SIZE, parseInt(max, 10)),
});
};
return (
<ValidatedDualRange
min={DEFAULT_MIN_SIZE}
max={DEFAULT_MAX_SIZE}
min={MIN_SIZE}
max={MAX_SIZE}
step={1}
value={[minSize, maxSize]}
showInput="inputWithPopover"

View file

@ -7,4 +7,4 @@
export const SYMBOLIZE_AS_CIRCLE = 'circle';
export const SYMBOLIZE_AS_ICON = 'icon';
export const DEFAULT_ICON_SIZE = 10;
export const DEFAULT_ICON_SIZE = 6;

View file

@ -14,8 +14,8 @@ import {
const DEFAULT_ICON = 'airfield';
export const DEFAULT_MIN_SIZE = 1;
export const DEFAULT_MAX_SIZE = 64;
export const MIN_SIZE = 1;
export const MAX_SIZE = 64;
export const DEFAULT_SIGMA = 3;
export const VECTOR_STYLES = {
@ -112,8 +112,8 @@ export function getDefaultDynamicProperties() {
[VECTOR_STYLES.LINE_WIDTH]: {
type: VectorStyle.STYLE_TYPE.DYNAMIC,
options: {
minSize: DEFAULT_MIN_SIZE,
maxSize: DEFAULT_MAX_SIZE,
minSize: 1,
maxSize: 10,
field: undefined,
fieldMetaOptions: {
isEnabled: true,
@ -124,8 +124,8 @@ export function getDefaultDynamicProperties() {
[VECTOR_STYLES.ICON_SIZE]: {
type: VectorStyle.STYLE_TYPE.DYNAMIC,
options: {
minSize: DEFAULT_MIN_SIZE,
maxSize: DEFAULT_MAX_SIZE,
minSize: 4,
maxSize: 32,
field: undefined,
fieldMetaOptions: {
isEnabled: true,