Skip to content

Commit

Permalink
feat(StreetViewPanorama): add OverlayView to example
Browse files Browse the repository at this point in the history
  • Loading branch information
novascreen authored and Thomas Hermann committed Jun 1, 2017
1 parent eb86d7e commit 7bd8c76
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/app/pages/basics/StreetViewPanoramaExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@ import {
withGoogleMap,
GoogleMap,
StreetViewPanorama,
OverlayView,
} from "../../../lib";

const coordinates = { lat: 49.2853171, lng: -123.1119202 };

const STYLES = {
overlayView: {
background: `red`,
color: `white`,
padding: 5,
borderRadius: `50%`,
},
};

function getPixelPositionOffset(width, height) {
return { x: -(width / 2), y: -(height / 2) };
}

const StreetViewPanoramaExampleGoogleMap = withGoogleMap(props => (
<GoogleMap
defaultZoom={8}
Expand All @@ -20,7 +34,17 @@ const StreetViewPanoramaExampleGoogleMap = withGoogleMap(props => (
<StreetViewPanorama
defaultPosition={coordinates}
visible
/>
>
<OverlayView
position={{ lat: 49.28590291211115, lng: -123.11248166065218 }}
mapPaneName={OverlayView.OVERLAY_LAYER}
getPixelPositionOffset={getPixelPositionOffset}
>
<div style={STYLES.overlayView}>
OverlayView
</div>
</OverlayView>
</StreetViewPanorama>
</GoogleMap>
));

Expand All @@ -44,7 +68,7 @@ export default class StreetViewPanoramaExample extends Component {
return (
<StreetViewPanoramaExampleGoogleMap
containerElement={
<div style={{ width: `100%`, height: `50%` }} />
<div style={{ width: `100%`, height: `100%` }} />
}
mapElement={
<div style={{ width: `100%`, height: `100%` }} />
Expand Down

0 comments on commit 7bd8c76

Please sign in to comment.