Skip to content

Commit

Permalink
Merge pull request #2744 from DenverCoder544/maprotator_state_restore
Browse files Browse the repository at this point in the history
fix storing the map rotation in publisher
  • Loading branch information
ZakarFin authored Nov 26, 2024
2 parents fb48721 + a69ce86 commit db2793f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion bundles/mapping/maprotator/publisher/MapRotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,27 @@ class MapRotatorTool extends AbstractPublisherTool {
}

// saved configuration -> restore.
const conf = data.configuration[this.bundleName].conf || {};
const bundleData = data.configuration[this.bundleName];
const conf = bundleData?.conf || {};
this.handler.init(conf);
this.storePluginConf(conf);
this.storePluginState(bundleData?.state || {});
this.setEnabled(true);
}

storePluginState (state) {
this.state.pluginState = state || {};
}

setEnabled (enabled) {
super.setEnabled(enabled);
if (enabled && this.state.pluginState?.degrees) {
this.getPlugin().setRotation(this.state.pluginState?.degrees);
} else {
this.getMapmodule().getMap().getView().setRotation(0);
}
}

isDisplayed () {
// shouldn't be shown if bundle is not started
// otherwise results in js errors
Expand Down

0 comments on commit db2793f

Please sign in to comment.