Skip to content

fix: pass preserveDrawingBuffer to Mapbox for screenshot support (#2723)#2843

Open
lzxue wants to merge 1 commit intomasterfrom
fix/preserve-drawing-buffer-issue-2723
Open

fix: pass preserveDrawingBuffer to Mapbox for screenshot support (#2723)#2843
lzxue wants to merge 1 commit intomasterfrom
fix/preserve-drawing-buffer-issue-2723

Conversation

@lzxue
Copy link
Copy Markdown
Contributor

@lzxue lzxue commented Mar 31, 2026

修复 Issue #2723: 配置 preserveDrawingBuffer: true 截图不生效

当使用 Mapbox 地图时,需要将 preserveDrawingBuffer 选项传递给 Mapbox 实例的 WebGL 上下文,这样才能使用 html2canvas 等工具正确截图。

修改内容:

  • 从 MapboxService 配置中提取 preserveDrawingBuffer 参数
  • 传递给 Mapbox 构造函数

修复 Issue #2723: 配置 preserveDrawingBuffer: true 截图不生效

当使用 Mapbox 地图时,需要将 preserveDrawingBuffer 选项传递给
Mapbox 实例的 WebGL 上下文,这样才能使用 html2canvas 等工具
正确截图。

修改内容:
- 从 MapboxService 配置中提取 preserveDrawingBuffer 参数
- 传递给 Mapbox 构造函数
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: 2e4fc33

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 introduces the preserveDrawingBuffer configuration option to the Mapbox service. A critical issue was identified where the removal of the ...rest spread operator during the Mapbox instance initialization causes other configuration parameters (such as zoom, center, and pitch) to be lost. The feedback suggests restoring the spread operator to prevent this regression.

attributionControl,
bearing: rotation,
...rest,
preserveDrawingBuffer: preserveDrawingBuffer ?? undefined,
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.

high

在修改中移除了 ...rest 扩展运算符,这会导致 this.config 中原本通过 ...rest 传递给 Mapbox 的其他配置项(如 zoom, center, pitch, antialias 等)丢失,从而导致功能回归。建议在显式传递 preserveDrawingBuffer 的同时保留 ...rest

        preserveDrawingBuffer: preserveDrawingBuffer ?? undefined,
        ...rest,

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