Skip to content

fix: 修复天地图图层被覆盖的问题 (#2852)#2856

Open
lzxue wants to merge 1 commit into
masterfrom
fix/issue-2852-tdt-layer-coverage
Open

fix: 修复天地图图层被覆盖的问题 (#2852)#2856
lzxue wants to merge 1 commit into
masterfrom
fix/issue-2852-tdt-layer-coverage

Conversation

@lzxue
Copy link
Copy Markdown
Contributor

@lzxue lzxue commented May 14, 2026

修复 Issue #2852: 天地图的组件被地图覆盖

问题原因

  • .tdt-pane 设置了 position: absolute
  • #tdt-L7 容器继承了父元素的定位方式
  • 导致 L7 图层被天地图底图覆盖

解决方案

  • 为 #tdt-L7 容器添加 position: relative 样式
  • 使其建立新的定位上下文,防止被父元素覆盖

测试

请验证天地图示例中 PointLayer 等图层能够正常显示在地图上方,不再被地图覆盖。

Reference: #2852

🤖 Generated with WeaveFox

修复 Issue #2852: 天地图的组件被地图覆盖

问题原因:
- .tdt-pane 设置了 position: absolute
- #tdt-L7 容器继承了父元素的定位方式
- 导致 L7 图层被天地图底图覆盖

解决方案:
- 为 #tdt-L7 容器添加 position: relative 样式
- 使其建立新的定位上下文,防止被父元素覆盖

Reference: #2852
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

⚠️ No Changeset found

Latest commit: 8aa8e3d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the TdtMapService in packages/maps/src/tdtmap/map.ts to set the CSS position of the layer container, aiming to resolve an issue where the layer was being obscured. The reviewer suggests using absolute positioning instead of relative to ensure consistency with existing methods like addMarkerContainer and to prevent potential layout interference with other map elements.

overlayPane.parentElement.appendChild(container);
container.id = 'tdt-L7';
const size = this.map.getSize();
container.style.position = 'relative'; // 修复天地图图层被覆盖的问题
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

建议将 position 设置为 absolute 而不是 relative

  1. 一致性:该类中的 addMarkerContainer 方法(第 42 行)也使用了 absolute 定位,保持一致性有助于代码维护。
  2. 布局稳定性:在地图容器中,使用 absolute 定位可以确保图层容器脱离文档流,避免对地图的其他子元素(如控件、比例尺等)产生潜在的布局挤压影响。
  3. 通用实践:对于需要通过 transform 进行精确定位的地图覆盖物容器,使用 absolute 是更通用的做法。
Suggested change
container.style.position = 'relative'; // 修复天地图图层被覆盖的问题
container.style.position = 'absolute'; // 修复天地图图层被覆盖的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant