Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] Export Image with legend (#34)
Shan He44ef97d7cf0c
diff --git a/package.json b/package.jsonindex 4ed02138f..b8df067f7 100644--- a/package.json+++ b/package.json@@ -71,7 +71,7 @@"d3-request": "^1.0.6","d3-scale": "^1.0.6","deck.gl": "4.1.6",- "dom-to-image": "^2.6.0",+ "dom-to-image": "github:heshan0131/dom-to-image","fuzzy": "^0.1.3","global": "^4.3.0","keymirror": "^0.1.1",diff --git a/src/actions/ui-state-actions.js b/src/actions/ui-state-actions.jsindex be366cb9f..01ef690f2 100644--- a/src/actions/ui-state-actions.js+++ b/src/actions/ui-state-actions.js@@ -34,13 +34,15 @@ const {START_EXPORTING_IMAGE,TOGGLE_LEGEND,TOGGLE_MODAL,- TOGGLE_SIDE_PANEL+ TOGGLE_SIDE_PANEL,+ TOGGLE_MAP_CONTROL} = ActionTypes;// second argument of createAction is expected to be payloadCreator or undefinedconst [toggleSidePanel,toggleModal,+ toggleMapControl,openDeleteModal,// export imagesetRatio,@@ -57,6 +59,7 @@ const [] = [TOGGLE_SIDE_PANEL,TOGGLE_MODAL,+ TOGGLE_MAP_CONTROL,OPEN_DELETE_MODAL,SET_RATIO,SET_RESOLUTION,@@ -71,7 +74,7 @@ const [].map(a => createAction(a));export {- toggleSidePanel, toggleModal, openDeleteModal, setExportConfig,+ toggleSidePanel, toggleModal, toggleMapControl, openDeleteModal, setExportConfig,setRatio, setResolution, toggleLegend, startExportingImage, setExportImageDataUri, cleanupExportImage,setExportSelectedDataset, setExportDataType, setExportFiltered};diff --git a/src/components/common/styled-components.js b/src/components/common/styled-components.jsindex e2a1d0f69..ae2a20770 100644--- a/src/components/common/styled-components.js+++ b/src/components/common/styled-components.js@@ -259,7 +259,7 @@ export const StyledPanelHeader = styled.div`export const StyledPanelDropdown = styled.div`${props => props.theme.panelDropdownScrollBar}background-color: ${props => props.theme.panelBackground};- overflow-y: scroll;+ overflow-y: auto;box-shadow: ${props => props.theme.panelBoxShadow};border-radius: ${props => props.theme.panelBorderRadius};margin-top: 2px;diff --git a/src/components/kepler-gl.js b/src/components/kepler-gl.jsindex b00e0b73c..83215ed70 100644--- a/src/components/kepler-gl.js+++ b/src/components/kepler-gl.js@@ -218,6 +218,7 @@ function KeplerGlFactory(mapboxApiAccessToken,mapState,mapStyle,+ mapControls: uiState.mapControls,layers,layerOrder,layerData,@@ -225,6 +226,8 @@ function KeplerGlFactory(interactionConfig,hoverInfo,clicked,+ toggleMapControl: uiStateActions.toggleMapControl,+ uiStateActions,visStateActions,mapStateActions};diff --git a/src/components/map-container.js b/src/components/map-container.jsindex f90315ab9..47e24203f 100644--- a/src/components/map-container.js+++ b/src/components/map-container.js@@ -56,18 +56,27 @@ export default function MapContainerFactory(MapPopover, MapControl) {class MapContainer extends Component {static propTypes = {// required- data: PropTypes.arrayOf(PropTypes.any),- fields: PropTypes.arrayOf(PropTypes.any),+ datasets: PropTypes.object,interactionConfig: PropTypes.object.isRequired,layerBlending: PropTypes.string.isRequired,+ layerOrder: PropTypes.arrayOf(PropTypes.any).isRequired,layerData: PropTypes.arrayOf(PropTypes.any).isRequired,layers: PropTypes.arrayOf(PropTypes.any).isRequired,mapState: PropTypes.object.isRequired,mapStyle: PropTypes.object.isRequired,+ mapControls: PropTypes.object.isRequired,+ mapboxApiAccessToken: PropTypes.string.isRequired,+ toggleMapControl: PropTypes.func.isRequired,+ visStateActions: PropTypes.object.isRequired,+ mapStateActions: PropTypes.object.isRequired,// optional+ clicked: PropTypes.object,+ hoverInfo: PropTypes.object,mapLayers: PropTypes.object,- onMapToggleLayer: PropTypes.func+ onMapToggleLayer: PropTypes.func,+ onMapStyleLoaded: PropTypes.func,+ onMapRender: PropTypes.func};constructor(props) {@@ -102,6 +111,7 @@ export default function MapContainerFactory(MapPopover, MapControl) {// bind mapboxgl event listenerthis._map.on(MAPBOXGL_STYLE_UPDATE, () => {// force refresh mapboxgl layers+updateMapboxLayers(this._map,this._renderMapboxLayers(),@@ -109,7 +119,17 @@ export default function MapContainerFactory(MapPopover, MapControl) {this.props.mapLayers,{force: true});- })++ if (typeof this.props.onMapStyleLoaded === 'function') {+ this.props.onMapStyleLoaded(this._map);+ }+ });++ this._map.on('render', () => {+ if (typeof this.props.onMapRender === 'function') {+ this.props.onMapRender(this._map);+ }+ });}}@@ -393,7 +413,8 @@ export default function MapContainerFactory(MapPopover, MapControl) {return <div/>;}- const {mapLayers, layers, datasets, index, mapboxApiAccessToken} = this.props;+ const {mapLayers, layers, datasets, index, mapboxApiAccessToken,+ mapControls, toggleMapControl} = this.props;const mapProps = {...mapState,@@ -412,10 +433,12 @@ export default function MapContainerFactory(MapPopover, MapControl) {layers={layers}mapIndex={this.props.index}mapLayers={mapLayers}+ mapControls={mapControls}onTogglePerspective={mapStateActions.togglePerspective}onToggleSplitMap={mapStateActions.toggleSplitMap}onMapToggleLayer={this._handleMapToggleLayer}onToggleFullScreen={mapStateActions.toggleFullScreen}+ onToggleMapControl={toggleMapControl}top={0}/><MapboxGLMapdiff --git a/src/components/map/map-control.js b/src/components/map/map-control.jsindex 3ed153182..5ddf66583 100644--- a/src/components/map/map-control.js+++ b/src/components/map/map-control.js@@ -164,9 +164,11 @@ export class MapControl extends Component {static propTypes = {dragRotate: PropTypes.bool.isRequired,isSplit: PropTypes.bool.isRequired,+ mapControls: PropTypes.object.isRequired,onToggleFullScreen: PropTypes.func.isRequired,onTogglePerspective: PropTypes.func.isRequired,onToggleSplitMap: PropTypes.func.isRequired,+ onToggleMapControl: PropTypes.func.isRequired,top: PropTypes.number.isRequired};@@ -175,13 +177,6 @@ export class MapControl extends Component {top: 0};- constructor(props) {- super(props);- this.state = {- areLayersVisible: false,- isLegendVisible: false- };- }layerSelector = state => state.layers;mapLayersSelector = state => state.mapLayers;@@ -191,74 +186,6 @@ export class MapControl extends Component {layerSelector);- // if one panel is already open and user tries to open a new one well the previous one will be closed- _toggleMenuPanel(panelId) {- this.setState({- areLayersVisible: false,- isLegendVisible: false,- [panelId]: !this.state[panelId]- });- }-- _renderLayerSelector(items) {- const {onMapToggleLayer} = this.props;- const {areLayersVisible} = this.state;-- return !areLayersVisible ? (- <StyledMapControlButton- key={1}- onClick={e => {- e.preventDefault();- this._toggleMenuPanel('areLayersVisible');- }}- className="map-control-button toggle-layer"- data-tip- data-for="toggle-layer"- >- <Layers height="22px" />- <MapLegendTooltip- id="toggle-layer"- message={areLayersVisible ? 'Hide layer panel' : 'Show layer panel'}- />- </StyledMapControlButton>- ) : (- <MapControlPanel- header={'Visible layers'}- onClick={() => this._toggleMenuPanel('areLayersVisible')}- >- <MapLayerSelector layers={items} onMapToggleLayer={onMapToggleLayer} />- </MapControlPanel>- );- }-- _renderLegend(items) {- const {isLegendVisible} = this.state;- return !isLegendVisible ? (- <StyledMapControlButton- key={2}- data-tip- data-for="show-legend"- className="map-control-button show-legend"- onClick={e => {- e.preventDefault();- this._toggleMenuPanel('isLegendVisible');- }}- >- <Legend height="22px" />- <MapLegendTooltip id="show-legend" message={'show legend'} />- </StyledMapControlButton>- ) : (- <MapControlPanel- header={'Layer Legend'}- onClick={() => this._toggleMenuPanel('isLegendVisible')}- >- <MapLegend- layers={items.filter(item => item.isVisible).map(item => item.layer)}- />- </MapControlPanel>- );- }-render() {const items = this.initialDataSelector(this.props);@@ -270,14 +197,19 @@ export class MapControl extends Component {dragRotate,isSplit,mapIndex,+ mapControls,onTogglePerspective,- onToggleSplitMap+ onToggleSplitMap,+ onMapToggleLayer,+ onToggleMapControl} = this.props;+ const {visibleLayers = {}, mapLegend = {}, toggle3d = {}, splitMap = {}} = mapControls;+return (<StyledMapControl className="map-control">{/* Split Map */}- <ActionPanel key={0}>+ {splitMap.show ? <ActionPanel key={0}><StyledMapControlButtonactive={isSplit}onClick={e => {@@ -290,8 +222,8 @@ export class MapControl extends Component {data-for="action-toggle">{isSplit ?- <Delete height={'18px'} /> :- <Split height={'18px'} />+ <Delete height="18px" /> :+ <Split height="18px" />}<MapLegendTooltipid="action-toggle"@@ -300,13 +232,22 @@ export class MapControl extends Component {}/></StyledMapControlButton>- </ActionPanel>+ </ActionPanel> : null}+{/* Map Layers */}- {isSplit && (- <ActionPanel key={1}>{this._renderLayerSelector(items)}</ActionPanel>- )}+ {isSplit && visibleLayers.show ? (+ <ActionPanel key={1}>+ <LayerSelectorPanel+ items={items}+ onMapToggleLayer={onMapToggleLayer}+ isActive={visibleLayers.active}+ toggleMenuPanel={() => onToggleMapControl('visibleLayers')}+ />+ </ActionPanel>+ ) : null}+{/* 3D Map */}- <ActionPanel key={2}>+ {toggle3d.show ? <ActionPanel key={2}><StyledMapControlButtononClick={e => {e.preventDefault();@@ -316,16 +257,24 @@ export class MapControl extends Component {data-tipdata-for="action-3d">- <Cube3d height={'22px'} />+ <Cube3d height="22px" />{/* No icon since we are injecting through css .threeD-map class*/}<MapLegendTooltipid="action-3d"message={dragRotate ? 'Disable 3D Map' : '3D Map'}/></StyledMapControlButton>- </ActionPanel>+ </ActionPanel> : null}+{/* Map Legend */}- <ActionPanel key={3}>{this._renderLegend(items)}</ActionPanel>+ {mapLegend.show ? <ActionPanel key={3}>+ <MapLegendPanel+ items={items}+ onMapToggleLayer={onMapToggleLayer}+ isActive={mapLegend.active}+ toggleMenuPanel={() => onToggleMapControl('mapLegend')}+ />+ </ActionPanel> : null}</StyledMapControl>);}@@ -343,6 +292,61 @@ const MapControlPanel = ({children, header, onClick}) => (</StyledMapControlPanel>);+const MapLegendPanel = ({items, isActive, toggleMenuPanel}) => (+ !isActive ? (+ <StyledMapControlButton+ key={2}+ data-tip+ data-for="show-legend"+ className="map-control-button show-legend"+ onClick={e => {+ e.preventDefault();+ toggleMenuPanel()+ }}+ >+ <Legend height="22px" />+ <MapLegendTooltip id="show-legend" message={'show legend'} />+ </StyledMapControlButton>+ ) : (+ <MapControlPanel+ header={'Layer Legend'}+ onClick={toggleMenuPanel}+ >+ <MapLegend+ layers={items.filter(item => item.isVisible).map(item => item.layer)}+ />+ </MapControlPanel>+ )+);++const LayerSelectorPanel = ({items, onMapToggleLayer, isActive, toggleMenuPanel}) => (+ !isActive ? (+ <StyledMapControlButton+ key={1}+ onClick={e => {+ e.preventDefault();+ toggleMenuPanel();+ }}+ className="map-control-button toggle-layer"+ data-tip+ data-for="toggle-layer"+ >+ <Layers height="22px"/>+ <MapLegendTooltip+ id="toggle-layer"+ message={isActive ? 'Hide layer panel' : 'Show layer panel'}+ />+ </StyledMapControlButton>+ ) : (+ <MapControlPanel+ header="Visible layers"+ onClick={toggleMenuPanel}+ >+ <MapLayerSelector layers={items} onMapToggleLayer={onMapToggleLayer} />+ </MapControlPanel>+ )+);+const ActionPanel = ({children}) => (<StyledMapControlAction>{children}</StyledMapControlAction>);diff --git a/src/components/map/map-legend.js b/src/components/map/map-legend.jsindex ff24e6bc5..10ad313a8 100644--- a/src/components/map/map-legend.js+++ b/src/components/map/map-legend.js@@ -130,7 +130,7 @@ const MapLegend = ({layers}) => (: [rgb(...layer.config.color).toString()]}width={- DIMENSIONS.mapControlWidth -+ DIMENSIONS.mapControl.width -2 * DIMENSIONS.mapControl.padding}/>diff --git a/src/components/modal-container.js b/src/components/modal-container.jsindex eb7470c42..1b29a3cdb 100644--- a/src/components/modal-container.js+++ b/src/components/modal-container.js@@ -121,23 +121,26 @@ export default function ModalContainerFactory(_onExportImage = () => {const {exporting, imageDataUri} = this.props.uiState.exportImage;if (!exporting && imageDataUri) {- const link = document.createElement('a');- link.download = DEFAULT_EXPORT_IMAGE_NAME;- link.href = imageDataUri;- link.click();+ this._downloadWithLink(imageDataUri, DEFAULT_EXPORT_IMAGE_NAME)}this.props.uiStateActions.cleanupExportImage();this._closeModal();};- _downloadFile(data, type, filename) {- const fileBlob = new Blob([data], {type});- const url = URL.createObjectURL(fileBlob);+ _downloadWithLink(href, filename) {const link = document.createElement('a');-- link.setAttribute('href', url);+ link.setAttribute('href', href);link.setAttribute('download', filename);++ document.body.appendChild(link);link.click();+ document.body.removeChild(link);+ }++ _downloadFile(data, type, filename) {+ const fileBlob = new Blob([data], {type});+ const url = URL.createObjectURL(fileBlob);+ this._downloadWithLink(url, filename);URL.revokeObjectURL(url);}diff --git a/src/components/modals/export-image-modal.js b/src/components/modals/export-image-modal.jsindex 1143f4b3f..10778d629 100644--- a/src/components/modals/export-image-modal.js+++ b/src/components/modals/export-image-modal.js@@ -30,6 +30,7 @@ import {} from 'constants/default-settings';import LoadingSpinner from 'components/common/loading-spinner';import {StyledModalContent} from 'components/common/styled-components';+import Switch from 'components/common/switch';const ImageOptionList = styled.div`display: flex;@@ -179,8 +180,11 @@ class ExportImageModal extends Component {</div><div className="image-option-section"><div className="image-option-section-title">Map Legend</div>- <input type="checkbox" disabled checked={legend} onClick={onToggleLegend}/>- Add legend on map+ <Switch type="checkbox"+ id="add-map-legend"+ checked={legend}+ label="Add legend on map"+ onChange={onToggleLegend}/></div></ImageOptionList><PreviewImageSection ratio={ratio} width={width} height={height}>diff --git a/src/components/plot-container.js b/src/components/plot-container.jsindex 56fa71e88..f6f0d185e 100644--- a/src/components/plot-container.js+++ b/src/components/plot-container.js@@ -21,10 +21,10 @@// librariesimport React, {Component} from 'react';import PropTypes from 'prop-types';-import {setTimeout} from 'global/window';+import styled from 'styled-components';+import throttle from 'lodash.throttle';import MapContainerFactory from './map-container';-import {RATIOS, WAIT_FOR_LOADING} from 'constants/default-settings';import {calculateExportImageSize, convertToPng} from 'utils/export-image-utils';const propTypes = {@@ -36,47 +36,54 @@ const propTypes = {PlotContainerFactory.deps = [MapContainerFactory];+const StyledPlotContainer = styled.div`+ .mapboxgl-ctrl-bottom-left,+ .mapboxgl-ctrl-bottom-right {+ display: none+ }+`;+export default function PlotContainerFactory(MapContainer) {class PlotContainer extends Component {-- componentDidMount() {- this._retrieveNewScreenshot();+ constructor(props) {+ super(props);+ this._onMapRender = throttle(this._onMapRender, 500);}componentWillReceiveProps(newProps) {// re-fetch the new screenshot only when ratio or resolution changesif (this.props.exportImageSetting.ratio !== newProps.exportImageSetting.ratio ||- this.props.exportImageSetting.resolution !== this.props.exportImageSetting.resolution+ this.props.exportImageSetting.resolution !== newProps.exportImageSetting.resolution ||+ this.props.exportImageSetting.legend !== newProps.exportImageSetting.legend) {this._retrieveNewScreenshot();}}+ _onMapRender = (map) => {+ if (map.isStyleLoaded()) {+ this._retrieveNewScreenshot();+ }+ };+_retrieveNewScreenshot = () => {- this.props.startExportingImage();- // Quick hack: wait for few seconds to load the map tiles and deck.gl layers.- // TODO: we should hook up with the map loaded event- // https://www.mapbox.com/mapbox-gl-js/api/#mapdataevent- // and the "onAfterRender" event from deck.gl- setTimeout(() => {+ if (this.plottingAreaRef) {+ this.props.startExportingImage();convertToPng(this.plottingAreaRef).then(dataUri => this.props.setExportImageDataUri({dataUri}));- }, WAIT_FOR_LOADING);+ }};render() {const {width, height, exportImageSetting, mapFields} = this.props;- const {ratio, resolution} = exportImageSetting;- // const {exportImageSetting} = exportImageSetting; <= not used yet.+ const {ratio, resolution, legend} = exportImageSetting;const exportImageSize = calculateExportImageSize({width, height, ratio, resolution});- const exportRatio = ratio === RATIOS.ONE_X ? 1 : 2;-- // TODO: should override the map style accoring to the exportRatio+ // TODO: should override the map style according to the resolutionconst mapboxStyle = mapFields.mapStyle;// figure out how to turn on legend through mapProps@@ -85,10 +92,18 @@ export default function PlotContainerFactory(MapContainer) {mapboxStyle,mapState: {...mapFields.mapState,- zoom: mapFields.mapState.zoom + Math.log2(exportRatio),+ // zoom: mapFields.mapState.zoom + Math.log2(exportRatio),+ zoom: mapFields.mapState.zoom,width: exportImageSize.width,height: exportImageSize.height},+ mapControls: {+ // override map legend visibility+ mapLegend: {+ show: legend,+ active: true+ }+ },mapStateActions: {...mapFields.mapStateActions,updateMap: () => {}@@ -96,7 +111,7 @@ export default function PlotContainerFactory(MapContainer) {};return (- <div style={{position: 'absolute', top: -9999, left: -9999}}>+ <StyledPlotContainer style={{position: 'absolute', top: -9999, left: -9999}}><divref={element => {this.plottingAreaRef = element}}style={{@@ -106,10 +121,11 @@ export default function PlotContainerFactory(MapContainer) {><MapContainerindex={0}+ onMapRender={this._onMapRender}{...mapProps}/></div>- </div>+ </StyledPlotContainer>);}}diff --git a/src/constants/action-types.js b/src/constants/action-types.jsindex 0bfd2a34d..4fd8b8cf3 100644--- a/src/constants/action-types.js+++ b/src/constants/action-types.js@@ -73,8 +73,9 @@ const ActionTypes = keyMirror({TOGGLE_SIDE_PANEL: null,TOGGLE_MODAL: null,OPEN_DELETE_MODAL: null,+ TOGGLE_MAP_CONTROL: null,- // export image modal ui state+ // uiState > export imageSET_RATIO: null,SET_RESOLUTION: null,TOGGLE_LEGEND: null,@@ -82,7 +83,7 @@ const ActionTypes = keyMirror({SET_EXPORT_IMAGE_DATA_URI: null,CLEANUP_EXPORT_IMAGE: null,- // export data modal ui state+ // uiState > export dataSET_EXPORT_SELECTED_DATASET: null,SET_EXPORT_DATA_TYPE: null,SET_EXPORT_FILTERED: null,diff --git a/src/constants/default-settings.js b/src/constants/default-settings.jsindex 902e260b2..e87eb9478 100644--- a/src/constants/default-settings.js+++ b/src/constants/default-settings.js@@ -486,8 +486,6 @@ export const RESOLUTION_OPTIONS = [{export const DEFAULT_EXPORT_IMAGE_NAME = 'kepler-gl.png';-export const WAIT_FOR_LOADING = 1200;-export const EXPORT_DATA_TYPE = keyMirror({CSV: null// SHAPEFILE: null,diff --git a/src/reducers/ui-state-updaters.js b/src/reducers/ui-state-updaters.jsindex b4992ba2d..e86489937 100644--- a/src/reducers/ui-state-updaters.js+++ b/src/reducers/ui-state-updaters.js@@ -44,6 +44,17 @@ export const toggleModalUpdater = (state, {payload: id}) => ({currentModal: id});+export const toggleMapControlUpdater = (state, {payload: panelId}) => ({+ ...state,+ mapControls: {+ ...state.mapControls,+ [panelId]: {+ ...state.mapControls[panelId],+ active: !state.mapControls[panelId].active+ }+ }+});+export const openDeleteModalUpdater = (state,{payload: datasetKeyToRemove}@@ -57,7 +68,7 @@ export const toggleLegendUpdater = state => ({...state,exportImage: {...state.exportImage,- legend: !state.legend+ legend: !state.exportImage.legend}});diff --git a/src/reducers/ui-state.js b/src/reducers/ui-state.jsindex a8b104648..12b24052e 100644--- a/src/reducers/ui-state.js+++ b/src/reducers/ui-state.js@@ -30,7 +30,9 @@ import {openDeleteModalUpdater,toggleModalUpdater,toggleSidePanelUpdater,- // export image+ toggleMapControlUpdater,++ // export imagecleanupExportImage,setExportImageDataUri,setRatioUpdater,@@ -44,35 +46,62 @@ import {setExportConfigUpdater} from './ui-state-updaters';+export const DEFAULT_ACTIVE_SIDE_PANEL = 'layer';+export const DEFAULT_MODAL = ADD_DATA_ID;++export const DEFAULT_MAP_CONTROLS = {+ visibleLayers: {+ show: true,+ active: false+ },+ mapLegend: {+ show: true,+ active: false+ },+ toggle3d: {+ show: true+ },+ splitMap: {+ show: true+ }+};++export const DEFAULT_EXPORT_IMAGE = {+ // user options+ ratio: RATIOS.SCREEN,+ resolution: RESOLUTIONS.ONE_X,+ legend: false,+ // exporting state+ imageDataUri: '',+ exporting: false+};++export const DEFAULT_EXPORT_DATA = {+ selectedDataset: '',+ dataType: EXPORT_DATA_TYPE.CSV,+ filtered: true,+ config: true+};+export const INITIAL_UI_STATE = {readOnly: false,- activeSidePanel: 'layer',- currentModal: ADD_DATA_ID,+ activeSidePanel: DEFAULT_ACTIVE_SIDE_PANEL,+ currentModal: DEFAULT_MODAL,datasetKeyToRemove: null,// export image modal ui- exportImage: {- // user options- ratio: RATIOS.SCREEN,- resolution: RESOLUTIONS.ONE_X,- legend: false,- // exporting state- imageDataUri: '',- exporting: false- },+ exportImage: DEFAULT_EXPORT_IMAGE,// export data modal ui- exportData: {- selectedDataset: '',- dataType: EXPORT_DATA_TYPE.CSV,- filtered: true,- config: true- }+ exportData: DEFAULT_EXPORT_DATA,+ // map control panels+ mapControls: DEFAULT_MAP_CONTROLS};const actionHandler = {[ActionTypes.TOGGLE_SIDE_PANEL]: toggleSidePanelUpdater,[ActionTypes.TOGGLE_MODAL]: toggleModalUpdater,[ActionTypes.OPEN_DELETE_MODAL]: openDeleteModalUpdater,+ [ActionTypes.TOGGLE_MAP_CONTROL]: toggleMapControlUpdater,[ActionTypes.SET_RATIO]: setRatioUpdater,[ActionTypes.SET_RESOLUTION]: setResolutionUpdater,diff --git a/src/styles/base.js b/src/styles/base.jsindex cf01c89cb..5bbf09590 100644--- a/src/styles/base.js+++ b/src/styles/base.js@@ -551,7 +551,7 @@ const dropdownListSection = css``;const dropdownList = css`- overflow-y: scroll;+ overflow-y: auto;max-height: 280px;box-shadow: ${props => props.theme.dropdownListShadow};border-radius: 2px;diff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.jsindex 1b3f14263..2043e8240 100644--- a/test/node/reducers/ui-state-test.js+++ b/test/node/reducers/ui-state-test.js@@ -27,6 +27,7 @@ import {setResolution,setRatio,toggleLegend,+ toggleMapControl,setExportSelectedDataset,setExportDataType,setExportFiltered@@ -158,6 +159,26 @@ test('#uiStateReducer -> TOGGLE_LEGEND', t => {t.end();});+test('#uiStateReducer -> TOGGLE_MAP_CONTROL', t => {++ const newReducer = reducer(INITIAL_UI_STATE, toggleMapControl('mapLegend'));++ const expectedState = {+ ...INITIAL_UI_STATE,+ mapControls: {+ ...INITIAL_UI_STATE.mapControls,+ mapLegend: {+ show: INITIAL_UI_STATE.mapControls.mapLegend.show,+ active: !INITIAL_UI_STATE.mapControls.mapLegend.active+ },+ }+ };++ t.deepEqual(newReducer, expectedState, 'should set map legend to be seen');++ t.end();+});+test('#uiStateReducer -> SET_EXPORT_SELECTED_DATASET', t => {const newReducer = reducer(INITIAL_UI_STATE, setExportSelectedDataset({dataset: 'a'}));diff --git a/yarn.lock b/yarn.lockindex 58d8561a9..53badbd08 100644--- a/yarn.lock+++ b/yarn.lock@@ -2461,9 +2461,9 @@ dom-serializer@0, dom-serializer@~0.1.0:domelementtype "~1.1.1"entities "~1.1.1"-dom-to-image@^2.6.0:+"dom-to-image@github:heshan0131/dom-to-image":version "2.6.0"- resolved "https://registry.yarnpkg.com/dom-to-image/-/dom-to-image-2.6.0.tgz#8a503608088c87b1c22f9034ae032e1898955867"+ resolved "https://codeload.github.com/heshan0131/dom-to-image/tar.gz/f125ad908824ca31f00aea4dc02c552f0b4a7595"dom-walk@^0.1.0:version "0.1.1"