Auto zoom becomes significantly smaller after switching tabs

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
55/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
领域
frontend

调研方向

The Auto zoom resize handler lives in apps/vscode/assets/www/preview/index.js, where scaleFactor is computed from window.innerWidth and a 200 ms throttle flag gates resize events. Reproduce by moving the preview tab between editor groups and switching tabs, logging window.innerWidth in the handler. Done when the scale is recalculated after the timer expires or on the restoration resize, so it matches the visible width.

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

描述

bug vscode
Bug description

This was detected when testing #1244 , but impacts normal Quarto Preview behavior on a released version.

Steps to reproduce
  1. Open a .qmd file in the editor.
  2. Start Quarto: Preview. The preview opens in an editor group on the right.
  3. Confirm that Zoom: (Auto) is selected.
  4. Move the preview tab into the left editor group, alongside the source document.
  5. Switch to the source document tab.
  6. Switch back to the Quarto Preview tab.
Actual behavior

The preview content becomes significantly smaller after switching back to its tab.

Expected behavior

Auto zoom should calculate the scale from the preview’s current visible width. Moving the preview between editor groups or switching tabs should not leave it incorrectly scaled.

Additional observations
  • Reproduced with the native Quarto extension in desktop VS Code
  • Fixed zoom levels do not exhibit the issue.
  • The issue was not observed in code-server.
Possible cause

The Auto zoom resize handler in apps/vscode/assets/www/preview/index.js calculates:

scaleFactor = Math.min(1, window.innerWidth / 1050);

It updates on the first resize event, then ignores further resize events for 200 ms. When the timer expires, it clears the throttle flag without recalculating the scale.

Moving or hiding a preview tab may temporarily give its webview a smaller viewport. If the handler captures that intermediate width and ignores the subsequent restoration event, the preview could retain an incorrectly reduced scale when shown again.

Steps to reproduce

No response

Actual behavior

No response

Expected behavior

No response

Your environment

No response

主要语言
TypeScript
星标
665
派生
69
平均合并
2 天 4 小时
30 天内合并 PR
14

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

quarto-dev/quarto 的其他 Issue

查看 quarto-dev/quarto 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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