Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] better style defaults #52420

Merged
merged 3 commits into from
Dec 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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: {
Expand All @@ -253,8 +266,6 @@ export class ESGeoGridSource extends AbstractESAggSource {
name: COUNT_PROP_NAME,
origin: SOURCE_DATA_ID_ORIGIN
},
minSize: 4,
maxSize: 32,
}
}
});
Expand All @@ -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
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ export class ESPewPewSource extends AbstractESAggSource {
name: COUNT_PROP_NAME,
origin: SOURCE_DATA_ID_ORIGIN
},
minSize: 4,
maxSize: 32,
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -109,8 +109,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,
Expand All @@ -121,8 +121,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,
Expand Down