Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug] CollisionBehavior and conditional rendering for AdvancedMarker

未关闭
#449 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

首先,使用 CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY,并在缩放变化后切换 showMarkers 标志,复现 issue 中描述的条件 AdvancedMarker 渲染。观察初始渲染和后续的碰撞更新;当标记出现时,重叠的标记会立即隐藏,且没有报告中的可见延迟,即表示完成。

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

描述

google maps issue
Description

Hi,
I noticed unexpected behavior for Advanced Markers with collision behavior OPTIONAL_AND_HIDES_LOWER_PRIORITY.
<AdvancedMarker key={id} position={{ lat: latValue, lng: lngValue }} zIndex={800} collisionBehavior={CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY} >
In my particular case I render an array of markers for when zoom is within given level (showMarkers is set to true)
showMarkers && <Markers>
When markers are not visible and then zoom changes to certain level and they should be rendered, at first ALL Markers are visible and after short amount of time (less than 1 s) the overlapping markers are hidden.

Expected behavior: only not-overlapping markers should be visible from the beginning.

Steps to Reproduce

Render array of Advanced Marker with CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY with optional rendering based on Boolean flag.
When they rendered after flag is set to true ALL markers are visible for max 1s, then overlapping markers disappear.

Environment
  • Library version: 1.1.0
  • Google maps version: weekly
  • Browser and Version: Chrome 126.0.6478.127 (Official Build) (64-bit)
  • OS: Windows 10
Logs

No response

主要语言
TypeScript
星标
1.9k
派生
195
平均合并
2 天 11 小时
30 天内合并 PR
14

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

visgl/react-google-maps 的其他 Issue

查看 visgl/react-google-maps 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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