-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Enhancemen] Export Map (maplegend and locale) as HTML #1598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1. when exporting map to a HTML file, uiState of mapLegend and map locale should be saved in config. 2. when loading config via `addDataToMapUpdater()`, the uiState of mapLegend and map locale should be loaded and used as default. Signed-off-by: Xun Li <[email protected]>
Signed-off-by: Xun Li <[email protected]>
36fe2b4
to
f25f660
Compare
src/reducers/combined-updaters.js
Outdated
@@ -170,6 +178,18 @@ export const addDataToMapUpdater = (state, {payload}) => { | |||
|
|||
pick_('uiState')(apply_(toggleModalUpdater, payload_(null))), | |||
|
|||
if_( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stead of directly call pick_('uiState')
in combined updaters, you should add a receiveMapConfigUpdater
to ui-state-updaters
, and import it here, call it with
import {receiveMapConfigUpdater as uiStateReceiveMapConfigUpdater} from './map-style-updaters';
...
pick_('mapStyle')(apply_(styleMapConfigUpdater, payload_({config: parsedConfig, options}))),
pick_('uiState')(apply_(uiStateReceiveMapConfigUpdater, payload_({config: parsedConfig, options}))),
pick_('uiState')(apply_(uiStateLoadFilesSuccessUpdater, payload_(null))),
we have receiveMapConfigUpdater
in each of the sub-reducers, to handle merging config into state. We should follow the pattern with uiState too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @heshan0131! I added receiveMapConfigUpdater
in ui-state-updaters
, specifically for 'mapLegend' and 'locale'. Are there any other things I should consider in this function when merging received uistate? Thanks!
Instead of directly call pick_('uiState') in combined updaters, adding `receiveMapConfigUpdater` in ui-state-updaters to merge received uistate (specifically mapLegend and mapLocale) with previous state Signed-off-by: Xun Li <[email protected]>
8617582
to
2714e56
Compare
…hould be set with mapLegend being displayed by default Signed-off-by: Xun Li <[email protected]>
This PR is for the issue #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:
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.jsAdd above
uiStateSchema
inreducerSchema
in src/schemas/schema-manager.js, so the meta data oflocale
andmapControls:mapLegend
inuiState
can be saved and loaded via Schema ManagerSince 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.jsTest case
#composerStateReducer - addDataToMapUpdater: mapLegend
in test/node/reducers/composer-state-test.jsTest case
#composerStateReducer - addDataToMapUpdater: locale
in test/node/reducers/composer-state-test.jsExample: an exported map with

Legend
switched ON andlocale
with Spanish(ES)