Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Feat] (Editor) Replace react-map-gl-draw with Nebula.gl (#2054)

Igor Dykhtaa22e42591499
diff --git a/package.json b/package.json
index a47f33567..1bb6363b3 100644
--- a/package.json
+++ b/package.json
@@ -136,6 +136,7 @@
"@deck.gl/test-utils": "^8.6.0",
"@loaders.gl/polyfills": "^3.0.9",
"@luma.gl/test-utils": "^8.5.10",
+ "@nebula.gl/layers": "1.0.2-alpha.0",
"@probe.gl/env": "^3.0.1",
"@probe.gl/test-utils": "^3.0.1",
"@testing-library/react-hooks": "^3.4.2",
diff --git a/src/actions/src/vis-state-actions.ts b/src/actions/src/vis-state-actions.ts
index be1bc69e0..9cc0bb25a 100644
--- a/src/actions/src/vis-state-actions.ts
+++ b/src/actions/src/vis-state-actions.ts
@@ -31,6 +31,7 @@ import {
LayerVisConfig,
ColorUI,
Feature,
+ FeatureSelectionContext,
InteractionConfig,
Filter
} from '@kepler.gl/types';
@@ -1081,20 +1082,23 @@ export function setPolygonFilterLayer(
}
export type SetSelectedFeatureUpdaterAction = {
- feature: Feature;
+ feature: Feature | null;
+ selectionContext?: FeatureSelectionContext;
};
+
/**
- * Set the current feature to be edited/deleted
+ * Set the current feature to be edited/deleted,
+ * and the context of how the feature was selected.
* @memberof visStateActions
* @param feature
+ * @param selectionContext
* @returns action
*/
-export function setSelectedFeature(
- feature: Feature
-): Merge<SetSelectedFeatureUpdaterAction, {type: typeof ActionTypes.SET_SELECTED_FEATURE}> {
+export function setSelectedFeature(feature: Feature | null, selectionContext?: FeatureSelectionContext): Merge<SetSelectedFeatureUpdaterAction, {type: typeof ActionTypes.SET_SELECTED_FEATURE}> {
return {
type: ActionTypes.SET_SELECTED_FEATURE,
- feature
+ feature,
+ selectionContext
};
}
diff --git a/src/components/package.json b/src/components/package.json
index abe636a3d..8a6fe55a7 100644
--- a/src/components/package.json
+++ b/src/components/package.json
@@ -44,7 +44,7 @@
"@kepler.gl/table": "3.0.0-alpha.0",
"@kepler.gl/types": "3.0.0-alpha.0",
"@kepler.gl/utils": "3.0.0-alpha.0",
- "@nebula.gl/edit-modes": "0.14.0",
+ "@nebula.gl/edit-modes": "1.0.2-alpha.0",
"@tippyjs/react": "^4.2.0",
"@types/classnames": "^2.3.1",
"@types/d3-array": "^2.0.0",
@@ -104,7 +104,6 @@
"react-json-pretty": "^2.2.0",
"react-lifecycles-compat": "^3.0.4",
"react-map-gl": "^5.0.3",
- "react-map-gl-draw": "0.14.8",
"react-markdown": "^5.0.2",
"react-modal": "^3.8.1",
"react-onclickoutside": "^6.7.1",
diff --git a/src/components/src/common/item-selector/item-selector.tsx b/src/components/src/common/item-selector/item-selector.tsx
index 9b5e4b729..782b40d99 100644
--- a/src/components/src/common/item-selector/item-selector.tsx
+++ b/src/components/src/common/item-selector/item-selector.tsx
@@ -132,6 +132,7 @@ export type ItemSelectorProps = {
fixedOptions?: ReadonlyArray<string | number | boolean | object> | null;
erasable?: boolean;
showArrow?: boolean;
+ searchOptions?: (value: any, opt: any) => any;
searchable?: boolean;
displayOption?: string | ((opt: any) => any);
getOptionValue?: string | ((opt: any) => any);
@@ -297,6 +298,7 @@ class ItemSelectorUnmemoized extends Component<ItemSelectorProps> {
customListItemComponent={this.props.DropDownLineItemRenderComponent}
displayOption={Accessor.generateOptionToStringFor(this.props.displayOption)}
searchable={this.props.searchable}
+ searchOptions={this.props.searchOptions}
showOptionsWhenEmpty
selectedItems={toArray(this.props.selectedItems)}
light={this.props.inputTheme === 'light'}
diff --git a/src/components/src/common/toolbar-item.tsx b/src/components/src/common/toolbar-item.tsx
index d83993e9e..c6f77707a 100644
--- a/src/components/src/common/toolbar-item.tsx
+++ b/src/components/src/common/toolbar-item.tsx
@@ -44,7 +44,7 @@ const StyledDiv = styled.div.attrs(props => ({
background-color: ${props =>
props.active ? props.theme.toolbarItemBgdHover : props.theme.dropdownListBgd};
- svg {
+ .toolbar-item__svg-container {
margin-bottom: 4px;
}
.toolbar-item__title {
@@ -87,7 +87,11 @@ const ToolbarItem = React.memo((props: ToolbarItemProps) => (
props.onClick?.(e);
}}
>
- {props.icon && <props.icon />}
+ {props.icon && (
+ <div className="toolbar-item__svg-container">
+ <props.icon />
+ </div>
+ )}
<div className="toolbar-item__title">
<FormattedMessage id={props.label} />
</div>
diff --git a/src/components/src/editor/editor.tsx b/src/components/src/editor/editor.tsx
index 52f461973..09d523957 100644
--- a/src/components/src/editor/editor.tsx
+++ b/src/components/src/editor/editor.tsx
@@ -20,7 +20,6 @@
import React, {Component, CSSProperties, KeyboardEvent} from 'react';
import styled from 'styled-components';
-import {Editor as Draw} from 'react-map-gl-draw';
import window from 'global/window';
import classnames from 'classnames';
import get from 'lodash.get';
@@ -33,18 +32,12 @@ import {
EDITOR_MODES,
KeyEvent
} from '@kepler.gl/constants';
-import {Layer} from '@kepler.gl/layers';
-
-import {DEFAULT_RADIUS, getStyle as getFeatureStyle} from './feature-styles';
-import {getStyle as getEditHandleStyle, getEditHandleShape} from './handle-style';
-import {Filter} from '@kepler.gl/types';
+import {Layer, EditorLayerUtils} from '@kepler.gl/layers';
+import {Filter, FeatureSelectionContext} from '@kepler.gl/types';
import {Feature} from '@nebula.gl/edit-modes';
-import {MjolnirGestureEvent} from 'mjolnir.js';
import {Datasets} from '@kepler.gl/table';
-const StyledWrapper = styled.div`
- cursor: ${(props: {editor: {mode: string}}) =>
- props.editor.mode === EDITOR_MODES.EDIT ? 'pointer' : 'crosshair'};
+const StyledWrapper = styled.div<{editor: any}>`
position: relative;
`;
@@ -56,15 +49,13 @@ interface EditorProps {
filters: Filter[];
layers: Layer[];
datasets: Datasets;
- editor: {selectedFeature: Feature; mode: string};
+ editor: {selectedFeature: Feature; mode: string, selectionContext?: FeatureSelectionContext};
layersToRender: Record<string, Layer>;
index: number;
className: string;
- clickRadius: number;
style: CSSProperties;
- isEnabled: boolean;
onSelect: (f: Feature | null) => void;
- onUpdate: (f: Feature[]) => void;
+ onSetEditorMode: (m: any) => void;
onDeleteFeature: (f: Feature) => void;
onTogglePolygonFilter: (l: Layer, f: Feature) => void;
}
@@ -73,16 +64,11 @@ export default function EditorFactory(
FeatureActionPanel: React.FC<FeatureActionPanelProps>
): React.ComponentClass<EditorProps> {
class EditorUnmemoized extends Component<EditorProps> {
- static defaultProps = {
- clickRadius: DEFAULT_RADIUS
- };
+ static defaultProps = {};
static displayName = 'Editor';
- state = {
- showActions: false,
- lastPosition: null
- };
+ state = {};
componentDidMount() {
window.addEventListener('keydown', this._onKeyPressed);
@@ -125,18 +111,17 @@ export default function EditorFactory(
);
_onKeyPressed = (event: KeyboardEvent) => {
- const {isEnabled} = this.props;
-
- if (!isEnabled) {
- return;
- }
-
switch (event.keyCode) {
case KeyEvent.DOM_VK_DELETE:
case KeyEvent.DOM_VK_BACK_SPACE:
this._onDeleteSelectedFeature();
break;
case KeyEvent.DOM_VK_ESCAPE:
+ // reset active drawing
+ if (EditorLayerUtils.isDrawingActive(true, this.props.editor.mode)) {
+ this.props.onSetEditorMode(EDITOR_MODES.EDIT);
+ }
+
this.props.onSelect(null);
break;
default:
@@ -144,47 +129,18 @@ export default function EditorFactory(
}
};
- _onSelect = ({
- selectedFeatureId,
- sourceEvent
- }: {
- selectedFeatureId: string | number;
- sourceEvent: MjolnirGestureEvent;
- }) => {
- const allFeatures = this.allFeaturesSelector(this.props);
- this.setState(
- {
- ...(sourceEvent.rightButton
- ? {
- showActions: true,
- lastPosition: {
- x: sourceEvent.changedPointers[0].offsetX,
- y: sourceEvent.changedPointers[0].offsetY
- }
- }
- : null)
- },
- () => {
- this.props.onSelect(allFeatures.find(f => f.id === selectedFeatureId));
- }
- );
- };
-
_onDeleteSelectedFeature = () => {
- if (this.state.showActions) {
- this.setState({showActions: false});
- }
-
const {editor} = this.props;
- const {selectedFeature = {}} = editor;
- this.props.onDeleteFeature(selectedFeature);
+ this.props.onDeleteFeature(editor.selectedFeature || {});
};
_closeFeatureAction = () => {
- this.setState({showActions: false});
+ // reset selection context
+ const {selectedFeature} = this.props.editor;
+ this.props.onSelect(selectedFeature);
};
- _onToggleLayer = (layer: Layer) => {
+ _togglePolygonFilter = (layer: Layer) => {
const {selectedFeature} = this.props.editor;
if (!selectedFeature) {
return;
@@ -194,37 +150,25 @@ export default function EditorFactory(
};
render() {
- const {className, clickRadius, datasets, editor, onUpdate, style} = this.props;
-
- const {lastPosition, showActions} = this.state;
- const selectedFeatureId = get(editor, ['selectedFeature', 'id']);
+ const {className, datasets, editor, style, index} = this.props;
+ const {selectedFeature, selectionContext} = editor;
const currentFilter = this.currentFilterSelector(this.props);
const availableLayers = this.availableLayersSeletor(this.props);
- const allFeatures = this.allFeaturesSelector(this.props);
+
+ const {rightClick, position, mapIndex} = selectionContext || {};
return (
<StyledWrapper editor={editor} className={classnames('editor', className)} style={style}>
- <Draw
- clickRadius={clickRadius}
- mode={editor.mode}
- features={allFeatures}
- selectedFeatureId={selectedFeatureId}
- onSelect={this._onSelect}
- onUpdate={onUpdate}
- getEditHandleShape={getEditHandleShape}
- getFeatureStyle={getFeatureStyle}
- getEditHandleStyle={getEditHandleStyle}
- />
- {showActions && Boolean(selectedFeatureId) ? (
+ {Boolean(rightClick) && selectedFeature && index === mapIndex ? (
<FeatureActionPanel
- selectedFeature={get(editor, ['selectedFeature'])}
+ selectedFeature={selectedFeature}
datasets={datasets}
layers={availableLayers}
currentFilter={currentFilter}
onClose={this._closeFeatureAction}
onDeleteFeature={this._onDeleteSelectedFeature}
- onToggleLayer={this._onToggleLayer}
- position={lastPosition}
+ onToggleLayer={this._togglePolygonFilter}
+ position={position || null}
/>
) : null}
</StyledWrapper>
diff --git a/src/components/src/editor/feature-action-panel.tsx b/src/components/src/editor/feature-action-panel.tsx
index 0619d1673..e567e8f89 100644
--- a/src/components/src/editor/feature-action-panel.tsx
+++ b/src/components/src/editor/feature-action-panel.tsx
@@ -36,6 +36,9 @@ const LAYOVER_OFFSET = 4;
const StyledActionsLayer = styled.div`
position: absolute;
+ .layer-panel-item-disabled {
+ color: ${props => props.theme.textColor};
+ }
`;
PureFeatureActionPanelFactory.deps = [];
@@ -93,18 +96,31 @@ export function PureFeatureActionPanelFactory(): React.FC<FeatureActionPanelProp
label={intl.formatMessage({id: 'editor.filterLayer', defaultMessage: 'Filter layers'})}
Icon={Layers}
>
- {layers.map((layer, index) => (
+ {layers.length ? (
+ layers.map((layer, index) => (
+ <ActionPanelItem
+ key={index}
+ label={layer.config.label}
+ // @ts-ignore
+ color={datasets[layer.config.dataId].color}
+ isSelection={true}
+ isActive={layerId.includes(layer.id)}
+ onClick={() => onToggleLayer(layer)}
+ className="layer-panel-item"
+ />
+ ))
+ ) : (
<ActionPanelItem
- key={index}
- label={layer.config.label}
- // @ts-ignore
- color={datasets[layer.config.dataId].color}
- isSelection={true}
- isActive={layerId.includes(layer.id)}
- onClick={() => onToggleLayer(layer)}
- className="layer-panel-item"
+ key={'no-layers'}
+ label={intl.formatMessage({
+ id: 'editor.noLayersToFilter',
+ defaultMessage: 'No layers to filter'
+ })}
+ isSelection={false}
+ isActive={false}
+ className="layer-panel-item-disabled"
/>
- ))}
+ )}
</ActionPanelItem>
<ActionPanelItem
label={intl.formatMessage({id: 'editor.copyGeometry', defaultMessage: 'Copy Geometry'})}
@@ -112,7 +128,6 @@ export function PureFeatureActionPanelFactory(): React.FC<FeatureActionPanelProp
Icon={copied ? Checkmark : Copy}
onClick={copyGeometry}
/>
-
<ActionPanelItem
label={intl.formatMessage({id: 'tooltip.delete', defaultMessage: 'Delete'})}
className="delete-panel-item"
diff --git a/src/components/src/editor/feature-styles.ts b/src/components/src/editor/feature-styles.ts
deleted file mode 100644
index b80d68b43..000000000
--- a/src/components/src/editor/feature-styles.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2022 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {RenderStates, RenderTypes} from 'react-map-gl-draw';
-import get from 'lodash.get';
-import {COLORS} from './constants';
-
-export const DEFAULT_RADIUS = 5;
-export const DEFAULT_STATE_STYLE_STROKE = COLORS.PRIMARY;
-
-export const STATE_STYLES_STROKE = {
- [RenderStates.INACTIVE]: '#26B5F2',
- [RenderStates.UNCOMMITTED]: '#a9a9a9',
- [RenderStates.CLOSING]: '#a9a9a9',
- [RenderStates.SELECTED]: '#26B5F2',
- [RenderStates.HOVERED]: '#26B5F2'
-};
-
-export const DEFAULT_STATE_STYLE_FILL = '#000';
-
-export const STATE_STYLES_FILL = {
- [RenderStates.INACTIVE]: '#333333',
- [RenderStates.HOVERED]: '#7ac943',
- [RenderStates.SELECTED]: '#ffff00',
- [RenderStates.UNCOMMITTED]: '#a9a9a9',
- [RenderStates.CLOSING]: '#a9a9a9'
-};
-
-export const DEFAULT_STATE_STYLE_OPACITY = 0.1;
-
-export const STATE_STYLES_STROKE_WIDTH = 2;
-
-export const DEFAULT_STROKE_DASH_ARRAY = '4,2';
-
-export const RENDER_TYPE_STYLES = {
- [RenderTypes.POINT]: () => ({r: DEFAULT_RADIUS}),
- [RenderTypes.LINE_STRING]: () => ({fill: 'none'})
-};
-
-export function noOp() {}
-
-export function getStyle({feature, state}) {
- const isVisible = get(feature, ['properties', 'isVisible'], true);
- const style = {
- stroke: STATE_STYLES_STROKE[state] || DEFAULT_STATE_STYLE_STROKE,
- strokeWidth: isVisible ? STATE_STYLES_STROKE_WIDTH : 0,
- fill: STATE_STYLES_FILL[state] || DEFAULT_STATE_STYLE_FILL,
- fillOpacity: DEFAULT_STATE_STYLE_OPACITY,
- ...(state !== RenderStates.SELECTED ? {strokeDasharray: DEFAULT_STROKE_DASH_ARRAY} : null)
- };
-
- const renderType = feature.properties ? feature.properties.renderType : feature.renderType;
-
- return {
- ...style,
- ...(RENDER_TYPE_STYLES[renderType] || noOp)()
- };
-}
diff --git a/src/components/src/editor/handle-style.ts b/src/components/src/editor/handle-style.ts
deleted file mode 100644
index 50201791e..000000000
--- a/src/components/src/editor/handle-style.ts
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (c) 2022 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import {RenderStates, RenderTypes} from 'react-map-gl-draw';
-import {COLORS} from './constants';
-import get from 'lodash.get';
-
-const DEFAULT_EDIT_HANDLE_SHAPE = 'circle';
-
-const rectStyle = {
- x: -6,
- y: -6,
- height: 12,
- width: 12
-};
-
-export const DEFAULT_STATE_STYLE_STROKE = COLORS.PRIMARY;
-
-export const STATE_STYLES_STROKE = {
- [RenderStates.SELECTED]: COLORS.PRIMARY,
- [RenderStates.HOVERED]: COLORS.SECONDARY
-};
-
-export const DEFAULT_STATE_STYLE_FILL = '#ffffff';
-
-export const STATE_STYLES_FILL = {
- [RenderStates.SELECTED]: COLORS.SECONDARY,
- [RenderStates.HOVERED]: COLORS.SECONDARY,
- [RenderStates.INACTIVE]: COLORS.PRIMARY,
- [RenderStates.UNCOMMITTED]: COLORS.PRIMARY
-};
-
-const STATE_STYLES_STROKE_WIDTH = 1;
-
-export const RENDER_TYPE_STYLES = {
- [RenderTypes.POINT]: state => ({
- fill: STATE_STYLES_FILL[state],
- stroke: state === RenderStates.SELECTED ? COLORS.PRIMARY : DEFAULT_STATE_STYLE_STROKE
- }),
- [RenderTypes.LINE_STRING]: () => rectStyle,
- [RenderTypes.RECTANGLE]: () => rectStyle,
- [RenderTypes.POLYGON]: () => rectStyle
-};
-
-export const DEFAULT_STATE_STYLE_OPACITY = 0;
-
-export const DEFAULT_RADIUS = 5;
-
-function noOp() {}
-
-export function getStyle({feature, state}) {
- const isVisible = get(feature, ['properties', 'isVisible'], true);
-
- const style = {
- stroke: STATE_STYLES_STROKE[state] || DEFAULT_STATE_STYLE_STROKE,
- strokeWidth: isVisible ? STATE_STYLES_STROKE_WIDTH : 0,
- fill: DEFAULT_STATE_STYLE_FILL,
- fillOpacity: DEFAULT_STATE_STYLE_OPACITY,
- r: DEFAULT_RADIUS
- };
-
- const renderType = feature.properties ? feature.properties.renderType : feature.renderType;
-
- return {
- ...style,
- ...(RENDER_TYPE_STYLES[renderType] || noOp)(state)
- };
-}
-
-export function getEditHandleShape() {
- return DEFAULT_EDIT_HANDLE_SHAPE;
-}
diff --git a/src/components/src/filters/filter-panels/polygon-filter-panel.tsx b/src/components/src/filters/filter-panels/polygon-filter-panel.tsx
index 101d3ce69..b0043fb9a 100644
--- a/src/components/src/filters/filter-panels/polygon-filter-panel.tsx
+++ b/src/components/src/filters/filter-panels/polygon-filter-panel.tsx
@@ -52,7 +52,7 @@ function PolygonFilterPanelFactory(
const onSetLayers = useCallback(value => setFilter(idx, 'layerId', value), [setFilter, idx]);
const isVisible = get(filter, ['value', 'properties', 'isVisible'], true);
- const featureType = get(filter, ['value', 'properties', 'renderType'], true);
+ const featureType = get(filter, ['value', 'geometry', 'type'], 'Polygon');
return (
<div className="polygon-filter-panel">
diff --git a/src/components/src/filters/polygon-filter.tsx b/src/components/src/filters/polygon-filter.tsx
index e1448caa7..d6da89a6d 100644
--- a/src/components/src/filters/polygon-filter.tsx
+++ b/src/components/src/filters/polygon-filter.tsx
@@ -50,6 +50,11 @@ function PolygonFilterFactory() {
);
}, [layers, selectedLayers]);
+ const searchOptions = useCallback((value, options) => {
+ const searchStr = value?.toLowerCase();
+ return options.filter(l => l.config?.label?.toLowerCase().indexOf(searchStr) >= 0);
+ }, []);
+
return (
<div>
<StyledFilterPanel htmlFor={`filter-${filter.id}`}>Layers:</StyledFilterPanel>
@@ -57,10 +62,12 @@ function PolygonFilterFactory() {
options={availableLayers}
selectedItems={selectedLayers}
onChange={setNewLayers}
- searchable={false}
+ searchable={true}
+ searchOptions={searchOptions}
multiSelect={true}
getOptionValue={(l: Layer) => l.id}
displayOption={(l: Layer) => l.config.label}
+ placeholder={'placeholder.selectLayer'}
/>
</div>
);
diff --git a/src/components/src/index.ts b/src/components/src/index.ts
index cea03006b..74fe1dab4 100644
--- a/src/components/src/index.ts
+++ b/src/components/src/index.ts
@@ -188,7 +188,6 @@ export {default as RangeFilterFactory} from './filters/range-filter';
// // Editor Factory
export {default as EditorFactory} from './editor/editor';
-export {getStyle} from './editor/feature-styles';
export {default as FeatureActionPanelFactory, PureFeatureActionPanelFactory} from './editor/feature-action-panel';
// Injector
diff --git a/src/components/src/map-container.tsx b/src/components/src/map-container.tsx
index 635ec910a..c226c49f2 100644
--- a/src/components/src/map-container.tsx
+++ b/src/components/src/map-container.tsx
@@ -20,10 +20,10 @@
// libraries
import React, {Component, createRef, useMemo} from 'react';
-import MapboxGLMap, {MapRef} from 'react-map-gl';
+import {withTheme} from 'styled-components';
+import {StaticMap, MapRef} from 'react-map-gl';
import DeckGL from '@deck.gl/react';
import {createSelector, Selector} from 'reselect';
-import WebMercatorViewport from 'viewport-mercator-project';
import mapboxgl from 'mapbox-gl';
import {VisStateActions, MapStateActions, UIStateActions} from '@kepler.gl/actions';
@@ -40,7 +40,8 @@ import {
generateMapboxLayers,
updateMapboxLayers,
LayerBaseConfig,
- VisualChannelDomain
+ VisualChannelDomain,
+ EditorLayerUtils
} from '@kepler.gl/layers';
import {MapState, MapControls, Viewport, SplitMap, SplitMapLayers} from '@kepler.gl/types';
import {
@@ -53,7 +54,9 @@ import {
hasMobileWidth,
EMPTY_MAPBOX_STYLE,
getMapLayersFromSplitMaps,
- onViewPortChange
+ onViewPortChange,
+ getViewportFromMapState,
+ normalizeEvent
} from '@kepler.gl/utils';
import {breakPointValues} from '@kepler.gl/styles';
@@ -61,7 +64,8 @@ import {breakPointValues} from '@kepler.gl/styles';
import {
FILTER_TYPES,
GEOCODER_LAYER_ID,
- THROTTLE_NOTIFICATION_TIME
+ THROTTLE_NOTIFICATION_TIME,
+ DEFAULT_PICKING_RADIUS
} from '@kepler.gl/constants';
import ErrorBoundary from './common/error-boundary';
@@ -189,14 +193,16 @@ interface MapContainerProps {
index?: number;
locale?: any;
+ theme?: any;
editor?: any;
- MapComponent?: typeof MapboxGLMap;
+ MapComponent?: typeof StaticMap;
deckGlProps?: any;
onDeckInitialized?: (a: any, b: any) => void;
onViewStateChange?: (viewport: Viewport) => void;
topMapContainerProps: any;
bottomMapContainerProps: any;
+ transformRequest?: any;
}
export default function MapContainerFactory(
@@ -207,7 +213,7 @@ export default function MapContainerFactory(
class MapContainer extends Component<MapContainerProps> {
displayName = 'MapContainer';
static defaultProps = {
- MapComponent: MapboxGLMap,
+ MapComponent: StaticMap,
deckGlProps: {},
index: 0,
primary: true
@@ -282,8 +288,30 @@ export default function MapContainerFactory(
prepareLayersForDeck
);
filtersSelector = props => props.visState.filters;
- polygonFilters = createSelector(this.filtersSelector, filters =>
- filters.filter(f => f.type === FILTER_TYPES.polygon)
+ polygonFiltersSelector = createSelector(this.filtersSelector, filters =>
+ filters.filter(f => f.type === FILTER_TYPES.polygon && f.enabled !== false)
+ );
+ featuresSelector = props => props.visState.editor.features;
+ selectedFeatureSelector = props => props.visState.editor.selectedFeature;
+ featureCollectionSelector = createSelector(
+ this.polygonFiltersSelector,
+ this.featuresSelector,
+ (polygonFilters, features) => ({
+ type: 'FeatureCollection',
+ features: features.concat(polygonFilters.map(f => f.value))
+ })
+ );
+ selectedPolygonIndexSelector = createSelector(
+ this.featureCollectionSelector,
+ this.selectedFeatureSelector,
+ (collection, selectedFeature) =>
+ collection.features.findIndex(f => f.id === selectedFeature?.id)
+ );
+ selectedFeatureIndexArraySelector = createSelector(
+ (value: number) => value,
+ value => {
+ return value < 0 ? [] : [value];
+ }
);
mapboxLayersSelector = createSelector(
@@ -419,7 +447,7 @@ export default function MapContainerFactory(
let layerPinnedProp: LayerHoverProp | null = null;
if (pinned || clicked) {
// project lnglat to screen so that tooltip follows the object on zoom
- const viewport = new WebMercatorViewport(mapState);
+ const viewport = getViewportFromMapState(mapState);
const lngLat = clicked ? clicked.coordinate : pinned.coordinate;
pinnedPosition = this._getHoverXY(viewport, lngLat);
layerPinnedProp = getLayerHoverProp({
@@ -483,9 +511,25 @@ export default function MapContainerFactory(
mapboxApiAccessToken,
mapboxApiUrl,
deckGlProps,
- index
+ index,
+ mapControls,
+ theme
} = this.props;
+ const {hoverInfo, editor} = visState;
+ const {primaryMap} = options;
+
+ // disable double click zoom when editor is in any draw mode
+ const {mapDraw} = mapControls;
+ const {active: editorMenuActive = false} = mapDraw || {};
+ const isEditorDrawingMode = EditorLayerUtils.isDrawingActive(editorMenuActive, editor.mode);
+
+ const viewport = getViewportFromMapState(mapState);
+
+ const editorFeatureSelectedIndex = this.selectedPolygonIndexSelector(this.props);
+
+ const {setFeatures, onLayerClick, setSelectedFeature} = visStateActions;
+
const deckGlLayers = computeDeckLayers(
{
visState,
@@ -494,38 +538,112 @@ export default function MapContainerFactory(
},
{
mapIndex: index,
- primaryMap: options.primaryMap,
+ primaryMap,
mapboxApiAccessToken,
mapboxApiUrl,
- layersForDeck
+ layersForDeck,
+ editorInfo: primaryMap
+ ? {
+ editor,
+ editorMenuActive,
+ onSetFeatures: setFeatures,
+ setSelectedFeature,
+ featureCollection: this.featureCollectionSelector(this.props),
+ selectedFeatureIndexes: this.selectedFeatureIndexArraySelector(
+ editorFeatureSelectedIndex
+ ),
+ viewport
+ }
+ : undefined
},
this._onLayerSetDomain,
deckGlProps
);
+ const extraDeckParams: {
+ getTooltip?: (info: any) => object | null;
+ getCursor?: ({isDragging: boolean}) => string;
+ } = {};
+ if (primaryMap) {
+ extraDeckParams.getTooltip = info =>
+ EditorLayerUtils.getTooltip(info, {
+ editorMenuActive,
+ editor,
+ theme
+ });
+
+ extraDeckParams.getCursor = ({isDragging}: {isDragging: boolean}) => {
+ const editorCursor = EditorLayerUtils.getCursor({
+ editorMenuActive,
+ editor,
+ hoverInfo
+ });
+ if (editorCursor) return editorCursor;
+
+ if (isDragging) return 'grabbing';
+ if (hoverInfo?.layer) return 'pointer';
+ return 'grab';
+ };
+ }
+
const views = deckGlProps?.views
? deckGlProps?.views()
: new MapView({legacyMeterSizes: true});
return (
- <DeckGL
- id="default-deckgl-overlay"
- {...deckGlProps}
- views={views}
- layers={deckGlLayers}
- controller={true}
- viewState={mapState}
- onBeforeRender={this._onBeforeRender}
- onHover={visStateActions.onLayerHover}
- onClick={visStateActions.onLayerClick}
- onError={this._onDeckError}
- ref={comp => {
- if (comp && comp.deck && !this._deck) {
- this._deck = comp.deck;
- }
- }}
- onWebGLInitialized={gl => this._onDeckInitialized(gl)}
- />
+ <div
+ onMouseMove={
+ primaryMap
+ ? // @ts-expect-error should be deck viewport
+ event => this.props.visStateActions.onMouseMove(normalizeEvent(event, viewport))
+ : undefined
+ }
+ >
+ <DeckGL
+ id="default-deckgl-overlay"
+ {...deckGlProps}
+ views={views}
+ layers={deckGlLayers}
+ controller={{doubleClickZoom: !isEditorDrawingMode}}
+ viewState={mapState}
+ pickingRadius={DEFAULT_PICKING_RADIUS}
+ onBeforeRender={this._onBeforeRender}
+ onViewStateChange={this._onViewportChange}
+ {...extraDeckParams}
+ onHover={(data, event) => {
+ const res = EditorLayerUtils.onHover(data, {
+ editorMenuActive,
+ editor,
+ hoverInfo
+ });
+ if (res) return;
+
+ visStateActions.onLayerHover(data);
+ }}
+ onClick={(data, event) => {
+ // @ts-ignore
+ const res = EditorLayerUtils.onClick(data, event, {
+ editorMenuActive,
+ editor,
+ onLayerClick,
+ setSelectedFeature,
+ mapIndex: index
+ });
+ if (res) return;
+
+ visStateActions.onLayerClick(data);
+ }}
+ onError={this._onDeckError}
+ ref={comp => {
+ // @ts-ignore
+ if (comp && comp.deck && !this._deck) {
+ // @ts-ignore
+ this._deck = comp.deck;
+ }
+ }}
+ onWebGLInitialized={gl => this._onDeckInitialized(gl)}
+ />
+ </div>
);
}
@@ -546,10 +664,10 @@ export default function MapContainerFactory(
}
}
- _renderDrawEditor() {
- const {visState, mapControls, visStateActions, index} = this.props;
+ _renderEditorContextMenu() {
+ const {visState, visStateActions, index} = this.props;
const {layers, datasets, editor} = visState;
- const isEdit = mapControls.mapDraw ? mapControls.mapDraw.active : false;
+
const layersToRender = this.layersToRenderSelector(this.props);
return (
@@ -557,16 +675,15 @@ export default function MapContainerFactory(
index={index}
datasets={datasets}
editor={editor}
- filters={this.polygonFilters(this.props)}
- isEnabled={isEdit}
+ filters={this.polygonFiltersSelector(this.props)}
layers={layers}
layersToRender={layersToRender}
onDeleteFeature={visStateActions.deleteFeature}
onSelect={visStateActions.setSelectedFeature}
- onUpdate={visStateActions.setFeatures}
onTogglePolygonFilter={visStateActions.setPolygonFilterLayer}
+ onSetEditorMode={visStateActions.setEditorMode}
style={{
- pointerEvents: isEdit ? 'all' : 'none',
+ pointerEvents: 'all',
position: 'absolute',
display: editor.visible ? 'block' : 'none'
}}
@@ -574,7 +691,7 @@ export default function MapContainerFactory(
);
}
- _onViewportChange = viewState => {
+ _onViewportChange = ({viewState}) => {
onViewPortChange(
viewState,
this.props.mapStateActions.updateMap,
@@ -596,7 +713,7 @@ export default function MapContainerFactory(
mapState,
mapStyle,
mapStateActions,
- MapComponent = MapboxGLMap,
+ MapComponent = StaticMap,
mapboxApiAccessToken,
mapboxApiUrl,
mapControls,
@@ -610,7 +727,7 @@ export default function MapContainerFactory(
topMapContainerProps
} = this.props;
- const {layers, datasets, editor, interactionConfig, hoverInfo} = visState;
+ const {layers, datasets, editor, interactionConfig} = visState;
const layersToRender = this.layersToRenderSelector(this.props);
const layersForDeck = this.layersForDeckSelector(this.props);
@@ -624,8 +741,7 @@ export default function MapContainerFactory(
preserveDrawingBuffer: true,
mapboxApiAccessToken: currentStyle?.accessToken || mapboxApiAccessToken,
mapboxApiUrl,
- onViewportChange: this._onViewportChange,
- transformRequest
+ transformRequest: this.props.transformRequest || transformRequest
};
const hasGeocoderLayer = Boolean(layers.find(l => l.id === GEOCODER_LAYER_ID));
@@ -658,21 +774,23 @@ export default function MapContainerFactory(
onToggleEditorVisibility={visStateActions.toggleEditorVisibility}
mapHeight={mapState.height}
/>
+ {/*
+ // @ts-ignore */}
<MapComponent
key="bottom"
{...mapProps}
mapStyle={mapStyle.bottomMapStyle ?? EMPTY_MAPBOX_STYLE}
{...bottomMapContainerProps}
ref={this._setMapboxMap}
- getCursor={hoverInfo ? () => 'pointer' : undefined}
- onMouseMove={this.props.visStateActions.onMouseMove}
>
{this._renderDeckOverlay(layersForDeck, {primaryMap: true})}
{this._renderMapboxOverlays()}
- {this._renderDrawEditor()}
+ {this._renderEditorContextMenu()}
</MapComponent>
{mapStyle.topMapStyle || hasGeocoderLayer ? (
<div style={MAP_STYLE.top}>
+ {/*
+ // @ts-ignore */}
<MapComponent
key="top"
{...mapProps}
@@ -693,12 +811,16 @@ export default function MapContainerFactory(
render() {
return (
- <StyledMapContainer ref={this._ref} style={MAP_STYLE.container}>
+ <StyledMapContainer
+ ref={this._ref}
+ style={MAP_STYLE.container}
+ onContextMenu={event => event.preventDefault()}
+ >
{this._renderMap()}
</StyledMapContainer>
);
}
}
- return MapContainer;
+ return withTheme(MapContainer);
}
diff --git a/src/components/src/map/map-control-toolbar.tsx b/src/components/src/map/map-control-toolbar.tsx
index bad92774d..188c348d0 100644
--- a/src/components/src/map/map-control-toolbar.tsx
+++ b/src/components/src/map/map-control-toolbar.tsx
@@ -25,6 +25,25 @@ function MapControlToolbar() {
const StyledToolbar = styled(VerticalToolbar)`
position: absolute;
right: 32px;
+ transform: translateX(calc(-50% + 45px));
+
+ .toolbar-item {
+ width: 120px;
+ padding: 13px 16px;
+ flex-direction: row;
+ justify-content: flex-start;
+
+ .toolbar-item__svg-container {
+ width: 16px;
+ height: 16px;
+ margin-right: 10px;
+ }
+
+ .toolbar-item__title {
+ margin-left: auto;
+ margin-right: auto;
+ }
+ }
`;
return StyledToolbar;
diff --git a/src/components/src/map/map-draw-panel.tsx b/src/components/src/map/map-draw-panel.tsx
index e3fa66be0..2b53f7992 100644
--- a/src/components/src/map/map-draw-panel.tsx
+++ b/src/components/src/map/map-draw-panel.tsx
@@ -92,12 +92,6 @@ function MapDrawPanelFactory(MapControlTooltip, MapControlToolbar) {
icon={actionIcons.rectangle}
active={editor.mode === EDITOR_MODES.DRAW_RECTANGLE}
/>
- <ToolbarItem
- className="toggle-features"
- onClick={onToggleEditorVisibility}
- label={editor.visible ? 'toolbar.hide' : 'toolbar.show'}
- icon={editor.visible ? actionIcons.visible : actionIcons.hidden}
- />
</MapControlToolbar>
) : null}
<MapControlTooltip id="map-draw" message="tooltip.DrawOnMap">
diff --git a/src/constants/package.json b/src/constants/package.json
index f62d67fae..60df29a2b 100644
--- a/src/constants/package.json
+++ b/src/constants/package.json
@@ -36,8 +36,7 @@
"colorbrewer": "^1.5.0",
"d3-scale": "^3.2.3",
"global": "^4.3.0",
- "keymirror": "^0.1.1",
- "react-map-gl-draw": "0.14.8"
+ "keymirror": "^0.1.1"
},
"nyc": {
"sourceMap": false,
diff --git a/src/constants/src/default-settings.ts b/src/constants/src/default-settings.ts
index 367f2e72b..22ac9ae34 100644
--- a/src/constants/src/default-settings.ts
+++ b/src/constants/src/default-settings.ts
@@ -19,7 +19,6 @@
// THE SOFTWARE.
import keyMirror from 'keymirror';
-import {EditorModes} from 'react-map-gl-draw';
import {
scaleLinear,
@@ -657,6 +656,8 @@ export const DEFAULT_TOOLTIP_FIELDS: any[] = [];
export const NO_VALUE_COLOR: RGBAColor = [0, 0, 0, 0];
+export const DEFAULT_PICKING_RADIUS = 3;
+
export const LAYER_BLENDINGS = {
additive: {
label: 'layerBlending.additive',
@@ -920,14 +921,13 @@ export const GEOCODER_GEO_OFFSET = 0.05;
export const GEOCODER_ICON_COLOR: [number, number, number] = [255, 0, 0];
export const GEOCODER_ICON_SIZE = 80;
-// We could use directly react-map-gl-draw EditorMode but this would
-// create a direct dependency with react-map-gl-draw
-// Created this map to be independent from react-map-gl-draw
+// Editor
+export const EDITOR_LAYER_ID = 'kepler_editor_layer';
+export const EDITOR_LAYER_PICKING_RADIUS = 6;
export const EDITOR_MODES = {
- READ_ONLY: EditorModes.READ_ONLY,
- DRAW_POLYGON: EditorModes.DRAW_POLYGON,
- DRAW_RECTANGLE: EditorModes.DRAW_RECTANGLE,
- EDIT: EditorModes.EDIT_VERTEX
+ DRAW_POLYGON: 'DRAW_POLYGON',
+ DRAW_RECTANGLE: 'DRAW_RECTANGLE',
+ EDIT: 'EDIT_VERTEX'
};
export const PLOT_TYPES = keyMirror({
diff --git a/src/layers/package.json b/src/layers/package.json
index 0491620a9..1d8e4931a 100644
--- a/src/layers/package.json
+++ b/src/layers/package.json
@@ -46,6 +46,8 @@
"@loaders.gl/gltf": "^3.0.9",
"@luma.gl/constants": "^8.5.10",
"@mapbox/geojson-normalize": "0.0.1",
+ "@nebula.gl/layers": "1.0.2-alpha.0",
+ "@nebula.gl/edit-modes": "1.0.2-alpha.0",
"@turf/bbox": "^6.0.1",
"@turf/helpers": "^6.1.4",
"@types/geojson": "^7946.0.7",
diff --git a/src/components/src/editor/constants.ts b/src/layers/src/editor-layer/constants.ts
similarity index 75%
rename from src/components/src/editor/constants.ts
rename to src/layers/src/editor-layer/constants.ts
index 6241d0950..dbcf50a5b 100644
--- a/src/components/src/editor/constants.ts
+++ b/src/layers/src/editor-layer/constants.ts
@@ -18,22 +18,21 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-// Copied from react-map-gl-draw until it gets exported
-export const RENDER_STATE = {
- INACTIVE: 'INACTIVE',
- UNCOMMITTED: 'UNCOMMITTED',
- SELECTED: 'SELECTED',
- HOVERED: 'HOVERED'
-};
-export const RENDER_TYPE = {
- POINT: 'Point',
- LINE_STRING: 'LineString',
- POLYGON: 'Polygon',
- RECTANGLE: 'Rectangle'
-};
+import {RGBColor} from '@kepler.gl/types';
+
export const COLORS = {
- PRIMARY: '#26B5F2',
- SECONDARY: '#ffff00',
- TERTIARY: '#6c6c6c'
+ // blue
+ PRIMARY: [0x26, 0xb5, 0xf2] as RGBColor,
+ // gray
+ SECONDARY: [0xaa, 0xaa, 0xaa] as RGBColor,
+ // yellow
+ HIGHLIGHT: [0xff, 0xff, 0x00] as RGBColor
+};
+
+export const EDIT_TYPES = {
+ ADD_POSITION: 'addPosition',
+ MOVE_POSITION: 'movePosition',
+ TRANSLATING: 'translating',
+ ADD_FEATURE: 'addFeature'
};
diff --git a/src/layers/src/editor-layer/editor-layer-utils.ts b/src/layers/src/editor-layer/editor-layer-utils.ts
new file mode 100644
index 000000000..fa12bc937
--- /dev/null
+++ b/src/layers/src/editor-layer/editor-layer-utils.ts
@@ -0,0 +1,226 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import {PickInfo} from '@deck.gl/core/lib/deck';
+import {Editor, Feature, FeatureSelectionContext} from '@kepler.gl/types';
+import {EDITOR_LAYER_ID, EDITOR_MODES} from '@kepler.gl/constants';
+
+/**
+ * Returns true if drawing is active.
+ * @param editorMenuActive Indicates whether the editor side menu is active.
+ * @param mode Current editing mode.
+ * @returs Returns true if drawing is active.
+ */
+export function isDrawingActive(editorMenuActive: boolean, mode: string): boolean {
+ return (
+ (editorMenuActive &&
+ (mode === EDITOR_MODES.DRAW_POLYGON || mode === EDITOR_MODES.DRAW_RECTANGLE))
+ );
+}
+
+/**
+ * Handles click event for Editor layer.
+ * @param info Information about clicked object.
+ * @param event Event object.
+ * @param params
+ * @param params.editorMenuActive
+ * @param params.editor
+ * @param params.onLayerClick
+ * @param params.setSelectedFeature
+ * @param params.mapIndex
+ * @returns Returns true is the click is handled.
+ */
+// eslint-disable-next-line complexity
+export function onClick(
+ info: PickInfo<any>,
+ event: any,
+ {editorMenuActive, editor, setSelectedFeature, onLayerClick, mapIndex = 0}: {
+ editorMenuActive: boolean;
+ editor: Editor;
+ onLayerClick: (data, clickEvent) => any;
+ setSelectedFeature: (
+ feature: Feature | null,
+ selectionContext?: FeatureSelectionContext
+ ) => any;
+ mapIndex?: number;
+ }
+): boolean {
+ const drawingActive = isDrawingActive(editorMenuActive, editor.mode);
+
+ if (info?.layer?.id === EDITOR_LAYER_ID && info?.object) {
+ const objectType = info.object.geometry?.type;
+
+ if (drawingActive) {
+ if (editor.selectedFeature) {
+ setSelectedFeature(null);
+ }
+ } else if (objectType === 'Polygon' || objectType === 'Point') {
+ let clickContext;
+ if (event.rightButton) {
+ clickContext = {
+ mapIndex,
+ rightClick: true,
+ position: {
+ x: event.changedPointers[0].offsetX,
+ y: event.changedPointers[0].offsetY
+ }
+ };
+ }
+
+ if (objectType === 'Polygon') {
+ setSelectedFeature(info.object, clickContext);
+ } else {
+ // don't select points
+ setSelectedFeature(editor.selectedFeature, clickContext);
+ }
+ }
+ // hide tooltips from regular data layers
+ onLayerClick(null, event);
+ } else if (drawingActive) {
+ // prevent interaction with other layers
+ onLayerClick(null, event);
+ } else {
+ if (editor.selectedFeature) {
+ if (event.rightButton) {
+ return true;
+ }
+
+ // click outside removes selection
+ setSelectedFeature(null);
+ }
+
+ return false;
+ }
+ return true;
+}
+
+/**
+ * Handles hover event for Editor layer.
+ * @param info Information about hovered object.
+ * @param params
+ * @param params.editorMenuActive
+ * @param params.editor
+ * @param params.hoverInfo
+ * @returns Returns true is hover is handled.
+ */
+export function onHover(info: PickInfo<any>, {hoverInfo, editor, editorMenuActive}: {editorMenuActive: boolean; editor: Editor; hoverInfo}): boolean {
+ if (isDrawingActive(editorMenuActive, editor.mode)) {
+ return true;
+ }
+
+ return info?.layer?.id === EDITOR_LAYER_ID && hoverInfo?.layer?.id === EDITOR_LAYER_ID;
+}
+
+/**
+ * Returns tooltip based on interactions with Editor layer.
+ * @param info Information about hovered object.
+ * @param params
+ * @param params.editorMenuActive
+ * @param params.editor
+ * @param params.theme
+ * @raturns Returns a tooltip object compatible with Deck.getTooltip()
+ */
+// eslint-disable-next-line complexity
+export function getTooltip(info: PickInfo<any>, {editor, theme, editorMenuActive}: {editorMenuActive: boolean; editor: Editor; theme: any}): object | null {
+ const {object, layer} = info;
+
+ // don't show the tooltip when the menu is visible
+ if (editor.selectionContext?.rightClick) {
+ return null;
+ }
+
+ if (isDrawingActive(editorMenuActive, editor.mode)) {
+ // TODO save interaction state in editor object
+ if (layer?.state?.mode?._clickSequence?.length) {
+ return null;
+ }
+
+ return getTooltipObject('Click to start new feature', theme);
+ }
+
+ if (layer?.id === EDITOR_LAYER_ID) {
+ const {selectedFeature} = editor;
+
+ if (selectedFeature) {
+ if (!object || (object.id && object.id === selectedFeature.id)) {
+ return getTooltipObject('Right click to view options\nDrag to move the feature', theme);
+ }
+ }
+
+ if (object?.properties?.editHandleType === 'intermediate') {
+ return getTooltipObject('Click to insert a point', theme);
+ }
+
+ if (object?.geometry?.type === 'Point' || object?.properties?.guideType === 'tentative') {
+ return getTooltipObject('Drag to move the point', theme);
+ }
+
+ return getTooltipObject('Click to select the feature\nRight click to view options', theme);
+ }
+
+ return null;
+}
+
+/**
+ * Returns cursor type based on interactions with Editor layer.
+ * @param params
+ * @param params.editorMenuActive
+ * @param params.editor
+ * @param params.hoverInfo
+ * @returns Returns cursor type.
+ */
+export function getCursor({editorMenuActive, editor, hoverInfo}: {
+ editorMenuActive: boolean;
+ editor: Editor;
+ hoverInfo: any;
+}): string | null {
+ if (isDrawingActive(editorMenuActive, editor.mode)) {
+ return 'crosshair';
+ }
+
+ if (hoverInfo?.layer?.id === EDITOR_LAYER_ID && editor.selectedFeature) {
+ return 'move';
+ }
+
+ return null;
+}
+
+/**
+ * Returns a tooltip object that can be used as a Deck tooltip.
+ * @param text Text to show.
+ * @param theme Current theme.
+ */
+function getTooltipObject(text: string, theme: any): {text: string, style: object} {
+ return {
+ text,
+ style: {
+ 'margin-top': '15px',
+ 'margin-left': '15px',
+ 'font-family': theme.fontFamily,
+ 'font-size': theme.tooltipFontSize,
+ 'font-weight': 400,
+ padding: '7px 18px',
+ 'box-shadow': theme.tooltipBoxShadow,
+ 'background-color': theme.tooltipBg,
+ color: theme.tooltipColor,
+ 'border-radius': theme.primaryBtnRadius
+ }
+ };
+}
diff --git a/src/layers/src/editor-layer/editor-layer.ts b/src/layers/src/editor-layer/editor-layer.ts
new file mode 100644
index 000000000..967153f5f
--- /dev/null
+++ b/src/layers/src/editor-layer/editor-layer.ts
@@ -0,0 +1,180 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import {EditableGeoJsonLayer} from '@nebula.gl/layers';
+import {
+ DrawPolygonMode,
+ TranslateMode,
+ CompositeMode,
+ DrawRectangleMode
+} from '@nebula.gl/edit-modes';
+import {PathStyleExtension} from '@deck.gl/extensions';
+
+import {
+ EDITOR_LAYER_ID,
+ EDITOR_MODES,
+ EDITOR_LAYER_PICKING_RADIUS
+} from '@kepler.gl/constants';
+import {Viewport, Editor, Feature, FeatureSelectionContext} from '@kepler.gl/types';
+import {generateHashId} from '@kepler.gl/utils';
+
+import {EDIT_TYPES} from './constants';
+import {LINE_STYLE, FEATURE_STYLE, EDIT_HANDLE_STYLE} from './feature-styles';
+import {ModifyModeExtended} from './modify-mode-extended';
+import {isDrawingActive} from './editor-layer-utils';
+
+const DEFAULT_COMPOSITE_MODE = new CompositeMode([new TranslateMode(), new ModifyModeExtended()]);
+
+export type GetEditorLayerProps = {
+ editorMenuActive: boolean;
+ editor: Editor;
+ onSetFeatures: (features: Feature[]) => any;
+ setSelectedFeature: (feature: Feature | null, selectionContext?: FeatureSelectionContext) => any;
+ viewport: Viewport;
+ featureCollection: {
+ type: string;
+ features: Feature[];
+ };
+ selectedFeatureIndexes: number[];
+};
+
+/**
+ * Returns editable layer to edit polygon filters.
+ * @param params
+ * @param params.editorMenuActive Indicates whether the editor side menu is active.
+ * @param params.editor
+ * @param params.onSetFeatures A callback to set features.
+ * @param params.setSelectedFeature A callback to set selected feature and selection context.
+ * @param params.viewport Current viewport.
+ * @param params.featureCollection Feature collection with an array of features
+ * @param params.selectedFeatureIndexes An array with index of currently selected feature.
+ */
+export function getEditorLayer({
+ editorMenuActive,
+ editor,
+ onSetFeatures,
+ setSelectedFeature,
+ featureCollection,
+ selectedFeatureIndexes,
+ viewport
+}: GetEditorLayerProps): EditableGeoJsonLayer {
+ const {mode: editorMode} = editor;
+
+ let mode = DEFAULT_COMPOSITE_MODE;
+ if (editorMenuActive) {
+ // @ts-ignore
+ if (editorMode === EDITOR_MODES.DRAW_POLYGON) mode = DrawPolygonMode;
+ // @ts-ignore
+ else if (editorMode === EDITOR_MODES.DRAW_RECTANGLE) mode = DrawRectangleMode;
+ }
+
+ // @ts-ignore
+ return new EditableGeoJsonLayer({
+ id: EDITOR_LAYER_ID,
+ mode,
+ // @ts-ignore
+ data: featureCollection,
+ selectedFeatureIndexes,
+ visible: editor.visible,
+ pickable: true,
+ pickingRadius: EDITOR_LAYER_PICKING_RADIUS,
+ modeConfig: {
+ viewport
+ },
+
+ // Only show fill when polygons are selected,
+ // there is no way atm to enable fill for only one feature
+ filled: selectedFeatureIndexes.length > 0,
+
+ onEdit: ({updatedData, editType}) => {
+ switch (editType) {
+ case EDIT_TYPES.ADD_FEATURE:
+ const {features: _features} = updatedData;
+ if (_features.length) {
+ const lastFeature = _features[_features.length - 1];
+ lastFeature.properties.isClosed = true;
+ lastFeature.id = generateHashId(6);
+ onSetFeatures(updatedData.features);
+ setSelectedFeature(lastFeature);
+ }
+ break;
+ case EDIT_TYPES.ADD_POSITION:
+ case EDIT_TYPES.MOVE_POSITION:
+ case EDIT_TYPES.TRANSLATING:
+ onSetFeatures(updatedData.features);
+ break;
+ default:
+ break;
+ }
+ },
+
+ // prevent self-highlights with tentative features
+ autoHighlight: !isDrawingActive(editorMenuActive, editorMode),
+ // @ts-ignore
+ highlightColor: info => {
+ // Note: lines are reported as parent polygon
+ const {object} = info;
+ if (object) {
+ if (object.id === editor.selectedFeature?.id) {
+ return FEATURE_STYLE.highlightMultiplierNone;
+ }
+
+ const type = object.properties.editHandleType;
+ if (type === 'intermediate') return EDIT_HANDLE_STYLE.highlightMultiplierNone;
+ else if (type === 'existing') return EDIT_HANDLE_STYLE.highlightMultiplier;
+ }
+
+ // Note: highlight color affects even transparent filled polygons
+ return selectedFeatureIndexes.length
+ ? FEATURE_STYLE.highlightMultiplier
+ : LINE_STYLE.highlightMultiplier;
+ },
+
+ extensions: [new PathStyleExtension({dash: true})],
+ dashGapPickable: true,
+ getDashArray: (feature, _isSelected) => {
+ if (feature?.properties?.guideType === 'tentative') {
+ return LINE_STYLE.dashArray;
+ }
+
+ if (feature?.id === editor.selectedFeature?.id) return LINE_STYLE.solidArray;
+
+ return LINE_STYLE.dashArray;
+ },
+
+ getLineColor: LINE_STYLE.getColor,
+ getFillColor: FEATURE_STYLE.getColor,
+
+ getRadius: EDIT_HANDLE_STYLE.getRadius,
+ // @ts-ignore
+ getLineWidth: LINE_STYLE.getWidth,
+
+ getEditHandlePointRadius: EDIT_HANDLE_STYLE.getRadius,
+ getEditHandlePointColor: EDIT_HANDLE_STYLE.getFillColor,
+ getEditHandlePointOutlineColor: EDIT_HANDLE_STYLE.getOutlineColor,
+
+ getTentativeLineColor: LINE_STYLE.getTentativeLineColor,
+ // @ts-ignore
+ getTentativeLineWidth: LINE_STYLE.getTentativeLineWidth,
+ getTentativeFillColor: LINE_STYLE.getTentativeFillColor,
+
+ parameters: {}
+ });
+}
diff --git a/src/layers/src/editor-layer/feature-styles.ts b/src/layers/src/editor-layer/feature-styles.ts
new file mode 100644
index 000000000..ecd26ac8f
--- /dev/null
+++ b/src/layers/src/editor-layer/feature-styles.ts
@@ -0,0 +1,71 @@
+// Copyright (c) 2021 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import {RGBAColor} from '@deck.gl/core';
+import {Feature} from '@kepler.gl/types';
+
+import {COLORS} from './constants';
+
+const POINT_RADIUS = 5;
+const STROKE_WIDTH_SELECTED = 2.5;
+const STROKE_WIDTH_NOT_SELECTED = 2;
+
+const STROKE_SOLID_ARRAY = [0, 0];
+const STROKE_DASH_ARRAY = [4, 3];
+
+const ALPHA_0 = 0x00;
+const ALPHA_005 = 0x0d;
+const ALPHA_01 = 0x1a;
+const ALPHA_05 = 0x80;
+const ALPHA_1 = 0xff;
+
+const PRIMARY_COLOR_TRANSPARENT: RGBAColor = [...COLORS.PRIMARY, ALPHA_01];
+const PRIMARY_COLOR: RGBAColor = [...COLORS.PRIMARY, ALPHA_1];
+const SECONDARY_COLOR_TRANSPARENT: RGBAColor = [...COLORS.SECONDARY, ALPHA_0];
+const TENTATIVE_FEATURE_COLOR: RGBAColor = [...COLORS.SECONDARY, ALPHA_1];
+const TENTATIVE_FEATURE_COLOR_TRANSPARENT: RGBAColor = [...COLORS.SECONDARY, ALPHA_005];
+
+export const EDIT_HANDLE_STYLE = {
+ getRadius: POINT_RADIUS,
+ getFillColor: SECONDARY_COLOR_TRANSPARENT,
+ getOutlineColor: (handle) =>
+ handle?.properties?.featureIndex < 0 ? TENTATIVE_FEATURE_COLOR : PRIMARY_COLOR,
+ highlightMultiplier: [...COLORS.HIGHLIGHT, ALPHA_05],
+ highlightMultiplierNone: SECONDARY_COLOR_TRANSPARENT
+};
+
+export const FEATURE_STYLE = {
+ getColor: (feature: Feature, isSelected: boolean) =>
+ isSelected ? PRIMARY_COLOR_TRANSPARENT : SECONDARY_COLOR_TRANSPARENT,
+ highlightMultiplier: [...COLORS.HIGHLIGHT, ALPHA_01],
+ highlightMultiplierNone: SECONDARY_COLOR_TRANSPARENT
+};
+
+export const LINE_STYLE = {
+ getColor: (feature: Feature, isSelected, mode: string): RGBAColor => (isSelected ? PRIMARY_COLOR : PRIMARY_COLOR),
+ getWidth: (feature: Feature, isSelected, mode: string): number =>
+ isSelected ? STROKE_WIDTH_SELECTED : STROKE_WIDTH_NOT_SELECTED,
+ getTentativeLineColor: (feature: Feature, isSelected: boolean): RGBAColor => TENTATIVE_FEATURE_COLOR,
+ getTentativeLineWidth: (feature: Feature, isSelected: boolean): number => STROKE_WIDTH_NOT_SELECTED,
+ getTentativeFillColor: TENTATIVE_FEATURE_COLOR_TRANSPARENT,
+ dashArray: STROKE_DASH_ARRAY,
+ solidArray: STROKE_SOLID_ARRAY,
+ highlightMultiplier: [...COLORS.HIGHLIGHT, ALPHA_1]
+};
diff --git a/src/layers/src/editor-layer/modify-mode-extended.ts b/src/layers/src/editor-layer/modify-mode-extended.ts
new file mode 100644
index 000000000..6b6995cdb
--- /dev/null
+++ b/src/layers/src/editor-layer/modify-mode-extended.ts
@@ -0,0 +1,43 @@
+import {
+ ModifyMode,
+ FeatureOf,
+ LineString,
+ Point,
+ Viewport as NebulaViewport
+} from '@nebula.gl/edit-modes';
+import {Viewport} from '@deck.gl/core';
+
+import {EDITOR_LAYER_PICKING_RADIUS} from '@kepler.gl/constants';
+
+const RIGHT_BUTTON = 2;
+
+/**
+ * Show helper only when the point is close enough to the line.
+ */
+export class ModifyModeExtended extends ModifyMode {
+ // @ts-expect-error expect to return no point when object is too far
+ getNearestPoint(
+ line: FeatureOf<LineString>,
+ inPoint: FeatureOf<Point>,
+ viewport: Viewport | null | undefined
+ ) {
+ const p = super.getNearestPoint(line, inPoint, viewport as NebulaViewport | null | undefined);
+ if (p && viewport) {
+ const p1 = viewport.project(p.geometry.coordinates);
+ const p2 = viewport.project(inPoint.geometry.coordinates);
+ const d = Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2);
+ if (d > EDITOR_LAYER_PICKING_RADIUS) {
+ return;
+ }
+ }
+ return p;
+ }
+
+ handleClick(event, props) {
+ // prevent insertion of points for right click
+ if (event?.sourceEvent?.button === RIGHT_BUTTON) {
+ return;
+ }
+ super.handleClick(event, props);
+ }
+}
diff --git a/src/layers/src/index.ts b/src/layers/src/index.ts
index e46bd7c99..ad3eaf464 100644
--- a/src/layers/src/index.ts
+++ b/src/layers/src/index.ts
@@ -101,3 +101,10 @@ export type OVERLAY_TYPE = {[key: string]: string};
export * from './mapbox-utils';
export * from './h3-hexagon-layer';
export {default as Table} from './table';
+
+export {getEditorLayer} from './editor-layer/editor-layer';
+
+import {isDrawingActive, onClick, onHover, getTooltip, getCursor} from './editor-layer/editor-layer-utils';
+export const EditorLayerUtils = {
+ isDrawingActive, onClick, onHover, getTooltip, getCursor
+};
\ No newline at end of file
diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.ts
index 7a3446186..7d79cf7b3 100644
--- a/src/localization/src/translations/en.ts
+++ b/src/localization/src/translations/en.ts
@@ -43,7 +43,8 @@ export default {
selectType: 'Select A Type',
selectValue: 'Select A Value',
enterValue: 'Enter a value',
- empty: 'empty'
+ empty: 'empty',
+ selectLayer: 'Select a layer'
},
misc: {
by: '',
@@ -233,7 +234,8 @@ export default {
},
editor: {
filterLayer: 'Filter Layers',
- copyGeometry: 'Copy Geometry'
+ copyGeometry: 'Copy Geometry',
+ noLayersToFilter: 'No layers to filter'
},
modal: {
diff --git a/src/processors/package.json b/src/processors/package.json
index 078b7efbe..8768780e6 100644
--- a/src/processors/package.json
+++ b/src/processors/package.json
@@ -40,7 +40,7 @@
"@loaders.gl/json": "^3.0.9",
"@loaders.gl/loader-utils": "^3.0.9",
"@mapbox/geojson-normalize": "0.0.1",
- "@nebula.gl/edit-modes": "0.14.0",
+ "@nebula.gl/edit-modes": "1.0.2-alpha.0",
"@turf/helpers": "^6.1.4",
"d3-dsv": "^2.0.0"
},
diff --git a/src/processors/src/data-processor.ts b/src/processors/src/data-processor.ts
index 5fcd716ba..1afcb190d 100644
--- a/src/processors/src/data-processor.ts
+++ b/src/processors/src/data-processor.ts
@@ -324,7 +324,9 @@ export function processGeojson(rawData: unknown): ProcessorResult {
fields.forEach(f => {
if (!(f in d)) {
d[f] = null;
- d._geojson.properties[f] = null;
+ if (d._geojson.properties) {
+ d._geojson.properties[f] = null;
+ }
}
});
});
diff --git a/src/reducers/src/layer-utils.ts b/src/reducers/src/layer-utils.ts
index 74ae58dcc..636a348a6 100644
--- a/src/reducers/src/layer-utils.ts
+++ b/src/reducers/src/layer-utils.ts
@@ -24,13 +24,18 @@ import {
TooltipField,
CompareType,
SplitMapLayers,
- InteractionConfig
+ InteractionConfig,
+ Editor,
+ Feature,
+ FeatureSelectionContext,
+ Viewport
} from '@kepler.gl/types';
import {
FindDefaultLayerPropsReturnValue,
Layer,
LayerClassesType,
- OVERLAY_TYPE_CONST
+ OVERLAY_TYPE_CONST,
+ getEditorLayer
} from '@kepler.gl/layers';
import KeplerTable, {Datasets} from '@kepler.gl/table';
@@ -261,8 +266,21 @@ export type ComputeDeckLayersProps = {
mapboxApiUrl?: string;
primaryMap?: boolean;
layersForDeck?: {[key: string]: boolean};
+ editorInfo?: {
+ editor: Editor;
+ editorMenuActive: boolean;
+ onSetFeatures: (features: Feature[]) => any;
+ setSelectedFeature: (feature: Feature | null, selectionContext?: FeatureSelectionContext) => any;
+ featureCollection: {
+ type: string;
+ features: Feature[];
+ };
+ selectedFeatureIndexes: number[];
+ viewport: Viewport;
+ };
};
+// eslint-disable-next-line complexity
export function computeDeckLayers(
{visState, mapState, mapStyle}: any,
options?: ComputeDeckLayersProps,
@@ -281,7 +299,8 @@ export function computeDeckLayers(
splitMaps
} = visState;
- const {mapIndex, mapboxApiAccessToken, mapboxApiUrl, primaryMap, layersForDeck} = options || {};
+ const {mapIndex, mapboxApiAccessToken, mapboxApiUrl, primaryMap, layersForDeck, editorInfo} =
+ options || {};
let dataLayers: any[] = [];
@@ -344,5 +363,14 @@ export function computeDeckLayers(
const [customBottomDeckLayers, customTopDeckLayers] = getCustomDeckLayers(deckGlProps);
- return [...customBottomDeckLayers, ...dataLayers, ...customTopDeckLayers];
+ const editorLayer: any[] = [];
+ if (editorInfo) {
+ editorLayer.push(
+ getEditorLayer({
+ ...editorInfo
+ })
+ );
+ }
+
+ return [...customBottomDeckLayers, ...dataLayers, ...customTopDeckLayers, ...editorLayer];
}
diff --git a/src/reducers/src/vis-state-updaters.ts b/src/reducers/src/vis-state-updaters.ts
index 95f2e22be..aa71770b4 100644
--- a/src/reducers/src/vis-state-updaters.ts
+++ b/src/reducers/src/vis-state-updaters.ts
@@ -1016,17 +1016,22 @@ export const toggleFilterFeatureUpdater = (
): VisState => {
const filter = state.filters[action.idx];
const isVisible = get(filter, ['value', 'properties', 'isVisible']);
- const newFilter = {
- ...filter,
+
+ let newState = setFilterUpdater(state, {
+ idx: action.idx,
+ prop: 'enabled',
+ value: !isVisible
+ });
+
+ newState = setFilterUpdater(newState, {
+ idx: action.idx,
+ prop: 'value',
value: featureToFilterValue(filter.value, filter.id, {
isVisible: !isVisible
})
- };
+ });
- return {
- ...state,
- filters: Object.assign([...state.filters], {[action.idx]: newFilter})
- };
+ return newState;
};
/**
@@ -2140,14 +2145,17 @@ export function setFeaturesUpdater(
*/
export const setSelectedFeatureUpdater = (
state: VisState,
- {feature}: VisStateActions.SetSelectedFeatureUpdaterAction
-): VisState => ({
- ...state,
- editor: {
- ...state.editor,
- selectedFeature: feature
- }
-});
+ {feature, selectionContext}: VisStateActions.SetSelectedFeatureUpdaterAction
+): VisState => {
+ return {
+ ...state,
+ editor: {
+ ...state.editor,
+ selectedFeature: feature,
+ selectionContext
+ }
+ };
+};
/**
* Delete existing feature from filters
diff --git a/src/schemas/src/vis-state-schema.ts b/src/schemas/src/vis-state-schema.ts
index 14da91839..c938d3069 100644
--- a/src/schemas/src/vis-state-schema.ts
+++ b/src/schemas/src/vis-state-schema.ts
@@ -760,7 +760,9 @@ export const filterPropsV1 = {
// polygon filter properties
layerId: null,
- speed: null
+ speed: null,
+
+ enabled: null
};
export const propertiesV0 = {
diff --git a/src/types/reducers.d.ts b/src/types/reducers.d.ts
index 4c8e064d3..9522777aa 100644
--- a/src/types/reducers.d.ts
+++ b/src/types/reducers.d.ts
@@ -66,6 +66,7 @@ type FilterViewType = 'side' | 'enlarged' | 'minified';
export type FilterBase<L extends LineChart> = {
dataId: string[];
id: string;
+ enabled: boolean;
freeze: boolean;
@@ -155,6 +156,11 @@ export type Feature = {
coordinates: any;
};
};
+export type FeatureSelectionContext = {
+ rightClick: boolean;
+ position: {x: number; y: number};
+ mapIndex?: number;
+};
export type FeatureValue = {
id: string;
properties: {
@@ -169,6 +175,7 @@ export type Editor = {
mode: string;
features: Feature[];
selectedFeature: any;
+ selectionContext?: FeatureSelectionContext;
visible: boolean;
};
diff --git a/src/utils/src/filter-utils.ts b/src/utils/src/filter-utils.ts
index 6d21af609..bce86795c 100644
--- a/src/utils/src/filter-utils.ts
+++ b/src/utils/src/filter-utils.ts
@@ -135,6 +135,7 @@ export const DEFAULT_FILTER_STRUCTURE = {
dataId: [], // [string]
freeze: false,
id: null,
+ enabled: true,
// time range filter specific
fixedDomain: false,
@@ -477,6 +478,10 @@ export function getFilterFunction<L extends {config: {dataId: string | null}; id
const valueAccessor = field ? field.valueAccessor : data => null;
const defaultFunc = d => true;
+ if (filter.enabled === false) {
+ return defaultFunc;
+ }
+
switch (filter.type) {
case FILTER_TYPES.range:
return data => isInRange(valueAccessor(data), filter.value);
diff --git a/src/utils/src/index.ts b/src/utils/src/index.ts
index 126d5e00d..ea8f5a9b6 100644
--- a/src/utils/src/index.ts
+++ b/src/utils/src/index.ts
@@ -103,7 +103,7 @@ export {
unobserveDimensions,
default as useDimensions
} from './observe-dimensions';
-export {validateBounds, getCenterAndZoomFromBounds} from './projection-utils';
+export {validateBounds, getCenterAndZoomFromBounds, normalizeEvent} from './projection-utils';
export {validateToken} from './mapbox-utils';
export {
getDefaultLayerGroupVisibility,
@@ -146,7 +146,7 @@ export {
export {transformRequest, isStyleUsingMapboxTiles} from './map-style-utils/mapbox-utils';
// Map
-export {onViewPortChange, getMapLayersFromSplitMaps} from './map-utils';
+export {onViewPortChange, getMapLayersFromSplitMaps, getViewportFromMapState} from './map-utils';
export {createDataContainer, createIndexedDataContainer, getSampleData as getSampleContainerData} from './data-container-utils';
export type {DataContainerInterface} from './data-container-interface';
diff --git a/src/utils/src/map-utils.ts b/src/utils/src/map-utils.ts
index 931a65723..11ddea6fc 100644
--- a/src/utils/src/map-utils.ts
+++ b/src/utils/src/map-utils.ts
@@ -1,5 +1,7 @@
+import WebMercatorViewport from 'viewport-mercator-project';
+
import {TRANSITION_DURATION} from '@kepler.gl/constants';
-import {SplitMapLayers, SplitMap} from '@kepler.gl/types';
+import {SplitMapLayers, SplitMap, Viewport, MapState} from '@kepler.gl/types';
export const onViewPortChange = (
viewState: any,
@@ -28,3 +30,12 @@ export const getMapLayersFromSplitMaps = (
): SplitMapLayers | undefined | null => {
return splitMaps[mapIndex || '']?.layers;
};
+
+/**
+ * Generates a viewport from a map state.
+ * @param {*} mapState
+ * @returns A viewport.
+ */
+export const getViewportFromMapState = (mapState: MapState): Viewport => {
+ return new WebMercatorViewport(mapState);
+};
diff --git a/src/utils/src/projection-utils.ts b/src/utils/src/projection-utils.ts
index 027261f27..1426eddc4 100644
--- a/src/utils/src/projection-utils.ts
+++ b/src/utils/src/projection-utils.ts
@@ -19,6 +19,8 @@
// THE SOFTWARE.
import geoViewport from '@mapbox/geo-viewport';
+
+import WebMercatorViewport from 'viewport-mercator-project';
import Console from 'global/console';
const MAPBOX_TILE_SIZE = 512;
@@ -70,3 +72,28 @@ export function getCenterAndZoomFromBounds(bounds, {width, height}) {
return {zoom, center};
}
+
+/**
+ * Add extra info about screen space position and world position to the event.
+ * @param {*} event Event to normalize.
+ * @param {*} viewport Current viewport.
+ * @returns Normalized event with extra information.
+ */
+export function normalizeEvent(event: any, viewport: WebMercatorViewport) {
+ var bounds = event.target?.getBoundingClientRect();
+ if (!bounds) {
+ return event;
+ }
+
+ var x = event.clientX - bounds.left;
+ var y = event.clientY - bounds.top;
+ if (!Number.isFinite(x) || !Number.isFinite(y)) {
+ return event;
+ }
+
+ event.point = [x, y];
+ const location = viewport.unproject(event.point, {targetZ: 0});
+ event.lngLat = [location[0], location[1]];
+
+ return event;
+}
diff --git a/test/browser-headless/component/map-container-test.js b/test/browser-headless/component/map-container-test.js
index 66698e9dd..a6537bc5e 100644
--- a/test/browser-headless/component/map-container-test.js
+++ b/test/browser-headless/component/map-container-test.js
@@ -31,7 +31,7 @@ import {
MapPopoverFactory,
mapFieldsSelector
} from '@kepler.gl/components';
-import MapboxGLMap from 'react-map-gl';
+import {StaticMap} from 'react-map-gl';
import Tippy from '@tippyjs/react/headless';
import {gl, InteractionTestRunner} from '@deck.gl/test-utils';
@@ -71,11 +71,11 @@ test('MapContainerFactory - display all options', t => {
t.equal(wrapper.find(MapControl).length, 1, 'Should display 1 MapControl');
- t.equal(wrapper.find(MapboxGLMap).length, 1, 'Should display 1 InteractiveMap');
+ t.equal(wrapper.find(StaticMap).length, 1, 'Should display 1 InteractiveMap');
// Can't test overlay because mapboxgl is not supported in chromium
t.equal(wrapper.find('Attribution').length, 1, 'Should display 1 Attribution');
- const instance = wrapper.find(MapContainer).instance();
+ const instance = wrapper.find('MapContainer').instance();
instance._onMapboxStyleUpdate();
@@ -101,7 +101,7 @@ test('MapContainerFactory - _renderDeckOverlay', t => {
);
}, 'MapContainer should not fail');
- const instance = wrapper.find(MapContainer).instance();
+ const instance = wrapper.find('MapContainer').instance();
const _renderDeckOverlay = sinon.spy(instance, '_renderDeckOverlay');
instance.forceUpdate();
wrapper.update();
@@ -112,7 +112,8 @@ test('MapContainerFactory - _renderDeckOverlay', t => {
_renderDeckOverlay.restore();
// Getting the DeckGl instance
- const DeckGl = instance._renderDeckOverlay(...args);
+ const divWrapper = instance._renderDeckOverlay(...args);
+ const DeckGl = divWrapper.props.children;
const clickEvents = [];
const hoverEvents = [];
@@ -279,7 +280,7 @@ test('MapContainerFactory - _renderDeckOverlay', t => {
.then(() => t.end());
});
-test('MapContainerFactory - _renderDrawEditor', t => {
+test('MapContainerFactory - _renderEditorContextMenu', t => {
const props = {
...initialProps,
mapboxApiAccessToken: 'pyx-11'
@@ -293,19 +294,19 @@ test('MapContainerFactory - _renderDrawEditor', t => {
);
}, 'MapContainer should not fail with intial props');
- const instance = wrapper.find(MapContainer).instance();
- const _renderDrawEditor = sinon.spy(instance, '_renderDrawEditor');
+ const instance = wrapper.find('MapContainer').instance();
+ const _renderEditorContextMenu = sinon.spy(instance, '_renderEditorContextMenu');
instance.forceUpdate();
wrapper.update();
- t.ok(_renderDrawEditor.calledOnce, '_renderDrawEditor be called once');
+ t.ok(_renderEditorContextMenu.calledOnce, '_renderEditorContextMenu be called once');
- const args = _renderDrawEditor.args[0];
- _renderDrawEditor.restore();
+ const args = _renderEditorContextMenu.args[0];
+ _renderEditorContextMenu.restore();
// React-map-gl doesnt render overlays when mapboxgl is not supported
// here we manually calling the render function to test Editor
- const editor = instance._renderDrawEditor(...args);
+ const editor = instance._renderEditorContextMenu(...args);
let editorWrapper;
t.doesNotThrow(() => {
diff --git a/test/browser/components/editor/feature-styles-test.js b/test/browser/components/editor/feature-styles-test.js
deleted file mode 100644
index a17f05cc7..000000000
--- a/test/browser/components/editor/feature-styles-test.js
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2022 Uber Technologies, Inc.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-import test from 'tape';
-import {RenderStates, RenderTypes} from 'react-map-gl-draw';
-import {getStyle} from '@kepler.gl/components';
-
-test('FeatureStyles - getStyles point', t => {
- const feature = {
- properties: {
- isVisible: true,
- renderType: RenderTypes.POINT
- }
- };
-
- t.deepEqual(
- getStyle({feature, state: RenderStates.INACTIVE}),
- {
- stroke: '#26B5F2',
- strokeWidth: 2,
- fill: '#333333',
- fillOpacity: 0.1,
- strokeDasharray: '4,2',
- r: 5
- },
- 'Should display point feature correctly'
- );
-
- t.deepEqual(
- getStyle({
- feature: {
- ...feature,
- properties: {
- ...feature.properties,
- isVisible: false
- }
- },
- state: RenderStates.INACTIVE
- }),
- {
- stroke: '#26B5F2',
- strokeWidth: 0,
- fill: '#333333',
- fillOpacity: 0.1,
- strokeDasharray: '4,2',
- r: 5
- },
- 'Should display point feature correctly with strokeWidth = 0'
- );
- t.end();
-});
-
-test('FeatureStyles - getStyles line-string', t => {
- const feature = {
- properties: {
- isVisible: true,
- renderType: RenderTypes.LINE_STRING
- }
- };
-
- t.deepEqual(
- getStyle({feature, state: RenderStates.INACTIVE}),
- {
- stroke: '#26B5F2',
- strokeWidth: 2,
- fill: 'none',
- fillOpacity: 0.1,
- strokeDasharray: '4,2'
- },
- 'Should display point feature correctly'
- );
-
- t.deepEqual(
- getStyle({
- feature: {
- ...feature,
- properties: {
- ...feature.properties,
- isVisible: false
- }
- },
- state: RenderStates.INACTIVE
- }),
- {
- stroke: '#26B5F2',
- strokeWidth: 0,
- fill: 'none',
- fillOpacity: 0.1,
- strokeDasharray: '4,2'
- },
- 'Should display point feature correctly with strokeWidth = 0'
- );
- t.end();
-});
diff --git a/test/browser/components/editor/index.js b/test/browser/components/editor/index.js
index 9a1ec5bed..178e8e794 100644
--- a/test/browser/components/editor/index.js
+++ b/test/browser/components/editor/index.js
@@ -19,4 +19,3 @@
// THE SOFTWARE.
import './feature-action-panel-test';
-import './feature-styles-test';
diff --git a/test/browser/components/map/map-control-test.js b/test/browser/components/map/map-control-test.js
index 9bb88d63e..ecacd62ae 100644
--- a/test/browser/components/map/map-control-test.js
+++ b/test/browser/components/map/map-control-test.js
@@ -270,8 +270,8 @@ test('MapControlFactory - show panels', t => {
.find(MapControlToolbar)
.at(0)
.find(ToolbarItem).length,
- 4,
- 'should render 4 ToolbarItem'
+ 3,
+ 'should render 3 ToolbarItem'
);
// show locale
diff --git a/test/browser/components/plot-container-test.js b/test/browser/components/plot-container-test.js
index 0c5c86584..df2e29e7c 100644
--- a/test/browser/components/plot-container-test.js
+++ b/test/browser/components/plot-container-test.js
@@ -25,13 +25,11 @@ import test from 'tape';
import {
appInjector,
PlotContainerFactory,
- MapContainerFactory,
plotContainerSelector
} from '@kepler.gl/components';
import {mockKeplerProps} from '../../helpers/mock-state';
const PlotContainer = appInjector.get(PlotContainerFactory);
-const MapContainer = appInjector.get(MapContainerFactory);
const initialProps = plotContainerSelector(mockKeplerProps);
test('PlotContainer -> mount', t => {
@@ -65,7 +63,7 @@ test('PlotContainer -> mount -> imageSize', t => {
);
}, 'PlotContainer should not fail without props');
- let map = wrapper.find(MapContainer).instance();
+ let map = wrapper.find('MapContainer').instance();
t.equal(map.props.mapState.width, 800, 'should send imageW to mapState');
t.equal(map.props.mapState.height, 600, 'should send imageH to mapState');
@@ -81,7 +79,7 @@ test('PlotContainer -> mount -> imageSize', t => {
);
}, 'PlotContainer should not fail without props');
- map = wrapper.find(MapContainer).instance();
+ map = wrapper.find('MapContainer').instance();
t.equal(map.props.mapState.latitude, 33.89064297228446, 'should set latitude when center: true');
t.equal(
diff --git a/test/fixtures/geojson.js b/test/fixtures/geojson.js
index 9705ba8c0..8b1b00a71 100644
--- a/test/fixtures/geojson.js
+++ b/test/fixtures/geojson.js
@@ -427,6 +427,7 @@ export const mergedTripFilter = {
dataId: [geoJsonDataId],
freeze: true,
id: 'TRIPS-3',
+ enabled: true,
fixedDomain: false,
view: 'side',
isAnimating: false,
@@ -455,6 +456,7 @@ export const mergedRateFilter = {
dataId: [geoJsonDataId],
freeze: true,
id: 'RATE-1',
+ enabled: true,
fixedDomain: false,
view: 'side',
isAnimating: false,
diff --git a/test/fixtures/state-saved-v0.js b/test/fixtures/state-saved-v0.js
index b23230040..9abe12cac 100644
--- a/test/fixtures/state-saved-v0.js
+++ b/test/fixtures/state-saved-v0.js
@@ -886,6 +886,7 @@ export const mergedFilters = [
dataId: ['9h10t7fyb'],
freeze: true,
id: 'vxzfwyg2v',
+ enabled: true,
view: 'side',
isAnimating: false,
animationWindow: 'free',
@@ -906,6 +907,7 @@ export const mergedFilters = [
dataId: ['9h10t7fyb'],
freeze: true,
id: 'fo9tjm2unl',
+ enabled: true,
view: 'enlarged',
isAnimating: false,
animationWindow: 'free',
@@ -941,6 +943,7 @@ export const mergedFilters = [
{
dataId: ['9h10t7fyb'],
id: 'aesy96t5',
+ enabled: true,
name: ['type_boolean'],
type: 'select',
freeze: true,
@@ -961,6 +964,7 @@ export const mergedFilters = [
{
dataId: ['9h10t7fyb'],
id: 's1bhgjt1',
+ enabled: true,
name: ['int_range'],
type: 'range',
value: [78, 309],
@@ -987,6 +991,7 @@ export const mergedFilters = [
dataId: ['v79816te8'],
freeze: true,
id: '5nfmxjjzl',
+ enabled: true,
view: 'side',
isAnimating: false,
animationWindow: 'free',
diff --git a/test/fixtures/state-saved-v1-1.js b/test/fixtures/state-saved-v1-1.js
index 7a9e11c40..29dc811fd 100644
--- a/test/fixtures/state-saved-v1-1.js
+++ b/test/fixtures/state-saved-v1-1.js
@@ -839,6 +839,7 @@ export const mergedFilters = [
dataId: ['a5ybmwl2d'],
freeze: true,
id: '9ca0l7p2a',
+ enabled: true,
view: 'side',
isAnimating: false,
animationWindow: 'free',
diff --git a/test/fixtures/test-csv-data.js b/test/fixtures/test-csv-data.js
index 58b0b09d3..30efc6418 100644
--- a/test/fixtures/test-csv-data.js
+++ b/test/fixtures/test-csv-data.js
@@ -860,6 +860,7 @@ export const mergedTimeFilter = {
dataId: [dataId],
freeze: true,
id: 'time-0',
+ enabled: true,
fixedDomain: true,
view: 'enlarged',
isAnimating: false,
@@ -896,6 +897,7 @@ export const mergedEpochFilter = {
dataId: [dataId],
freeze: true,
id: 'epoch-1',
+ enabled: true,
fixedDomain: true,
view: 'side',
isAnimating: false,
@@ -925,6 +927,7 @@ export const mergedDateFilter = {
dataId: [dataId],
freeze: true,
id: 'date-2',
+ enabled: true,
fixedDomain: false,
view: 'side',
isAnimating: false,
diff --git a/test/fixtures/test-hex-id-data.js b/test/fixtures/test-hex-id-data.js
index 8a5f40f71..ae87fea42 100644
--- a/test/fixtures/test-hex-id-data.js
+++ b/test/fixtures/test-hex-id-data.js
@@ -158,6 +158,7 @@ export const mergedFilters = [
{
dataId: [dataId],
id: 'value',
+ enabled: true,
name: ['value'],
type: 'range',
value: [11.2, 28],
diff --git a/test/node/reducers/vis-state-test.js b/test/node/reducers/vis-state-test.js
index 92f0ff519..ea0132f10 100644
--- a/test/node/reducers/vis-state-test.js
+++ b/test/node/reducers/vis-state-test.js
@@ -1944,6 +1944,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
dataId: ['smoothie'],
freeze: false,
id: 'donnot test me yet',
+ enabled: true,
name: [],
type: null,
fixedDomain: false,
@@ -1973,6 +1974,7 @@ test('#visStateReducer -> setFilter.dynamicDomain & cpu', t => {
dataId: ['smoothie'],
freeze: true,
id: filterId,
+ enabled: true,
name: ['date'],
type: 'multiSelect',
fieldIdx: [10],
@@ -2146,6 +2148,7 @@ test('#visStateReducer -> SET_FILTER.name', t => {
dataId: [testGeoJsonDataId],
freeze: true,
id: 'RATE-1',
+ enabled: true,
fixedDomain: false,
view: FILTER_VIEW_TYPES.side,
isAnimating: false,
@@ -2228,6 +2231,7 @@ function testSetFilterDynamicDomainGPU(t, setFilter) {
const expectedFilterWName = {
dataId: ['milkshake'],
freeze: true,
+ enabled: true,
id: stateWithFilter.filters[0].id,
name: ['TRIPS'],
type: 'range',
@@ -3909,6 +3913,7 @@ test('#visStateReducer -> POLYGON: Add/Remove new polygon feature', t => {
{
features: [],
selectedFeature: null,
+ selectionContext: undefined,
visible: true,
mode: 'EDIT_VERTEX'
},
@@ -3992,6 +3997,7 @@ test('#visStateReducer -> POLYGON: Create polygon filter', t => {
id: newFilter.id,
dataId: [firstDataset],
freeze: false,
+ enabled: true,
fixedDomain: true,
view: FILTER_VIEW_TYPES.side,
isAnimating: false,
@@ -4200,6 +4206,7 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
id: newFilter.id,
dataId: ['puppy'],
freeze: false,
+ enabled: true,
fixedDomain: true,
view: FILTER_VIEW_TYPES.side,
isAnimating: false,
@@ -4233,12 +4240,22 @@ test('#visStateReducer -> POLYGON: Toggle filter feature', t => {
true,
'Should have feature visibility set to true'
);
+ t.deepEqual(
+ newReducer.datasets.puppy.filteredIndex,
+ [0, 2],
+ 'The polygon filter should be applied'
+ );
newReducer = reducer(newReducer, VisStateActions.toggleFilterFeature(0));
filterFeature = newReducer.filters[0].value;
-
t.deepEqual(filterFeature.properties.isVisible, false, 'Should hide filter feature');
+ t.deepEqual(newReducer.filters[0].enabled, false, 'Should disable the filter');
+ t.deepEqual(
+ newReducer.datasets.puppy.filteredIndex,
+ [0, 1, 2, 3],
+ "The polygon filter shouldn't be applied"
+ );
t.end();
});
diff --git a/test/node/schemas/vis-state-schema-test.js b/test/node/schemas/vis-state-schema-test.js
index e194dbc82..eaa4d8e98 100644
--- a/test/node/schemas/vis-state-schema-test.js
+++ b/test/node/schemas/vis-state-schema-test.js
@@ -97,6 +97,7 @@ test('#visStateSchema -> v1 -> save load filters', t => {
{
dataId: [testCsvDataId],
id: 'hjpn8frza',
+ enabled: true,
name: ['time'],
type: 'timeRange',
value: [1474606800000, 1474617600000],
@@ -109,6 +110,7 @@ test('#visStateSchema -> v1 -> save load filters', t => {
{
dataId: [testGeoJsonDataId],
id: 'vpk2466o',
+ enabled: true,
name: ['RATE'],
type: 'multiSelect',
value: ['a'],
diff --git a/test/node/utils/editor-utils-test.js b/test/node/utils/editor-utils-test.js
new file mode 100644
index 000000000..e323b6ac6
--- /dev/null
+++ b/test/node/utils/editor-utils-test.js
@@ -0,0 +1,256 @@
+// Copyright (c) 2022 Uber Technologies, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import test from 'tape';
+import {EditableGeoJsonLayer} from '@nebula.gl/layers';
+
+import {INITIAL_VIS_STATE} from '@kepler.gl/reducers';
+import {VisStateActions} from '@kepler.gl/actions';
+import {EDITOR_LAYER_ID, EDITOR_MODES} from '@kepler.gl/constants';
+import {
+ EditorLayerUtils,
+ getEditorLayer
+} from '@kepler.gl/layers';
+
+test('editorLayerUtils -> isDrawingActive', t => {
+ t.equal(
+ EditorLayerUtils.isDrawingActive(true, EDITOR_MODES.EDIT),
+ false,
+ 'Should return false for non-drawing mode'
+ );
+ t.equal(
+ EditorLayerUtils.isDrawingActive(false, EDITOR_MODES.DRAW_POLYGON),
+ false,
+ 'Should return false as editor UI is disactivated'
+ );
+ t.equal(
+ EditorLayerUtils.isDrawingActive(true, EDITOR_MODES.DRAW_POLYGON),
+ true,
+ 'Should return true for activated editor UI and draw mode'
+ );
+ t.end();
+});
+
+test('editorLayerUtils -> getCursor', t => {
+ const {editor} = INITIAL_VIS_STATE;
+ const mockSettings = {
+ editorMenuActive: true,
+ editor
+ };
+ t.equal(EditorLayerUtils.getCursor(mockSettings), 'crosshair', 'Should return crosshair for active drawing mode');
+
+ mockSettings.editorMenuActive = false;
+ t.equal(
+ EditorLayerUtils.getCursor(mockSettings),
+ null,
+ 'Should return null as editor has no suggestions about cursor'
+ );
+
+ mockSettings.hoverInfo = {
+ layer: {
+ id: EDITOR_LAYER_ID
+ }
+ };
+ mockSettings.editor = {...mockSettings.editor, selectedFeature: {}};
+ t.equal(EditorLayerUtils.getCursor(mockSettings), 'move', 'Should return move cursor');
+
+ t.end();
+});
+
+test('editorLayerUtils -> getTooltip', t => {
+ const {editor} = INITIAL_VIS_STATE;
+ const info = {
+ layer: {state: {mode: {_clickSequence: null}}},
+ object: {}
+ };
+
+ t.equal(
+ EditorLayerUtils.getTooltip(info, {
+ editor: {...editor, selectionContext: {rightClick: true}},
+ theme: {},
+ editorMenuActive: true
+ }),
+ null,
+ 'Should return null when the feature menu is visible'
+ );
+
+ info.layer.state.mode._clickSequence = [1];
+ t.equal(
+ EditorLayerUtils.getTooltip(info, {editor, theme: {}, editorMenuActive: true}),
+ null,
+ 'Should return null as drawing is active and started'
+ );
+
+ info.layer.state.mode._clickSequence = [];
+ t.equal(
+ EditorLayerUtils.getTooltip(info, {editor, theme: {}, editorMenuActive: true})?.text,
+ 'Click to start new feature',
+ 'Should return a tooltip as drawing is active and started'
+ );
+
+ info.layer.id = EDITOR_LAYER_ID;
+
+ t.deepEqual(
+ EditorLayerUtils.getTooltip(
+ {...info, object: {id: 1}},
+ {editor: {...editor, selectedFeature: {id: 1}}, theme: {}, editorMenuActive: false}
+ )?.text,
+ 'Right click to view options\nDrag to move the feature',
+ 'Should return a tooltip for selected feature'
+ );
+
+ t.equal(
+ EditorLayerUtils.getTooltip(
+ {...info, object: {geometry: {type: 'Point'}}},
+ {editor, theme: {}, editorMenuActive: false}
+ )?.text,
+ 'Drag to move the point',
+ 'Should return a tooltip for hovered point'
+ );
+
+ t.equal(
+ EditorLayerUtils.getTooltip(
+ {...info, object: {properties: {guideType: 'tentative'}}},
+ {editor, theme: {}, editorMenuActive: false}
+ )?.text,
+ 'Drag to move the point',
+ 'Should return a tooltip for hovered tentative point'
+ );
+
+ t.equal(
+ EditorLayerUtils.getTooltip(
+ {...info, object: {properties: {editHandleType: 'intermediate'}}},
+ {editor, theme: {}, editorMenuActive: false}
+ )?.text,
+ 'Click to insert a point',
+ 'Should return a tooltip for hovered lines'
+ );
+
+ t.equal(
+ EditorLayerUtils.getTooltip(info, {editor, theme: {}, editorMenuActive: false})?.text,
+ 'Click to select the feature\nRight click to view options',
+ 'Should return a tooltip for not selected feature'
+ );
+
+ info.layer.id = 'any';
+
+ t.equal(
+ EditorLayerUtils.getTooltip(info, {
+ editor,
+ theme: {},
+ editorMenuActive: false
+ }),
+ null,
+ 'Shouldnt return tooltip'
+ );
+
+ t.end();
+});
+
+test('editorLayerUtils -> onHover', t => {
+ const {editor} = INITIAL_VIS_STATE;
+ const info = {
+ layer: {},
+ object: {}
+ };
+ const hoverInfo = {
+ layer: {}
+ };
+
+ t.equal(
+ EditorLayerUtils.onHover(info, {editor, editorMenuActive: true, hoverInfo}),
+ true,
+ 'Should return true as drawing is active'
+ );
+
+ t.equal(
+ EditorLayerUtils.onHover(info, {editor, editorMenuActive: false, hoverInfo}),
+ false,
+ "Should return false as drawing isn't active"
+ );
+
+ info.layer.id = EDITOR_LAYER_ID;
+ t.equal(
+ EditorLayerUtils.onHover(info, {editor, editorMenuActive: false, hoverInfo}),
+ false,
+ "Should return false as info and hoverInfo aren't yet synced"
+ );
+
+ hoverInfo.layer.id = EDITOR_LAYER_ID;
+ t.equal(
+ EditorLayerUtils.onHover(info, {editor, editorMenuActive: false, hoverInfo}),
+ true,
+ 'Should return true for editor layer'
+ );
+
+ t.end();
+});
+
+test('editorLayerUtils -> onClick', t => {
+ const {editor} = INITIAL_VIS_STATE;
+ const info = {
+ layer: {},
+ object: {}
+ };
+ const event = {};
+
+ const {onLayerClick, setSelectedFeature} = VisStateActions;
+
+ t.equal(
+ EditorLayerUtils.onClick(info, event, {editor, editorMenuActive: true, onLayerClick, setSelectedFeature}),
+ true,
+ 'Should return true - onClick is handled as drawing is active'
+ );
+
+ t.equal(
+ EditorLayerUtils.onClick(info, event, {editor, editorMenuActive: false, onLayerClick, setSelectedFeature}),
+ false,
+ "Should return false - onClick isn't handled"
+ );
+
+ info.layer.id = EDITOR_LAYER_ID;
+ t.equal(
+ EditorLayerUtils.onClick(info, event, {editor, editorMenuActive: false, onLayerClick, setSelectedFeature}),
+ true,
+ 'Should return true - onClick is handled'
+ );
+
+ t.end();
+});
+
+test('editorLayerUtils -> getEditorLayer', t => {
+ const {editor} = INITIAL_VIS_STATE;
+
+ const editorLayer = getEditorLayer({
+ editorMenuActive: false,
+ editor,
+ onSetFeatures: VisStateActions.setFeatures,
+ setSelectedFeature: VisStateActions.setSelectedFeature,
+ featureCollection: {
+ features: [],
+ type: 'FeatureCollection'
+ },
+ selectedFeatureIndexes: [],
+ viewport: null
+ });
+ t.ok(editorLayer instanceof EditableGeoJsonLayer, 'Should return an editable layer');
+
+ t.end();
+});
diff --git a/test/node/utils/index.js b/test/node/utils/index.js
index 2ddd9b2d5..43f4a7ee4 100644
--- a/test/node/utils/index.js
+++ b/test/node/utils/index.js
@@ -35,4 +35,5 @@ import './color-util-test';
import './util-test';
import './export-utils-test';
import './s2-utils-test';
-import './kepler-gl-utils-test';
+import './editor-utils-test';
+import './kepler-gl-utils-test';
\ No newline at end of file
diff --git a/yarn.lock b/yarn.lock
index a57583e1f..d9ae44f69 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1312,6 +1312,15 @@
exec-sh "^0.3.2"
minimist "^1.2.0"
+"@danmarshall/[email protected]":
+ version "4.9.12"
+ resolved "https://registry.yarnpkg.com/@danmarshall/deckgl-typings/-/deckgl-typings-4.9.12.tgz#81ed316353550996cf5a139f40d8c01384264a93"
+ integrity sha512-hRXXDepfieobs+YFcjhoSXS97boSqgMAlWKREGwxBbqO/mE2seNJgQHPedsR+DeGJiK3hJsQmykt8TO51shJ4g==
+ dependencies:
+ "@types/hammerjs" "^2.0.36"
+ "@types/react" "*"
+ indefinitely-typed "^1.1.0"
+
"@danmarshall/[email protected]":
version "4.9.22"
resolved "https://registry.yarnpkg.com/@danmarshall/deckgl-typings/-/deckgl-typings-4.9.22.tgz#b7044db5bd79ebb2a4f76a41f70ec59d6772d40f"
@@ -1322,13 +1331,12 @@
indefinitely-typed "^1.1.0"
"@deck.gl/[email protected]", "@deck.gl/aggregation-layers@^8.6.0":
- version "8.8.20"
- resolved "https://registry.yarnpkg.com/@deck.gl/aggregation-layers/-/aggregation-layers-8.8.20.tgz#7241e012d4d090d26c60467308ebac5c6e98ffca"
- integrity sha512-TQ4xbvEOVxt86GXH4OqWxzW3JycrTs1CdcwGcbwnraefpUmY2MaujTfmCH/re2PnOIOpAY4/x7RaWME+kNJSPw==
+ version "8.6.0"
+ resolved "https://registry.yarnpkg.com/@deck.gl/aggregation-layers/-/aggregation-layers-8.6.0.tgz#2fad88c14224b308f83ebaf51c51a9e706167eb8"
+ integrity sha512-RTlXqmQrlV8V9ucAapkAq6CJ+qwMF30X+ngJK33zld1vSA/q3g/Db4pFRse84Mpk+Jqdrkb5GG3/BD5IcloGJA==
dependencies:
- "@luma.gl/constants" "^8.5.16"
- "@luma.gl/shadertools" "^8.5.16"
- "@math.gl/web-mercator" "^3.6.2"
+ "@luma.gl/shadertools" "^8.5.10"
+ "@math.gl/web-mercator" "^3.5.4"
d3-hexbin "^0.2.1"
"@deck.gl/core@^8.6.0":
@@ -2193,12 +2201,12 @@
gl-matrix "^3.0.0"
"@math.gl/web-mercator@^3.5.5":
- version "3.6.2"
- resolved "https://registry.yarnpkg.com/@math.gl/web-mercator/-/web-mercator-3.6.2.tgz#1fd8fc2f1dfa794e5fe03eed328d53f69e7bf932"
- integrity sha512-jud2n6YEPp0+PHseG/gtJXskYAMQEM3bOyyPdwwEeu9OekjeWvkC9q3OGDF7Ve7KUA2kPbNzpD/r8VBhuixk8w==
+ version "3.5.6"
+ resolved "https://registry.yarnpkg.com/@math.gl/web-mercator/-/web-mercator-3.5.6.tgz#3bdc62f578bc0f360bb3c2866d015065b869cc20"
+ integrity sha512-siWHLJGp9o8fDEM1t0Rby+JXftl6il0z3927liWGzkHqFftXPHY858ShPy45ThDU8q5lyCftg8aVgrv4nfD+Zw==
dependencies:
"@babel/runtime" "^7.12.0"
- gl-matrix "^3.4.0"
+ gl-matrix "~3.3.0"
"@math.gl/web-mercator@^3.6.2":
version "3.6.3"
@@ -2213,10 +2221,74 @@
resolved "https://registry.yarnpkg.com/@mdn/browser-compat-data/-/browser-compat-data-3.3.14.tgz#b72a37c654e598f9ae6f8335faaee182bebc6b28"
integrity sha512-n2RC9d6XatVbWFdHLimzzUJxJ1KY8LdjqrW6YvGPiRmsHkhOUx74/Ct10x5Yo7bC/Jvqx7cDEW8IMPv/+vwEzA==
-"@nebula.gl/[email protected]":
- version "0.14.0"
- resolved "https://registry.yarnpkg.com/@nebula.gl/edit-modes/-/edit-modes-0.14.0.tgz#2506ac1a17186add17926ba4e20a0d5d250e6b70"
- integrity sha512-FOogByIYDTzCDT34u/MxFbu3H2/+6uVvm4jblGds9K23HmsxFAmM7dXljjzHIushOZj2idHDEbJ5PMo3lV70pQ==
+"@nebula.gl/[email protected]":
+ version "1.0.2-alpha.0"
+ resolved "https://registry.yarnpkg.com/@nebula.gl/edit-modes/-/edit-modes-1.0.2-alpha.0.tgz#e91ec7d692fb24815e2882d2f7edceab062b0489"
+ integrity sha512-SQfksd7c4H0r5Zf+3ElDUQBttk1gSfT8skSeTWAq1Bv3t65zMZZuvWeQjI8mc+NQL33W8tDJuoGYw0uhYgVZ6g==
+ dependencies:
+ "@turf/along" ">=6.3.0"
+ "@turf/area" ">=4.0.0"
+ "@turf/bbox" ">=4.0.0"
+ "@turf/bbox-polygon" ">=4.0.0"
+ "@turf/bearing" ">=4.0.0"
+ "@turf/boolean-point-in-polygon" ">=4.0.0"
+ "@turf/buffer" ">=4.0.0"
+ "@turf/center" ">=4.0.0"
+ "@turf/centroid" ">=4.0.0"
+ "@turf/circle" ">=4.0.0"
+ "@turf/destination" ">=4.0.0"
+ "@turf/difference" ">=4.0.0"
+ "@turf/distance" ">=4.0.0"
+ "@turf/ellipse" ">=4.0.0"
+ "@turf/helpers" ">=4.0.0"
+ "@turf/intersect" ">=4.0.0"
+ "@turf/line-intersect" ">=4.0.0"
+ "@turf/nearest-point-on-line" ">=4.0.0"
+ "@turf/point-to-line-distance" ">=4.0.0"
+ "@turf/polygon-to-line" ">=4.0.0"
+ "@turf/rewind" ">=4.0.0"
+ "@turf/transform-rotate" ">=4.0.0"
+ "@turf/transform-scale" ">=4.0.0"
+ "@turf/transform-translate" ">=4.0.0"
+ "@turf/union" ">=4.0.0"
+ geojson "0.5.0"
+ lodash.throttle "^4.1.1"
+ viewport-mercator-project ">=6.0.0"
+
+"@nebula.gl/[email protected]":
+ version "1.0.2-alpha.0"
+ resolved "https://registry.yarnpkg.com/@nebula.gl/layers/-/layers-1.0.2-alpha.0.tgz#08b62b08134e57668e33ae47d097b73ba0be8e97"
+ integrity sha512-bSRqEvdauWUTIYf+RXamnYekSCBaA4tEkqGiD3xVZEsrgG0//BYsjHbSG62tpYY5FwSJEzPx6NeBRIxcJ+xPIg==
+ dependencies:
+ "@danmarshall/deckgl-typings" "4.9.12"
+ "@nebula.gl/edit-modes" "1.0.2-alpha.0"
+ "@turf/bbox" ">=4.0.0"
+ "@turf/bbox-polygon" ">=4.0.0"
+ "@turf/bearing" ">=4.0.0"
+ "@turf/boolean-point-in-polygon" ">=4.0.0"
+ "@turf/buffer" ">=4.0.0"
+ "@turf/center" ">=4.0.0"
+ "@turf/centroid" ">=4.0.0"
+ "@turf/circle" ">=4.0.0"
+ "@turf/destination" ">=4.0.0"
+ "@turf/difference" ">=4.0.0"
+ "@turf/distance" ">=4.0.0"
+ "@turf/ellipse" ">=4.0.0"
+ "@turf/helpers" ">=4.0.0"
+ "@turf/intersect" ">=4.0.0"
+ "@turf/line-intersect" ">=4.0.0"
+ "@turf/nearest-point-on-line" ">=4.0.0"
+ "@turf/point-to-line-distance" ">=4.0.0"
+ "@turf/polygon-to-line" ">=4.0.0"
+ "@turf/transform-rotate" ">=4.0.0"
+ "@turf/transform-scale" ">=4.0.0"
+ "@turf/transform-translate" ">=4.0.0"
+ "@turf/union" ">=4.0.0"
+ cubic-hermite-spline "^1.0.1"
+ geojson-types "^2.0.1"
+ global ">=4.3.0"
+ h3-js "^3.6.4"
+ viewport-mercator-project ">=6.0.0"
"@nicolo-ribaudo/[email protected]":
version "2.1.8-no-fsevents"
@@ -2384,6 +2456,40 @@
dependencies:
tippy.js "^6.3.1"
+"@turf/along@>=6.3.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/along/-/along-6.5.0.tgz#ab12eec58a14de60fe243a62d31a474f415c8fef"
+ integrity sha512-LLyWQ0AARqJCmMcIEAXF4GEu8usmd4Kbz3qk1Oy5HoRNpZX47+i5exQtmIWKdqJ1MMhW26fCTXgpsEs5zgJ5gw==
+ dependencies:
+ "@turf/bearing" "^6.5.0"
+ "@turf/destination" "^6.5.0"
+ "@turf/distance" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/area@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/area/-/area-6.5.0.tgz#1d0d7aee01d8a4a3d4c91663ed35cc615f36ad56"
+ integrity sha512-xCZdiuojokLbQ+29qR6qoMD89hv+JAgWjLrwSEWL+3JV8IXKeNFl6XkEJz9HGkVpnXvQKJoRz4/liT+8ZZ5Jyg==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/bbox-polygon@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/bbox-polygon/-/bbox-polygon-6.5.0.tgz#f18128b012eedfa860a521d8f2b3779cc0801032"
+ integrity sha512-+/r0NyL1lOG3zKZmmf6L8ommU07HliP4dgYToMoTxqzsWzyLjaj/OzgQ8rBmv703WJX+aS6yCmLuIhYqyufyuw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+
+"@turf/bbox@*", "@turf/bbox@>=4.0.0", "@turf/bbox@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/bbox/-/bbox-6.5.0.tgz#bec30a744019eae420dac9ea46fb75caa44d8dc5"
+ integrity sha512-RBbLaao5hXTYyyg577iuMtDB8ehxMlUqHEJiMs8jT1GHkFhr6sYre3lmLsPeYEi/ZKj5TP5tt7fkzNdJ4GIVyw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
"@turf/bbox@^6.0.1", "@turf/bbox@^6.3.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/@turf/bbox/-/bbox-6.3.0.tgz#0e1a9b59f32d6a2a40c806f54cbaa73575bead25"
@@ -2392,6 +2498,30 @@
"@turf/helpers" "^6.3.0"
"@turf/meta" "^6.3.0"
+"@turf/bearing@>=4.0.0", "@turf/bearing@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/bearing/-/bearing-6.5.0.tgz#462a053c6c644434bdb636b39f8f43fb0cd857b0"
+ integrity sha512-dxINYhIEMzgDOztyMZc20I7ssYVNEpSv04VbMo5YPQsqa80KO3TFvbuCahMsCAW5z8Tncc8dwBlEFrmRjJG33A==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/boolean-clockwise@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/boolean-clockwise/-/boolean-clockwise-6.5.0.tgz#34573ecc18f900080f00e4ff364631a8b1135794"
+ integrity sha512-45+C7LC5RMbRWrxh3Z0Eihsc8db1VGBO5d9BLTOAwU4jR6SgsunTfRWR16X7JUwIDYlCVEmnjcXJNi/kIU3VIw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/boolean-point-in-polygon@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/boolean-point-in-polygon/-/boolean-point-in-polygon-6.5.0.tgz#6d2e9c89de4cd2e4365004c1e51490b7795a63cf"
+ integrity sha512-DtSuVFB26SI+hj0SjrvXowGTUCHlgevPAIsukssW6BG5MlNSBQAo70wpICBNJL6RjukXg8d2eXaAWuD/CqL00A==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
"@turf/boolean-point-in-polygon@^6.3.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/@turf/boolean-point-in-polygon/-/boolean-point-in-polygon-6.3.0.tgz#784952a36c64119e90fbe94650245da62ecd8fc2"
@@ -2419,6 +2549,43 @@
"@turf/helpers" "^6.3.0"
"@turf/invariant" "^6.3.0"
+"@turf/buffer@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/buffer/-/buffer-6.5.0.tgz#22bd0d05b4e1e73eaebc69b8f574a410ff704842"
+ integrity sha512-qeX4N6+PPWbKqp1AVkBVWFerGjMYMUyencwfnkCesoznU6qvfugFHNAngNqIBVnJjZ5n8IFyOf+akcxnrt9sNg==
+ dependencies:
+ "@turf/bbox" "^6.5.0"
+ "@turf/center" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ "@turf/projection" "^6.5.0"
+ d3-geo "1.7.1"
+ turf-jsts "*"
+
+"@turf/center@>=4.0.0", "@turf/center@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/center/-/center-6.5.0.tgz#3bcb6bffcb8ba147430cfea84aabaed5dbdd4f07"
+ integrity sha512-T8KtMTfSATWcAX088rEDKjyvQCBkUsLnK/Txb6/8WUXIeOZyHu42G7MkdkHRoHtwieLdduDdmPLFyTdG5/e7ZQ==
+ dependencies:
+ "@turf/bbox" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+
+"@turf/centroid@>=4.0.0", "@turf/centroid@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/centroid/-/centroid-6.5.0.tgz#ecaa365412e5a4d595bb448e7dcdacfb49eb0009"
+ integrity sha512-MwE1oq5E3isewPprEClbfU5pXljIK/GUOMbn22UM3IFPDJX0KeoyLNwghszkdmFp/qMGL/M13MMWvU+GNLXP/A==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/circle@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/circle/-/circle-6.5.0.tgz#dc017d8c0131d1d212b7c06f76510c22bbeb093c"
+ integrity sha512-oU1+Kq9DgRnoSbWFHKnnUdTmtcRUMmHoV9DjTXu9vOLNV5OWtAAh1VZ+mzsioGGzoDNT/V5igbFOkMfBQc0B6A==
+ dependencies:
+ "@turf/destination" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+
"@turf/clone@^5.1.5":
version "5.1.5"
resolved "https://registry.yarnpkg.com/@turf/clone/-/clone-5.1.5.tgz#253e8d35477181976e33adfab50a0f02a7f0e367"
@@ -2426,21 +2593,72 @@
dependencies:
"@turf/helpers" "^5.1.5"
+"@turf/clone@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/clone/-/clone-6.5.0.tgz#895860573881ae10a02dfff95f274388b1cda51a"
+ integrity sha512-mzVtTFj/QycXOn6ig+annKrM6ZlimreKYz6f/GSERytOpgzodbQyOgkfwru100O1KQhhjSudKK4DsQ0oyi9cTw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+
+"@turf/destination@>=4.0.0", "@turf/destination@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/destination/-/destination-6.5.0.tgz#30a84702f9677d076130e0440d3223ae503fdae1"
+ integrity sha512-4cnWQlNC8d1tItOz9B4pmJdWpXqS0vEvv65bI/Pj/genJnsL7evI0/Xw42RvEGROS481MPiU80xzvwxEvhQiMQ==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/difference@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/difference/-/difference-6.5.0.tgz#677b0d5641a93bba2e82f2c683f0d880105b3197"
+ integrity sha512-l8iR5uJqvI+5Fs6leNbhPY5t/a3vipUF/3AeVLpwPQcgmedNXyheYuy07PcMGH5Jdpi5gItOiTqwiU/bUH4b3A==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ polygon-clipping "^0.15.3"
+
+"@turf/distance@>=4.0.0", "@turf/distance@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/distance/-/distance-6.5.0.tgz#21f04d5f86e864d54e2abde16f35c15b4f36149a"
+ integrity sha512-xzykSLfoURec5qvQJcfifw/1mJa+5UwByZZ5TZ8iaqjGYN0vomhV9aiSLeYdUGtYRESZ+DYC/OzY+4RclZYgMg==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/ellipse@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/ellipse/-/ellipse-6.5.0.tgz#1e20cc9eb968f35ab891572892a0bffcef5e552a"
+ integrity sha512-kuXtwFviw/JqnyJXF1mrR/cb496zDTSbGKtSiolWMNImYzGGkbsAsFTjwJYgD7+4FixHjp0uQPzo70KDf3AIBw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/rhumb-destination" "^6.5.0"
+ "@turf/transform-rotate" "^6.5.0"
+
+"@turf/[email protected]", "@turf/helpers@>=4.0.0", "@turf/helpers@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-6.5.0.tgz#f79af094bd6b8ce7ed2bd3e089a8493ee6cae82e"
+ integrity sha512-VbI1dV5bLFzohYYdgqwikdMVpe7pJ9X3E+dlr425wa2/sMJqYDhTO++ec38/pcPvPE6oD9WEEeU3Xu3gza+VPw==
+
"@turf/helpers@^5.1.5":
version "5.1.5"
resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-5.1.5.tgz#153405227ab933d004a5bb9641a9ed999fcbe0cf"
integrity sha512-/lF+JR+qNDHZ8bF9d+Cp58nxtZWJ3sqFe6n3u3Vpj+/0cqkjk4nXKYBSY0azm+GIYB5mWKxUXvuP/m0ZnKj1bw==
-"@turf/helpers@^6.1.4":
- version "6.1.4"
- resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-6.1.4.tgz#d6fd7ebe6782dd9c87dca5559bda5c48ae4c3836"
- integrity sha512-vJvrdOZy1ngC7r3MDA7zIGSoIgyrkWcGnNIEaqn/APmw+bVLF2gAW7HIsdTxd12s5wQMqEpqIQrmrbRRZ0xC7g==
-
-"@turf/helpers@^6.3.0":
+"@turf/helpers@^6.1.4", "@turf/helpers@^6.3.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/@turf/helpers/-/helpers-6.3.0.tgz#87f90f806c3f8ad6385ef8d2041d3662bf3c9fb1"
integrity sha512-kr6KuD4Z0GZ30tblTEvi90rvvVNlKieXuMC8CTzE/rVQb0/f/Cb29zCXxTD7giQTEQY/P2nRW23wEqqyNHulCg==
+"@turf/intersect@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/intersect/-/intersect-6.5.0.tgz#a14e161ddd0264d0f07ac4e325553c70c421f9e6"
+ integrity sha512-2legGJeKrfFkzntcd4GouPugoqPUjexPZnOvfez+3SfIMrHvulw8qV8u7pfVyn2Yqs53yoVCEjS5sEpvQ5YRQg==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ polygon-clipping "^0.15.3"
+
"@turf/invariant@^5.1.5":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@turf/invariant/-/invariant-5.2.0.tgz#f0150ff7290b38577b73d088b7932c1ee0aa90a7"
@@ -2455,6 +2673,40 @@
dependencies:
"@turf/helpers" "^6.3.0"
+"@turf/invariant@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/invariant/-/invariant-6.5.0.tgz#970afc988023e39c7ccab2341bd06979ddc7463f"
+ integrity sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+
+"@turf/line-intersect@>=4.0.0", "@turf/line-intersect@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/line-intersect/-/line-intersect-6.5.0.tgz#dea48348b30c093715d2195d2dd7524aee4cf020"
+ integrity sha512-CS6R1tZvVQD390G9Ea4pmpM6mJGPWoL82jD46y0q1KSor9s6HupMIo1kY4Ny+AEYQl9jd21V3Scz20eldpbTVA==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/line-segment" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ geojson-rbush "3.x"
+
+"@turf/line-segment@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/line-segment/-/line-segment-6.5.0.tgz#ee73f3ffcb7c956203b64ed966d96af380a4dd65"
+ integrity sha512-jI625Ho4jSuJESNq66Mmi290ZJ5pPZiQZruPVpmHkUw257Pew0alMmb6YrqYNnLUuiVVONxAAKXUVeeUGtycfw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/[email protected]", "@turf/meta@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/meta/-/meta-6.5.0.tgz#b725c3653c9f432133eaa04d3421f7e51e0418ca"
+ integrity sha512-RrArvtsV0vdsCBegoBtOalgdSOfkBrTJ07VkpiCnq/491W67hnMWmDu7e6Ztw0C3WldRYTXkg3SumfdzZxLBHA==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+
"@turf/meta@^5.1.5":
version "5.2.0"
resolved "https://registry.yarnpkg.com/@turf/meta/-/meta-5.2.0.tgz#3b1ad485ee0c3b0b1775132a32c384d53e4ba53d"
@@ -2469,6 +2721,69 @@
dependencies:
"@turf/helpers" "^6.3.0"
+"@turf/nearest-point-on-line@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/nearest-point-on-line/-/nearest-point-on-line-6.5.0.tgz#8e1cd2cdc0b5acaf4c8d8b3b33bb008d3cb99e7b"
+ integrity sha512-WthrvddddvmymnC+Vf7BrkHGbDOUu6Z3/6bFYUGv1kxw8tiZ6n83/VG6kHz4poHOfS0RaNflzXSkmCi64fLBlg==
+ dependencies:
+ "@turf/bearing" "^6.5.0"
+ "@turf/destination" "^6.5.0"
+ "@turf/distance" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/line-intersect" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/point-to-line-distance@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/point-to-line-distance/-/point-to-line-distance-6.5.0.tgz#bc46fe09ea630aaf73f13c40b38a7df79050fff8"
+ integrity sha512-opHVQ4vjUhNBly1bob6RWy+F+hsZDH9SA0UW36pIRzfpu27qipU18xup0XXEePfY6+wvhF6yL/WgCO2IbrLqEA==
+ dependencies:
+ "@turf/bearing" "^6.5.0"
+ "@turf/distance" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ "@turf/projection" "^6.5.0"
+ "@turf/rhumb-bearing" "^6.5.0"
+ "@turf/rhumb-distance" "^6.5.0"
+
+"@turf/polygon-to-line@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/polygon-to-line/-/polygon-to-line-6.5.0.tgz#4dc86db66168b32bb83ce448cf966208a447d952"
+ integrity sha512-5p4n/ij97EIttAq+ewSnKt0ruvuM+LIDzuczSzuHTpq4oS7Oq8yqg5TQ4nzMVuK41r/tALCk7nAoBuw3Su4Gcw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/projection@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/projection/-/projection-6.5.0.tgz#d2aad862370bf03f2270701115464a8406c144b2"
+ integrity sha512-/Pgh9mDvQWWu8HRxqpM+tKz8OzgauV+DiOcr3FCjD6ubDnrrmMJlsf6fFJmggw93mtVPrZRL6yyi9aYCQBOIvg==
+ dependencies:
+ "@turf/clone" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/rewind@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/rewind/-/rewind-6.5.0.tgz#bc0088f8ec56f00c8eacd902bbe51e3786cb73a0"
+ integrity sha512-IoUAMcHWotBWYwSYuYypw/LlqZmO+wcBpn8ysrBNbazkFNkLf3btSDZMkKJO/bvOzl55imr/Xj4fi3DdsLsbzQ==
+ dependencies:
+ "@turf/boolean-clockwise" "^6.5.0"
+ "@turf/clone" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+
+"@turf/rhumb-bearing@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/rhumb-bearing/-/rhumb-bearing-6.5.0.tgz#8c41ad62b44fb4e57c14fe790488056684eee7b9"
+ integrity sha512-jMyqiMRK4hzREjQmnLXmkJ+VTNTx1ii8vuqRwJPcTlKbNWfjDz/5JqJlb5NaFDcdMpftWovkW5GevfnuzHnOYA==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
"@turf/rhumb-destination@^5.1.5":
version "5.1.5"
resolved "https://registry.yarnpkg.com/@turf/rhumb-destination/-/rhumb-destination-5.1.5.tgz#b1b2aeb921547f2ac0c1a994b6a130f92463c742"
@@ -2477,6 +2792,63 @@
"@turf/helpers" "^5.1.5"
"@turf/invariant" "^5.1.5"
+"@turf/rhumb-destination@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/rhumb-destination/-/rhumb-destination-6.5.0.tgz#12da8c85e674b182e8b0ec8ea9c5fe2186716dae"
+ integrity sha512-RHNP1Oy+7xTTdRrTt375jOZeHceFbjwohPHlr9Hf68VdHHPMAWgAKqiX2YgSWDcvECVmiGaBKWus1Df+N7eE4Q==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/rhumb-distance@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/rhumb-distance/-/rhumb-distance-6.5.0.tgz#ed068004b1469512b857070fbf5cb7b7eabbe592"
+ integrity sha512-oKp8KFE8E4huC2Z1a1KNcFwjVOqa99isxNOwfo4g3SUABQ6NezjKDDrnvC4yI5YZ3/huDjULLBvhed45xdCrzg==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+
+"@turf/transform-rotate@>=4.0.0", "@turf/transform-rotate@^6.5.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/transform-rotate/-/transform-rotate-6.5.0.tgz#e50e96a8779af91d58149eedb00ffd7f6395c804"
+ integrity sha512-A2Ip1v4246ZmpssxpcL0hhiVBEf4L8lGnSPWTgSv5bWBEoya2fa/0SnFX9xJgP40rMP+ZzRaCN37vLHbv1Guag==
+ dependencies:
+ "@turf/centroid" "^6.5.0"
+ "@turf/clone" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ "@turf/rhumb-bearing" "^6.5.0"
+ "@turf/rhumb-destination" "^6.5.0"
+ "@turf/rhumb-distance" "^6.5.0"
+
+"@turf/transform-scale@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/transform-scale/-/transform-scale-6.5.0.tgz#dcccd8b0f139de32e32225a29c107a1279137120"
+ integrity sha512-VsATGXC9rYM8qTjbQJ/P7BswKWXHdnSJ35JlV4OsZyHBMxJQHftvmZJsFbOqVtQnIQIzf2OAly6rfzVV9QLr7g==
+ dependencies:
+ "@turf/bbox" "^6.5.0"
+ "@turf/center" "^6.5.0"
+ "@turf/centroid" "^6.5.0"
+ "@turf/clone" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ "@turf/rhumb-bearing" "^6.5.0"
+ "@turf/rhumb-destination" "^6.5.0"
+ "@turf/rhumb-distance" "^6.5.0"
+
+"@turf/transform-translate@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/transform-translate/-/transform-translate-6.5.0.tgz#631b13aca6402898029e03fc2d1f4bc1c667fc3e"
+ integrity sha512-NABLw5VdtJt/9vSstChp93pc6oel4qXEos56RBMsPlYB8hzNTEKYtC146XJvyF4twJeeYS8RVe1u7KhoFwEM5w==
+ dependencies:
+ "@turf/clone" "^6.5.0"
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ "@turf/meta" "^6.5.0"
+ "@turf/rhumb-destination" "^6.5.0"
+
"@turf/transform-translate@^5.1.5":
version "5.1.5"
resolved "https://registry.yarnpkg.com/@turf/transform-translate/-/transform-translate-5.1.5.tgz#530a257fb1dc7268dadcab34e67901eb2a3dec63"
@@ -2488,6 +2860,15 @@
"@turf/meta" "^5.1.5"
"@turf/rhumb-destination" "^5.1.5"
+"@turf/union@>=4.0.0":
+ version "6.5.0"
+ resolved "https://registry.yarnpkg.com/@turf/union/-/union-6.5.0.tgz#82d28f55190608f9c7d39559b7f543393b03b82d"
+ integrity sha512-igYWCwP/f0RFHIlC2c0SKDuM/ObBaqSljI3IdV/x71805QbIvY/BYGcJdyNcgEA6cylIGl/0VSlIbpJHZ9ldhw==
+ dependencies:
+ "@turf/helpers" "^6.5.0"
+ "@turf/invariant" "^6.5.0"
+ polygon-clipping "^0.15.3"
+
"@types/anymatch@*":
version "1.3.1"
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
@@ -2582,10 +2963,10 @@
resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.7.tgz#c8fa532b60a0042219cdf173ca21a975ef0666ad"
integrity sha512-wE2v81i4C4Ol09RtsWFAqg3BUitWbHSpSlIo+bNdsCJijO9sjme+zm+73ZMCa/qMC8UEERxzGbvmr1cffo2SiQ==
-"@types/geojson@^7946.0.8":
- version "7946.0.10"
- resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.10.tgz#6dfbf5ea17142f7f9a043809f1cd4c448cb68249"
- integrity sha512-Nmh0K3iWQJzniTuPRcJn5hxXkfB1T1pgB89SBig5PlJQU5yocazeu4jATJlaA0GYFKWMqDdvYemoSnF2pXgLVA==
+"@types/[email protected]", "@types/geojson@^7946.0.8":
+ version "7946.0.8"
+ resolved "https://registry.yarnpkg.com/@types/geojson/-/geojson-7946.0.8.tgz#30744afdb385e2945e22f3b033f897f76b1f12ca"
+ integrity sha512-1rkryxURpr6aWP7R786/UQOkJ3PcpQiWkAXBmdWc7ryFWqN6a4xfK7BtjXvFBKO9LjQ+MWQSWxYeZX1OApnArA==
version "5.0.30"
@@ -2610,7 +2991,12 @@
dependencies:
"@types/node" "*"
-"@types/hammerjs@^2.0.36", "@types/hammerjs@^2.0.41":
+"@types/hammerjs@^2.0.36":
+ version "2.0.40"
+ resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.40.tgz#ded0240b6ea1ad7afc1e60374c49087aaea5dbd8"
+ integrity sha512-VbjwR1fhsn2h2KXAY4oy1fm7dCxaKy0D+deTb8Ilc3Eo3rc5+5eA4rfYmZaHgNJKxVyI0f6WIXzO2zLkVmQPHA==
+
+"@types/hammerjs@^2.0.41":
version "2.0.41"
resolved "https://registry.yarnpkg.com/@types/hammerjs/-/hammerjs-2.0.41.tgz#f6ecf57d1b12d2befcce00e928a6a097c22980aa"
integrity sha512-ewXv/ceBaJprikMcxCmWU1FKyMAQ2X7a9Gtmzw8fcg2kIePI1crERDM818W+XYrxqdBBOdlf2rm137bU+BltCA==
@@ -5434,6 +5820,11 @@ csstype@^3.0.2:
resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.0.7.tgz#2a5fb75e1015e84dd15692f71e89a1450290950b"
integrity sha512-KxnUB0ZMlnUWCsx2Z8MUsr6qV6ja1w9ArPErJaJaF8a5SOWoHLIszeCTKGRGRgtLgYrs1E8CHkNSP1VZTTPc9g==
+cubic-hermite-spline@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/cubic-hermite-spline/-/cubic-hermite-spline-1.0.1.tgz#48fb0a4153aa6a1ce3aa1e7e8c545afe8c624bac"
+ integrity sha1-SPsKQVOqahzjqh5+jFRa/oxiS6w=
+
cwd@^0.10.0:
version "0.10.0"
resolved "https://registry.yarnpkg.com/cwd/-/cwd-0.10.0.tgz#172400694057c22a13b0cf16162c7e4b7a7fe567"
@@ -5550,6 +5941,13 @@ d3-format@^1.2.0:
resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-1.4.5.tgz#374f2ba1320e3717eb74a9356c67daee17a7edb4"
integrity sha512-J0piedu6Z8iB6TbIGfZgDzfXxUFN3qQRMofy2oPdXzQibYGqPB/9iMcxr/TGalU+2RsyDO+U4f33id8tbnSRMQ==
+ version "1.7.1"
+ resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.7.1.tgz#44bbc7a218b1fd859f3d8fd7c443ca836569ce99"
+ integrity sha512-O4AempWAr+P5qbk2bC2FuN/sDW4z+dN2wDf9QV3bxQt4M5HfOEeXLgJ/UKQW0+o1Dj8BE+L5kiDbdWUMjsmQpw==
+ dependencies:
+ d3-array "1"
+
d3-geo@^1.6.4:
version "1.12.1"
resolved "https://registry.yarnpkg.com/d3-geo/-/d3-geo-1.12.1.tgz#7fc2ab7414b72e59fbcbd603e80d9adc029b035f"
@@ -7653,11 +8051,32 @@ gensync@^1.0.0-beta.2:
resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0"
integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/geojson-rbush/-/geojson-rbush-3.2.0.tgz#8b543cf0d56f99b78faf1da52bb66acad6dfc290"
+ integrity sha512-oVltQTXolxvsz1sZnutlSuLDEcQAKYC/uXt9zDzJJ6bu0W+baTI8LZBaTup5afzibEH4N3jlq2p+a152wlBJ7w==
+ dependencies:
+ "@turf/bbox" "*"
+ "@turf/helpers" "6.x"
+ "@turf/meta" "6.x"
+ "@types/geojson" "7946.0.8"
+ rbush "^3.0.1"
+
+geojson-types@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/geojson-types/-/geojson-types-2.0.1.tgz#91040649b7ad39b2904643bd9ad51e5e86d524e3"
+ integrity sha1-kQQGSbetObKQRkO9mtUeXobVJOM=
+
geojson-vt@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/geojson-vt/-/geojson-vt-3.2.1.tgz#f8adb614d2c1d3f6ee7c4265cad4bbf3ad60c8b7"
integrity sha512-EvGQQi/zPrDA6zr6BnJD/YhwAkBP8nnJ9emh3EnHQKVMfg/MRVtPbMYdgVy/IaEmn4UfagD2a6fafPDL5hbtwg==
+ version "0.5.0"
+ resolved "https://registry.yarnpkg.com/geojson/-/geojson-0.5.0.tgz#3cd6c96399be65b56ee55596116fe9191ce701c0"
+ integrity sha1-PNbJY5m+ZbVu5VWWEW/pGRznAcA=
+
get-assigned-identifiers@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz#6dbf411de648cbaf8d9169ebb0d2d576191e2ff1"
@@ -7809,7 +8228,7 @@ github-slugger@^1.0.0, github-slugger@^1.2.1:
dependencies:
emoji-regex ">=6.0.0 <=6.1.1"
-gl-matrix@^3.0.0, gl-matrix@^3.2.1:
+gl-matrix@^3.0.0, gl-matrix@^3.2.1, gl-matrix@~3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/gl-matrix/-/gl-matrix-3.3.0.tgz#232eef60b1c8b30a28cbbe75b2caf6c48fd6358b"
integrity sha512-COb7LDz+SXaHtl/h4LeaFcNdJdAQSDeVqjiIihSXNrkWObZLhDI4hIkZC11Aeqp7bcE72clzB0BnDXr2SmslRA==
@@ -7940,7 +8359,7 @@ global-prefix@^3.0.0:
kind-of "^6.0.2"
which "^1.3.1"
-global@^4.3.0, global@^4.3.1, global@^4.4.0:
+global@>=4.3.0, global@^4.3.0, global@^4.3.1, global@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406"
integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==
@@ -8079,7 +8498,7 @@ h3-js@^3.1.0:
resolved "https://registry.yarnpkg.com/h3-js/-/h3-js-3.7.1.tgz#cb80092fd917c182c5025c2590ac093f52906edb"
integrity sha512-EManlaXSd8BKiuw7hnkg4grpzEjvf+aGkw33upVrO+iGenPHz+tVurgx5ZMTVBSV8lkbSUm44tHrs5biX7UTlQ==
-h3-js@^3.7.0:
+h3-js@^3.6.4, h3-js@^3.7.0:
version "3.7.2"
resolved "https://registry.yarnpkg.com/h3-js/-/h3-js-3.7.2.tgz#61d4feb7bb42868ca9cdb2d5cf9d9dda94f9e5a3"
integrity sha512-LPjlHSwB9zQZrMqKloCZmmmt3yZzIK7nqPcXqwU93zT3TtYG6jP4tZBzAPouxut7lLjdFbMQ75wRBiKfpsnY7w==
@@ -10849,7 +11268,7 @@ mixin-object@^2.0.1:
for-in "^0.1.3"
is-extendable "^0.1.1"
-mjolnir.js@^2.1.0, mjolnir.js@^2.5.0:
+mjolnir.js@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/mjolnir.js/-/mjolnir.js-2.5.0.tgz#5918b74625d9682002da82e01d6ffb0b16b02b0e"
integrity sha512-YkVoyKs7qm9xvAgRgjx3Md/7eYqmq7VXOgTKQNnmuzcBJzMebjdIWa7FdTd0RZBrw3UL6V6TTktsxJwBMLXUNA==
@@ -12131,6 +12550,13 @@ pngjs@^4.0.1:
resolved "https://registry.yarnpkg.com/pngjs/-/pngjs-4.0.1.tgz#f803869bb2fc1bfe1bf99aa4ec21c108117cfdbe"
integrity sha512-rf5+2/ioHeQxR6IxuYNYGFytUyG3lma/WW1nsmjeHlWwtb2aByla6dkVc8pmJ9nplzkTA0q2xx7mMWrOTqT4Gg==
+polygon-clipping@^0.15.3:
+ version "0.15.3"
+ resolved "https://registry.yarnpkg.com/polygon-clipping/-/polygon-clipping-0.15.3.tgz#0215840438470ba2e9e6593625e4ea5c1087b4b7"
+ integrity sha512-ho0Xx5DLkgxRx/+n4O74XyJ67DcyN3Tu9bGYKsnTukGAW6ssnuak6Mwcyb1wHy9MZc9xsUWqIoiazkZB5weECg==
+ dependencies:
+ splaytree "^3.1.0"
+
popmotion@^8.6.10:
version "8.7.6"
resolved "https://registry.yarnpkg.com/popmotion/-/popmotion-8.7.6.tgz#0f6aa461bdcbcdbf24cb70afb054e91cb39eccb3"
@@ -12683,6 +13109,13 @@ raw-body@~1.1.0:
bytes "1"
string_decoder "0.10"
+rbush@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/rbush/-/rbush-3.0.1.tgz#5fafa8a79b3b9afdfe5008403a720cc1de882ecf"
+ integrity sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==
+ dependencies:
+ quickselect "^2.0.0"
+
rc@^1.0.1, rc@^1.1.6, rc@^1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
@@ -12783,18 +13216,6 @@ react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
- version "0.14.8"
- resolved "https://registry.yarnpkg.com/react-map-gl-draw/-/react-map-gl-draw-0.14.8.tgz#43657ebbe13f39865f4d86e0dab07587040ee4da"
- integrity sha512-16BW510XbinBTKO5W51RxEnIu6TiRZbxxulJN2HX1l++UWuyiTvf7o0/oboCtjCWSbwNRsHh6GQ+9HDebt2yhQ==
- dependencies:
- "@nebula.gl/edit-modes" "0.14.0"
- "@turf/helpers" "^6.1.4"
- mjolnir.js "^2.1.0"
- prop-types "^15.5.7"
- uuid "^3.3.2"
- viewport-mercator-project ">=5.0.0"
-
react-map-gl@^5.0.3:
version "5.3.10"
resolved "https://registry.yarnpkg.com/react-map-gl/-/react-map-gl-5.3.10.tgz#2f385dcde5f5a8b86bd7da9ec456ad3be0e5d174"
@@ -14387,6 +14808,11 @@ specificity@^0.4.1:
resolved "https://registry.yarnpkg.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
integrity sha512-1klA3Gi5PD1Wv9Q0wUoOQN1IWAuPu0D1U03ThXTr0cJ20+/iq2tHSDnK7Kk/0LXJ1ztUB2/1Os0wKmfyNgUQfg==
+splaytree@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/splaytree/-/splaytree-3.1.0.tgz#17d4a0108a6da3627579690b7b847241e18ddec8"
+ integrity sha512-gvUGR7xnOy0fLKTCxDeUZYgU/I1Tdf8M/lM1Qrf8L2TIOR5ipZjGk02uYcdv0o2x7WjVRgpm3iS2clLyuVAt0Q==
+
split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
@@ -15412,6 +15838,11 @@ tunnel-agent@^0.6.0:
dependencies:
safe-buffer "^5.0.1"
+turf-jsts@*:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/turf-jsts/-/turf-jsts-1.2.3.tgz#59757f542afbff9a577bbf411f183b8f48d38aa4"
+ integrity sha512-Ja03QIJlPuHt4IQ2FfGex4F4JAr8m3jpaHbFbQrgwr7s7L6U8ocrHiF3J1+wf9jzhGKxvDeaCAnGDot8OjGFyA==
+
tweetnacl@^0.14.3, tweetnacl@~0.14.0:
version "0.14.5"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64"
@@ -16061,12 +16492,12 @@ vfile@^4.0.0:
unist-util-stringify-position "^2.0.0"
vfile-message "^2.0.0"
-viewport-mercator-project@>=5.0.0, "viewport-mercator-project@^6.2.3 || ^7.0.2":
- version "7.0.2"
- resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-7.0.2.tgz#8b37ae5614be139010631fde14d1583cf742abaf"
- integrity sha512-gH0pBO4Y5McGCPaKulkpL9MPDg+wtOSXtndwh0467T/WLMerfBi7EkHYw1pp9HE2VeqFqUaAfot98cQPGaIjEA==
+viewport-mercator-project@>=6.0.0, viewport-mercator-project@^7.0.4:
+ version "7.0.4"
+ resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-7.0.4.tgz#67feec04135484bf424dd4890d630e82116b31e6"
+ integrity sha512-0jzpL6pIMocCKWg1C3mqi/N4UPgZC3FzwghEm1H+XsUo8hNZAyJc3QR7YqC816ibOR8aWT5pCsV+gCu8/BMJgg==
dependencies:
- "@math.gl/web-mercator" "^3.2.0"
+ "@math.gl/web-mercator" "^3.5.5"
viewport-mercator-project@^6.0.0:
version "6.2.3"
@@ -16076,12 +16507,12 @@ viewport-mercator-project@^6.0.0:
"@babel/runtime" "^7.0.0"
gl-matrix "^3.0.0"
-viewport-mercator-project@^7.0.4:
- version "7.0.4"
- resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-7.0.4.tgz#67feec04135484bf424dd4890d630e82116b31e6"
- integrity sha512-0jzpL6pIMocCKWg1C3mqi/N4UPgZC3FzwghEm1H+XsUo8hNZAyJc3QR7YqC816ibOR8aWT5pCsV+gCu8/BMJgg==
+"viewport-mercator-project@^6.2.3 || ^7.0.2":
+ version "7.0.2"
+ resolved "https://registry.yarnpkg.com/viewport-mercator-project/-/viewport-mercator-project-7.0.2.tgz#8b37ae5614be139010631fde14d1583cf742abaf"
+ integrity sha512-gH0pBO4Y5McGCPaKulkpL9MPDg+wtOSXtndwh0467T/WLMerfBi7EkHYw1pp9HE2VeqFqUaAfot98cQPGaIjEA==
dependencies:
- "@math.gl/web-mercator" "^3.5.5"
+ "@math.gl/web-mercator" "^3.2.0"
vinyl-fs@^3.0.2:
version "3.0.3"