From 62b87241c1e8e8f70aea6188c4add85a30b7dc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:39:50 +0200 Subject: [PATCH 1/7] add option to disable automatic zoom --- plugins/Routing.jsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 93aa238c1..d6ec51bf0 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -60,6 +60,8 @@ class Routing extends React.Component { initiallyDocked: PropTypes.bool, side: PropTypes.string }), + /** Automatic zoom to the extent of the location. */ + zoomAuto: PropTypes.bool, layers: PropTypes.array, locatePos: PropTypes.array, mapcrs: PropTypes.string, @@ -83,6 +85,7 @@ class Routing extends React.Component { initiallyDocked: true, side: 'left' }, + zoomAuto: true, showPinLabels: true }; state = { @@ -766,7 +769,9 @@ class Routing extends React.Component { }); this.updateRouteConfig({points: reorderedPoints, result: {success, data: result}, busy: false}, false); - this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -1); + if (this.props.zoomAuto) { + this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -0.5); + } } else { this.updateRouteConfig({result: {success, data: result}, busy: false}, false); } @@ -807,7 +812,9 @@ class Routing extends React.Component { } })); this.props.addLayerFeatures(layer, features, true); - this.props.zoomToExtent(result.bounds, "EPSG:4326", -0.5); + if (this.props.zoomAuto) { + this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -0.5); + } } this.updateIsoConfig({result: {success, data: result}, busy: false}, false); }); From 182882f4b66e15fed0e1f9fc7d07ac465fe28aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:51:57 +0200 Subject: [PATCH 2/7] Update Routing.jsx --- plugins/Routing.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index d6ec51bf0..4caea6a29 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -770,7 +770,7 @@ class Routing extends React.Component { this.updateRouteConfig({points: reorderedPoints, result: {success, data: result}, busy: false}, false); if (this.props.zoomAuto) { - this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -0.5); + this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -1); } } else { this.updateRouteConfig({result: {success, data: result}, busy: false}, false); From c84f75d3bebd35278b50aafd398857824a868b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 09:53:47 +0200 Subject: [PATCH 3/7] Update Routing.jsx --- plugins/Routing.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 4caea6a29..8308dd967 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -813,7 +813,7 @@ class Routing extends React.Component { })); this.props.addLayerFeatures(layer, features, true); if (this.props.zoomAuto) { - this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -0.5); + this.props.zoomToExtent(result.bounds, "EPSG:4326", -0.5); } } this.updateIsoConfig({result: {success, data: result}, busy: false}, false); From da22ee56e3bd38dc065e4d75f01154ad7299b3ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:00:40 +0200 Subject: [PATCH 4/7] Update Routing.jsx --- plugins/Routing.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 8308dd967..5e0e66718 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -771,7 +771,7 @@ class Routing extends React.Component { if (this.props.zoomAuto) { this.props.zoomToExtent(result.summary.bounds, "EPSG:4326", -1); - } + } } else { this.updateRouteConfig({result: {success, data: result}, busy: false}, false); } @@ -814,7 +814,7 @@ class Routing extends React.Component { this.props.addLayerFeatures(layer, features, true); if (this.props.zoomAuto) { this.props.zoomToExtent(result.bounds, "EPSG:4326", -0.5); - } + } } this.updateIsoConfig({result: {success, data: result}, busy: false}, false); }); From fd17f7a613c3e6085be9805839244f882c33d865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:08:36 +0200 Subject: [PATCH 5/7] Update Routing.jsx --- plugins/Routing.jsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 5e0e66718..37e8b2b9b 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -60,8 +60,6 @@ class Routing extends React.Component { initiallyDocked: PropTypes.bool, side: PropTypes.string }), - /** Automatic zoom to the extent of the location. */ - zoomAuto: PropTypes.bool, layers: PropTypes.array, locatePos: PropTypes.array, mapcrs: PropTypes.string, @@ -72,7 +70,10 @@ class Routing extends React.Component { showPinLabels: PropTypes.bool, task: PropTypes.object, theme: PropTypes.object, + /** Automatically zoom to the extent of the route */ + zoomAuto: PropTypes.bool, zoomToExtent: PropTypes.func + }; static defaultProps = { enabledModes: ["auto", "heavyvehicle", "transit", "bicycle", "pedestrian"], @@ -85,8 +86,8 @@ class Routing extends React.Component { initiallyDocked: true, side: 'left' }, + showPinLabels: true, zoomAuto: true, - showPinLabels: true }; state = { visible: false, From bbef321004bbc261ab665a9d7fe3397fc51eba52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:09:11 +0200 Subject: [PATCH 6/7] Update Routing.jsx --- plugins/Routing.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 37e8b2b9b..50e553fb8 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -87,7 +87,7 @@ class Routing extends React.Component { side: 'left' }, showPinLabels: true, - zoomAuto: true, + zoomAuto: true }; state = { visible: false, From 0f4ec009128a0543dab6079fdde18fe13ac0f29f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Zitouni?= <92778930+cazitouni@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:11:35 +0200 Subject: [PATCH 7/7] Update Routing.jsx --- plugins/Routing.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/Routing.jsx b/plugins/Routing.jsx index 50e553fb8..0177aa185 100644 --- a/plugins/Routing.jsx +++ b/plugins/Routing.jsx @@ -73,7 +73,6 @@ class Routing extends React.Component { /** Automatically zoom to the extent of the route */ zoomAuto: PropTypes.bool, zoomToExtent: PropTypes.func - }; static defaultProps = { enabledModes: ["auto", "heavyvehicle", "transit", "bicycle", "pedestrian"],