-
Notifications
You must be signed in to change notification settings - Fork 302
feat(compose): 文本虚线 drawBehind + PathEffect 官方写法对齐(三端通用化) #1586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nikazhao
wants to merge
10
commits into
Tencent-TDS:main
Choose a base branch
from
nikazhao:feat/kuikly-compose-drawbehind-pathEffect-pr_3
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
adad8c8
feat(compose): 文本虚线 drawBehind + PathEffect 官方写法对齐
nikazhao 3be45c0
refactor(compose): 移除 drawBehind 固定 4dp 底部补丁以对齐官方语义
nikazhao f9211f5
feat(demo): 新增 DrawBehindDemo 验证通用组件 drawBehind 与多种 pathEffect
nikazhao 6b571ea
feat(compose): iOS/OHOS 补齐文本虚线行度量桥接,三端对齐 drawBehind+PathEffect
nikazhao 296fcab
chore(compose): drawBehind+PathEffect 二轮打磨与 OHOS 越界钳制
nikazhao 8323a37
Merge remote-tracking branch 'origin/main' into feat/kuikly-compose-d…
nikazhao e0937f1
fix(compose): CR fixes for drawBehind + PathEffect
nikazhao a2c69f1
feat(demo): add DashedUnderlineDemo to TextDemo for drawBehind dashed…
nikazhao 7d8b7ca
fix(compose): address CR feedback for drawBehind + PathEffect
nikazhao bc48b94
perf(compose): cache char bounding box & skip identical bg frame setF…
nikazhao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里
fillOrStroke开头调clearLineDashIfActive()清掉上一笔虚线,但整个方法没有再根据paint.pathEffect重新设置 dash。这意味着drawRect/drawPath/drawCircle/drawRoundRect等走 fillOrStroke 的 API 会忽略传入的paint.pathEffect——只有drawLine真正支持虚线。问题是
DrawScope.drawRect/drawPath等已经恢复了pathEffect参数(见 DrawScope.kt / CanvasDrawScope.kt),业务传pathEffect = dashPathEffect(...)给drawRect画虚线框时不会报错,但也不会画虚线,是个静默不生效的契约缺口。demo 里BoxFrameSample用 4 条drawLine拼框绕过了这个限制,所以没暴露。当前 PR 范围是文本虚线(用 drawLine 实现),可以接受。建议在
fillOrStroke或DrawScope.drawRect的 kdoc 标一句"当前 pathEffect 仅 drawLine 生效",避免下游按官方 Compose 语义直接用 drawRect 画虚线框而困惑。后续要支持可在 fillOrStroke 的 stroke 分支补一段类似 drawLine 的paint.pathEffect as? DashPathEffect下沉逻辑。There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决:PathEffect.kt 的 sealed interface kdoc 已补"当前 pathEffect 仅对 drawLine 生效,drawRect/drawPath/drawCircle/drawRoundRect 等走 fillOrStroke 的 API 会忽略 pathEffect",与建议一致。后续若要支持可在 fillOrStroke 的 stroke 分支补 DashPathEffect 下沉逻辑。