feat(google-maps): Adding a streetview component
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### Feature Description
Thanks for the awesome `google-maps` package! It abstracts away most of the gmaps logic that we heavily make use of in our apps.
But we're still missing one more functionality, namely an ng-like wrapper around the streetview panorama.
An ideal `map-streetview` component could go something like this:
```html
```
The (optional) `@Input() map` would be the map that [allows binding to external panoramas](https://github.com/googlemaps/js-types/blob/main/index.d.ts#L4210).
The (optional) `@Input overlays` would [support native gmaps overlays](https://developers.google.com/maps/documentation/javascript/streetview#StreetViewOverlays) but ideally also this package's [`map-marker`](https://github.com/angular/components/tree/main/src/google-maps/map-marker)s.
The `@Output`s would be consistent with the standard [streetview events](https://developers.google.com/maps/documentation/javascript/streetview#StreetViewEvents).
See section below for more details.
### Use Case
In order to mirror [`map-marker`](https://github.com/angular/components/tree/main/src/google-maps/map-marker)s onto the panorama:

we have to resort to the native JS API where we take advantage of the fact that `google.maps.Marker` instances get be bound to a `google.maps.StreetViewPanorama` [via `.setMap`](https://github.com/googlemaps/js-types/blob/346f9c9028e92a177cd6a76289e39d7407c99048/index.d.ts#L5138).
When the map markers are dragged, we can listen to the position changes and update the streetview markers' positions accordingly:
```typescript
// keep the map marker and its corresponding panorama marker in sync
google.maps.event.addListener(rawMarker, 'position_changed', () => {
panoramaMarker.setPosition(rawMarker.getPosition().toJSON());
});
```
But since we're using `map-markers` (and not the native `google.maps.Marker`s), we have to access the underlying native markers, pass them onto the native streetview and deal with "component" lifecycles manually.
Summing up, it'd be neat to have a `map-streetview` component.
If it were to support custom overlays such as native markers (or any of the components [in this package](https://github.com/angular/components/tree/main/src/google-maps) that implement `google.maps.OverlayView`), all the better!
Thoughts?
コントリビューションガイド
調査の方向性
google-maps パッケージとその src/google-maps/map-marker コンポーネントから始め、リンクされている Google Maps StreetViewPanorama API と StreetViewEvents API を確認します。map-streetview コンポーネントが提案された入力と出力をサポートし、オーバーレイとマーカーの統合が定義され、適切なテストでカバーされていれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100