Skip to content
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

feat(Signature): expose resize method #12405

Merged
merged 3 commits into from
Oct 29, 2023

Conversation

inottn
Copy link
Collaborator

@inottn inottn commented Oct 28, 2023

resolve #12333

@codecov-commenter
Copy link

codecov-commenter commented Oct 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
packages/vant/src/signature/Signature.tsx 67.81% <100.00%> (+4.52%) ⬆️
packages/vant/src/signature/index.ts 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@chenjiahan
Copy link
Member

好像和 #12403 有些代码冲突

@inottn
Copy link
Collaborator Author

inottn commented Oct 28, 2023

好像和 #12403 有些代码冲突

看了一下这个 pr 是在屏幕尺寸变化时,重置 canvas 宽高信息。
这里有个问题,当 canvas 宽高改变时会自动清空画布之前的信息,用户之前绘制的签名也会一并清空。
在 iphone 的 safari 浏览器上(其它浏览器应该也有类似问题),当滑动屏幕时,会切换地址栏的显示和隐藏,这个时候会触发 window 的 resize 从而清空画布。

看上去没有解决 #12333 这个问题,反而引入了新的问题。

@eivmosn
Copy link

eivmosn commented Oct 28, 2023

确实没考虑地址栏的显示隐藏会触发 resize 事件,你是对的

@chenjiahan
Copy link
Member

所以现在是只有用户侧手动调用 resize 方法才能解决 #12333 这个问题嘛?有没有可能在组件内部通过监听 resize 或 orientationchange 事件来处理

@inottn
Copy link
Collaborator Author

inottn commented Oct 28, 2023

所以现在是只有用户侧手动调用 resize 方法才能解决 #12333 这个问题嘛?有没有可能在组件内部通过监听 resize 或 orientationchange 事件来处理

可以的,当 windowWidth 变化时可以自动调用 resize,其它覆盖不到的场景,用户可以手动调用 resize 方法。

@chenjiahan chenjiahan merged commit 873f499 into youzan:main Oct 29, 2023
3 checks passed
CatsAndMice pushed a commit to CatsAndMice/vant that referenced this pull request Apr 8, 2024
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.

[Bug Report] signature组件当手机翻转时签名落点不符合手指触摸点
4 participants