angular / angular/components

feat(google-maps): Adding a streetview component

Abierto
#26,255 0 comentarios 6 reacciones 0 asignados Ver en GitHub
area: google-maps feature P4
Lenguaje dominante
TypeScript
Estrellas
25k
Forks
6.8k
Merge medio
1 d 8 h
PR fusionados (30 d)
91

Descripción

### 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:

![image](https://user-images.githubusercontent.com/9054705/207418752-842ce069-9155-4907-908f-da7a77807c66.png)

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?

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza con el paquete google-maps y su componente src/google-maps/map-marker; después, revisa las APIs vinculadas de Google Maps StreetViewPanorama y StreetViewEvents. Se considera terminado cuando un componente map-streetview admita las entradas y salidas propuestas, y la integración de overlays y marcadores esté definida y cubierta por las pruebas adecuadas.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
angular, typescript
Área
frontend
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.