Skip to content

Commit

Permalink
geosolutions-it#9840: StreetView plugin ability to set parameters for…
Browse files Browse the repository at this point in the history
… the default size of panel (geosolutions-it#9842)
  • Loading branch information
dsuren1 authored Jan 8, 2024
1 parent b91cd22 commit 0be639d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions web/client/plugins/StreetView/StreetView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <StreetViewContainer />;
return <StreetViewContainer panelSize={panelSize} />;
};

const StreetViewPluginContainer = connect(() => ({}), {
Expand All @@ -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 `width` and `height`. Example: `{"width": 500, "height": 500}`.
* @class
*/
export default createPlugin(
Expand Down
10 changes: 9 additions & 1 deletion web/client/plugins/StreetView/components/EmptyStreetView.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ import Message from '../../../components/I18N/Message';

import EmptyView from '../../../components/misc/EmptyView';
const EmptyStreetView = () => {
return <EmptyView iconFit={false} glyph="road" title={<Message msgId="streetView.emptyTitle"/>} description={<Message msgId="streetView.emptyDescription"/>} />;
return (
<EmptyView
style={{display: "flex", justifyContent: "center"}}
iconFit={false}
glyph="road"
title={<Message msgId="streetView.emptyTitle"/>}
description={<Message msgId="streetView.emptyDescription"/>}
/>
);
};
export default EmptyStreetView;
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0be639d

Please sign in to comment.