kepler.gl
kepler.gl copied to clipboard
[Enhancemen] Export Map (maplegend and locale) as HTML
This PR is for the issue https://github.com/keplergl/kepler.gl/issues/1585 (display map legend on an exported map). There is a workaround for this issue that requires user to update the exported HTML file. However, this seems like a reasonable feature enhancement request for the “Export Map as HTML” feature:
- when exporting a map to a HTML file, uiState of mapLegend and map locale should be saved in config.
- when loading config via
addDataToMapUpdater()
, the uiState of mapLegend and map locale should be loaded and used as default.
What's added and changed in this PR:
-
Add a new
uiStateSchema
class in src/schemas/ui-state-schema.js -
Add above
uiStateSchema
inreducerSchema
in src/schemas/schema-manager.js, so the meta data oflocale
andmapControls:mapLegend
inuiState
can be saved and loaded via Schema Manager -
Since the mapLegend and locale in uiState can be added in JSON configuration, the
addDataToMap
action should be updated (src/reducers/combined-updaters.js) so customizedmapLegend
(on/off) andlocale
can be loaded as default. -
Test case
#uiStateSchema -> v1 -> save load uiState
in test/node/schemas/ui-state-schema-test.js -
Test case
#composerStateReducer - addDataToMapUpdater: mapLegend
in test/node/reducers/composer-state-test.js -
Test case
#composerStateReducer - addDataToMapUpdater: locale
in test/node/reducers/composer-state-test.js
Example: an exported map with Legend
switched ON and locale
with Spanish(ES)