import { PanelRow, Dropdown, Button, BaseControl, TextControl, RangeControl } from '@wordpress/components'; import { MapSettings } from '../types'; import { useState } from 'react'; const streetview = function ({ attributes, setAttributes }: { attributes: MapSettings, setAttributes: (atts: Partial) => void }) { const [panoramaUrl, setPanoramaUrl] = useState(""); const panoramaIdFinder =

How to find the ID of a Google Maps panorama:

  1. Open the panorama within Google Maps in a web browser.
  2. Copy the URL of the page and paste it into the text Panorama URL input below.
  3. The panorama's ID will appear in the Panorama ID input below.
setPanoramaUrl( url ) } /> {} } />
; return ( <> The longitude and latitude respectively of the location of the street view. Open Google Maps and right click on any point to see its coordinates in decimal format. } id="location-control" >
setAttributes({ location: `${event.target.value},${parseFloat(attributes.location.split(',')[1])}` }) } type="number" step={0.00001} min={-90} max={90} style={{ display: 'block', width: '100%', borderRadius: '2px' }} /> setAttributes({ location: `${parseFloat(attributes.location.split(',')[0])},${event.target.value}` }) } type="number" step={0.00001} min={-180} max={180} style={{ display: 'block', width: '100%', borderRadius: '2px' }} />

The ID of a specific Google Maps panorama. If you specify a panorama ID you may also specify a location. The location will be only be used if the API cannot find the panorama ID.

( ) } renderContent={ () => panoramaIdFinder } /> } value={ attributes.pano } onChange={ ( pano ) => setAttributes({ pano }) } />
setAttributes({ heading }) } min={ -180 } max={ 360 } /> setAttributes({ pitch }) } min={ -90 } max={ 90 } /> setAttributes({ fov }) } min={ 10 } max={ 100 } /> ); }; export default streetview;