18 lines
614 B
JavaScript
18 lines
614 B
JavaScript
// utils/polylines/polylineSubscription.js
|
|
import { store } from "../../redux/store";
|
|
import { closePolylineContextMenu } from "../../redux/slices/polylineContextMenuSlice";
|
|
|
|
export function subscribeToPolylineContextMenu() {
|
|
store.subscribe(() => {
|
|
const state = store.getState(); // Redux-Toolkit empfohlene Methode
|
|
if (state.polylineContextMenu.forceClose) {
|
|
console.log("🚀 Redux-Event erkannt - Kontextmenü wird geschlossen.");
|
|
store.dispatch(closePolylineContextMenu());
|
|
|
|
if (window.map && window.map.contextmenu) {
|
|
window.map.contextmenu.hide();
|
|
}
|
|
}
|
|
});
|
|
}
|