From 40e44d755b2ba501e30006318744bc6aa3743eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Jyrki=C3=A4inen?= Date: Mon, 27 Apr 2026 11:51:56 +0300 Subject: [PATCH 1/4] EditLinkLayer marker dragging safe guarded --- .../map/layers/edit/EditLinkLayer.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/map/layers/edit/EditLinkLayer.tsx b/src/components/map/layers/edit/EditLinkLayer.tsx index 681ff225e..d09e8d954 100644 --- a/src/components/map/layers/edit/EditLinkLayer.tsx +++ b/src/components/map/layers/edit/EditLinkLayer.tsx @@ -109,12 +109,23 @@ const EditLinkLayer = inject( const coordsToDisable = [coords[0], coords[coords.length - 1]]; coordsToDisable.forEach((coordToDisable: any) => { const vertexMarker = coordToDisable.__vertex; - vertexMarker.dragging.disable(); - vertexMarker._events.click = {}; - vertexMarker.setOpacity(0); + + if (!vertexMarker) return; + + if (vertexMarker.dragging) { + vertexMarker.dragging.disable(); + } + + if (vertexMarker.off) { + vertexMarker.off('click'); + } else if (vertexMarker._events) { + vertexMarker._events.click = {}; + } + + vertexMarker.setOpacity?.(0); // Put vertex marker z-index low so that it // would be below other layers that needs to be clickable - vertexMarker.setZIndexOffset(-1000); + vertexMarker.setZIndexOffset?.(-1000); }); } setSelectedLinks([selectedLink]); From e454173578092f6379b27e1ce196eb8eff6da020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Jyrki=C3=A4inen?= Date: Mon, 27 Apr 2026 15:42:14 +0300 Subject: [PATCH 2/4] routePathLinksTab scrollIntoListItem refactor --- .../routePathListTab/RoutePathLinksTab.tsx | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/components/sidebar/routePathView/routePathListTab/RoutePathLinksTab.tsx b/src/components/sidebar/routePathView/routePathListTab/RoutePathLinksTab.tsx index 7fe8dd7a3..a8bc498eb 100644 --- a/src/components/sidebar/routePathView/routePathListTab/RoutePathLinksTab.tsx +++ b/src/components/sidebar/routePathView/routePathListTab/RoutePathLinksTab.tsx @@ -74,16 +74,18 @@ class RoutePathLinksTab extends React.Component { }; private scrollIntoListItem = (listItemId: string) => { - // Next tick is needed because this way the possible previously opened item gets closed before the next one gets opened - process.nextTick(() => { - const item = this.listObjectReferences[listItemId]; - if (item && item.current) { - item.current.scrollIntoView({ - inline: 'start', - block: 'start', - behavior: 'smooth', - }); - } + window.requestAnimationFrame(() => { + window.requestAnimationFrame(() => { + const item = this.listObjectReferences[listItemId]; + + if (item && item.current) { + item.current.scrollIntoView({ + inline: 'start', + block: 'start', + behavior: 'smooth', + }); + } + }); }); }; From b39d350af3766af7295119bc1cf92f5eb399a5ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Jyrki=C3=A4inen?= Date: Tue, 28 Apr 2026 19:10:05 +0300 Subject: [PATCH 3/4] debug logging --- src/components/map/toolbar/Toolbar.tsx | 1 + src/components/map/toolbar/ToolbarCommonButtons.tsx | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/map/toolbar/Toolbar.tsx b/src/components/map/toolbar/Toolbar.tsx index 02e4213ed..171b60056 100644 --- a/src/components/map/toolbar/Toolbar.tsx +++ b/src/components/map/toolbar/Toolbar.tsx @@ -15,6 +15,7 @@ import UndoButtons from './undoButtons'; class Toolbar extends React.Component { private renderViewSpecificTools = () => { if (!LoginStore!.hasWriteAccess) return null; + console.log(navigator.getPathName()); if (matchPath(navigator.getPathName(), SubSites.routePath)) { return this.renderToolbarBlock([, ]); } diff --git a/src/components/map/toolbar/ToolbarCommonButtons.tsx b/src/components/map/toolbar/ToolbarCommonButtons.tsx index bb1c072d5..1395e21fd 100644 --- a/src/components/map/toolbar/ToolbarCommonButtons.tsx +++ b/src/components/map/toolbar/ToolbarCommonButtons.tsx @@ -25,6 +25,7 @@ class ToolbarCommonButtons extends React.Component { }; render() { + console.log(this.props.hasWriteAccess); return ( <> {this.props.hasWriteAccess && ( From 5c59eafe7f9e9e8a9b6357505c19840fdc689399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Jyrki=C3=A4inen?= Date: Tue, 28 Apr 2026 19:36:51 +0300 Subject: [PATCH 4/4] testing map toolbar fixes --- src/components/map/Map.tsx | 8 ++++---- src/components/map/toolbar/Toolbar.tsx | 16 ++++++++++------ 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/components/map/Map.tsx b/src/components/map/Map.tsx index 53676feaa..05d2b1d6b 100644 --- a/src/components/map/Map.tsx +++ b/src/components/map/Map.tsx @@ -30,8 +30,9 @@ import MapLayersControl from './mapControls/MapLayersControl'; import MapLayersZoomHint from './mapControls/MapLayersZoomHint'; import MeasurementControl from './mapControls/MeasurementControl'; import Toolbar from './toolbar/Toolbar'; +import { RouteComponentProps, withRouter } from 'react-router'; -interface IMapProps { +interface IMapProps extends RouteComponentProps { mapStore?: MapStore; routeListStore?: RouteListStore; nodeStore?: NodeStore; @@ -197,7 +198,7 @@ class LeafletMap extends React.Component {
- +
@@ -225,6 +226,5 @@ class LeafletMap extends React.Component { } } -export default LeafletMap; - +export default withRouter(LeafletMap); export { LeafletContext }; diff --git a/src/components/map/toolbar/Toolbar.tsx b/src/components/map/toolbar/Toolbar.tsx index 171b60056..0551b83c8 100644 --- a/src/components/map/toolbar/Toolbar.tsx +++ b/src/components/map/toolbar/Toolbar.tsx @@ -1,7 +1,6 @@ import { observer } from 'mobx-react'; import React from 'react'; import { matchPath } from 'react-router'; -import navigator from '~/routing/navigator'; import SubSites from '~/routing/subSites'; import LoginStore from '~/stores/loginStore'; import ToolbarCommonButtons from './ToolbarCommonButtons'; @@ -11,18 +10,23 @@ import LinkButtons from './toolbarLinkButtons'; import RoutePathButtons from './toolbarRoutePathButtons'; import UndoButtons from './undoButtons'; +interface IToolbarProps { + pathname: string; +} + @observer -class Toolbar extends React.Component { +class Toolbar extends React.Component { private renderViewSpecificTools = () => { if (!LoginStore!.hasWriteAccess) return null; - console.log(navigator.getPathName()); - if (matchPath(navigator.getPathName(), SubSites.routePath)) { + const pathname = this.props.pathname; + console.log(pathname); + if (matchPath(pathname, SubSites.routePath)) { return this.renderToolbarBlock([, ]); } - if (matchPath(navigator.getPathName(), SubSites.link)) { + if (matchPath(pathname, SubSites.link)) { return this.renderToolbarBlock([, ]); } - if (matchPath(navigator.getPathName(), SubSites.node)) { + if (matchPath(pathname, SubSites.node)) { return this.renderToolbarBlock([]); } return null;