[p5.js 2.0+ Bug Report]: SVG importer does not respect preserveAspectRatio="none" for <symbol>/<use>
维护者通常 2 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 83/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
从 test/unit/svg/svg_import.js 中 <defs> 和 <use> 元素的测试套件开始,并运行 npm test -- test/unit/svg/svg_import.js 以确认失败。追踪 SVG 导入器如何处理由 <use> 引用的 symbol 的 preserveAspectRatio。当回归测试在水平变换为 2、垂直变换为 1 时通过,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- WebGL
- WebGPU
- p5.strands
- Build process
- Unit testing
- Internationalization
- Friendly errors
- Other (specify if possible)
p5.js version
2.3.2
Web browser and version
No response
Operating system
macOS 15.7.3
Steps to reproduce this
Steps:
- Add the regression test below to the
<defs> and <use> elementssuite intest/unit/svg/svg_import.js. - Run
npm test -- test/unit/svg/svg_import.js. - Observe that the test fails because
node.state.transform.ais1instead of the expected2.
The test uses a 100×100 <symbol> with preserveAspectRatio="none" inside a 200×100 <use> viewport. In this case, the expected transform is non-uniform scaling: 2× horizontally and 1× vertically.
I reproduced this on p5.js 2.3.2 (main at 7f9e0fda5). The SVG importer test suite reports 92 passing tests and this test failing with:
AssertionError: expected 1 to be close to 2 +/- 0.001
Snippet:
test('use respects preserveAspectRatio=none', function () {
const record = createSVG(`
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<symbol id="stretch" viewBox="0 0 100 100" preserveAspectRatio="none">
<rect x="0" y="0" width="100" height="100" />
</symbol>
</defs>
<use href="#stretch" width="200" height="100" />
</svg>
`);
const scope = firstChild(record);
const node = scope.children[0];
assert.closeTo(node.state.transform.a, 2, 0.001);
assert.closeTo(node.state.transform.d, 1, 0.001);
});
- 主要语言
- JavaScript
- 星标
- 24.1k
- 派生
- 3.9k
- 平均合并
- 3 天 19 小时
- 30 天内合并 PR
- 33
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
processing/p5.js 的其他 Issue
-
Add unit tests for noiseDetail()可能已有人在做 @Pcmhacker-piro 于 2 天前认领。 未关闭Area:Math Enhancement
难度 2/5 1-3 小时 新手友好度 75/100
processing/p5.js#9253 ·
维护者通常 2 天内回复
-
[p5.js 2.0+ Bug Report]: storeItem() validation branches are missing `return`, so bad input throws a TypeError or is stored anyway可能已有人在做 @iUjjwalRaj 于 3 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
processing/p5.js#9242 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
processing/p5.js#9241 ·
维护者通常 2 天内回复
-
[p5.js 2.0+ Bug Report]: Typo in Spanish reference documentation for ellipseMode()可能已有人在做 @cgutierrezval 于 5 天前认领。 未关闭Internationalization p5.js 2.0+
难度 1/5 1 小时以内 新手友好度 95/100
processing/p5.js#9231 · 3 条评论 ·
维护者通常 2 天内回复
-
[p5.js 2.0+ Bug Report]: ReferenceError: p5 is not defined when calling loadPixels/get/copy/mask on p5.MediaElement in ESM可能已有人在做 @Pcmhacker-piro 于 10 天前认领。 未关闭Area:Core Area:DOM
难度 2/5 1-3 小时 新手友好度 86/100
processing/p5.js#9189 · 1 条评论 ·
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
rescript-lang/rescript-lang.org#1415 ·
维护者通常 2 天内回复
-
[Bug]: agent capture drops long Unicode text as punctuation可能已有人在做 @ktz03 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
volcengine/OpenViking#5801 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
Deepak3699/Ai_Mentor#244 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nextcloud/collectives#2843 ·
维护者通常 1 天内回复