Repository navigation
[6237] 修复绘制图形模式下矩形边框线无法设置为虚线的问题 - #4770
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
任务背景与问题
在绘制图形模式下,矩形的边框线无法设置为虚线。
经排查,在
TeXmacs/progs/graphics/graphics-drd.scm中,曲线与闭合图形标签通过graphical-open-curve-tag(直线line等)与graphical-closed-curve-tag(多边形cline、圆circle、椭圆ellipse等)统一归入graphical-curve-tag,获得边框线宽(line-width)、虚线样式(dash-style、dash-style-unit)及填充色(fill-color)等属性。矩形(
rectangle)在几何语义上同属闭合曲线族,底层宏亦展开为闭合折线cline,但此前在graphics-drd.scm中遗漏了将rectangle加入graphical-closed-curve-tag,导致:(graphics-attributes 'rectangle)仅回退到公共基础属性,缺少dash-style与line-width;(graphics-mode-attribute? '(edit rectangle) "dash-style")为#f,菜单栏与工具栏不展示虚线样式菜单;graphics-sync-type-config无法保存矩形的虚线配置;graphics-enrich-filter判定矩形不具备dash-style属性而将其过滤剥离,最终无法生成和渲染虚线边框矩形。解决方案
参考曲线(
line)与多边形(cline)等闭合图形的线条属性组织方式,在TeXmacs/progs/graphics/graphics-drd.scm的graphical-closed-curve-tag分组中加入rectangle:(define-group graphical-closed-curve-tag cline cspline cbezier csmooth carc oval circle ellipse sector sector-counterclockwise rectangle ) ;define-group使
rectangle自动继承曲线族的完整线条属性,工具栏和焦点菜单在(edit rectangle)模式下正常呈现线条样式(dash-style)与线宽选项,绘制时正常生成带dash-style的图形树并渲染为虚线。验证与测试
新增纯逻辑单元测试
TeXmacs/progs/graphics/tests/graphics-rectangle-test.scm,覆盖 4 组共 12 项断言(标签分组、图形属性、编辑模式属性、enrich-filter):运行
xmake r graphics-ghost-test正常通过(3 correct, 0 failed)。dev-agent PR: https://github.com/LiiiLabs/dev-agent/pull/357
手动验证步骤