From 3809308edb01640f64d446338b00c1b68bd2b174 Mon Sep 17 00:00:00 2001 From: Suren Date: Wed, 20 Dec 2023 19:03:38 +0530 Subject: [PATCH 1/2] #9840: StreetView plugin ability to set parameters for the default size of panel --- web/client/plugins/StreetView/StreetView.jsx | 5 +++-- .../plugins/StreetView/components/EmptyStreetView.js | 10 +++++++++- .../StreetView/containers/StreetViewContainer.jsx | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/web/client/plugins/StreetView/StreetView.jsx b/web/client/plugins/StreetView/StreetView.jsx index cd14a73602..28d6248a77 100644 --- a/web/client/plugins/StreetView/StreetView.jsx +++ b/web/client/plugins/StreetView/StreetView.jsx @@ -20,14 +20,14 @@ import streetView from './reducers/streetview'; import * as epics from './epics/streetView'; import './css/style.css'; -const StreetViewPluginComponent = ({onMount, onUnmount, apiKey, useDataLayer, dataLayerConfig, panoramaOptions}) => { +const StreetViewPluginComponent = ({onMount, onUnmount, apiKey, useDataLayer, dataLayerConfig, panoramaOptions, panelSize}) => { useEffect(() => { onMount({apiKey, useDataLayer, dataLayerConfig, panoramaOptions}); return () => { onUnmount(); }; }, [apiKey, useDataLayer, dataLayerConfig, JSON.stringify(panoramaOptions ?? {})]); - return ; + return ; }; const StreetViewPluginContainer = connect(() => ({}), { @@ -49,6 +49,7 @@ const StreetViewPluginContainer = connect(() => ({}), { * @property {boolean} [cfg.useDataLayer=true] If true, adds to the map a layer for street view data availability when the plugin is turned on. * @property {object} [cfg.dataLayerConfig] configuration for the data layer. By default `{provider: 'custom', type: "tileprovider", url: "https://mts1.googleapis.com/vt?hl=en-US&lyrs=svv|cb_client:apiv3&style=40,18&x={x}&y={y}&z={z}"}` * @property {object} [cfg.panoramaOptions] options to configure the panorama. {@link https://developers.google.com/maps/documentation/javascript/reference/street-view#panoramaOptions|Reference for google maps API} + * @property {object} [cfg.panelSize] option to configure default street view modal panel size i.e `width` and `height` * @class */ export default createPlugin( diff --git a/web/client/plugins/StreetView/components/EmptyStreetView.js b/web/client/plugins/StreetView/components/EmptyStreetView.js index 15342be693..71053aec61 100644 --- a/web/client/plugins/StreetView/components/EmptyStreetView.js +++ b/web/client/plugins/StreetView/components/EmptyStreetView.js @@ -3,6 +3,14 @@ import Message from '../../../components/I18N/Message'; import EmptyView from '../../../components/misc/EmptyView'; const EmptyStreetView = () => { - return } description={} />; + return ( + } + description={} + /> + ); }; export default EmptyStreetView; diff --git a/web/client/plugins/StreetView/containers/StreetViewContainer.jsx b/web/client/plugins/StreetView/containers/StreetViewContainer.jsx index 3eceec6b88..a17eb42ecf 100644 --- a/web/client/plugins/StreetView/containers/StreetViewContainer.jsx +++ b/web/client/plugins/StreetView/containers/StreetViewContainer.jsx @@ -17,9 +17,9 @@ import { toggleStreetView } from '../actions/streetView'; * @param {*} param0 * @returns */ -function Panel({enabled, onClose = () => {}}) { +function Panel({enabled, onClose = () => {}, panelSize}) { const margin = 10; - const [size, setSize] = useState({width: 400, height: 300}); + const [size, setSize] = useState({width: 400, height: 300, ...panelSize}); if (!enabled) { return null; } From 76b0d5bbc3cc0e9924cf7f1f8650934a83feba02 Mon Sep 17 00:00:00 2001 From: Lorenzo Natali Date: Mon, 8 Jan 2024 12:34:08 +0100 Subject: [PATCH 2/2] Update web/client/plugins/StreetView/StreetView.jsx --- web/client/plugins/StreetView/StreetView.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/plugins/StreetView/StreetView.jsx b/web/client/plugins/StreetView/StreetView.jsx index 28d6248a77..8a9e795ca8 100644 --- a/web/client/plugins/StreetView/StreetView.jsx +++ b/web/client/plugins/StreetView/StreetView.jsx @@ -49,7 +49,7 @@ const StreetViewPluginContainer = connect(() => ({}), { * @property {boolean} [cfg.useDataLayer=true] If true, adds to the map a layer for street view data availability when the plugin is turned on. * @property {object} [cfg.dataLayerConfig] configuration for the data layer. By default `{provider: 'custom', type: "tileprovider", url: "https://mts1.googleapis.com/vt?hl=en-US&lyrs=svv|cb_client:apiv3&style=40,18&x={x}&y={y}&z={z}"}` * @property {object} [cfg.panoramaOptions] options to configure the panorama. {@link https://developers.google.com/maps/documentation/javascript/reference/street-view#panoramaOptions|Reference for google maps API} - * @property {object} [cfg.panelSize] option to configure default street view modal panel size i.e `width` and `height` + * @property {object} [cfg.panelSize] option to configure default street view modal panel size `width` and `height`. Example: `{"width": 500, "height": 500}`. * @class */ export default createPlugin(