angular / angular/components

bug(google-maps): Zoom not updated on centerChange

未关闭
#24,495 2 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
area: google-maps P3
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

### What are you trying to do?

Trying to zoom map after center change:
google-maps.component.html
```

```

google-maps.component.ts
```
export class GoogleMapsComponent {
@Input() center!: google.maps.LatLngLiteral;
zoom = 17;
...

centerChanged() {
console.log('center changed');
this.zoom = 17;
}
```

### What troubleshooting steps have you tried?

Zoom is not changed

### Reproduction

Steps to reproduce:
1. User changes zoom
2. User clicks on marker link that updates center variable.
3. Center is changed, console.log is fired but zoom is not updated

### Environment

- Angular: 12.2.6
- Browser(s): Firefox/Chrome
- Operating System Windows

贡献指南

打开贡献指南

调研方向

首先,在 google-maps.component.ts 中使用对应逻辑复现 google-maps.component.html 中的三个步骤,确认 centerChanged 会触发,而 zoom 保持不变。跟踪 Angular Google Maps 的绑定行为,并确保中心更新会将缩放级别恢复为 17,以验证修复。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。