Conversation
TDesign Component Site Preview Open
|
commit: |
dafcaf6 to
283853a
Compare
283853a to
32eafae
Compare
There was a problem hiding this comment.
Pull request overview
This PR enhances the ImageViewer zoom/transform behavior by coordinating wheel zoom with the dragged image position, enabling a “converge back toward center when zooming out while overflowed” experience. It does this by exposing transform state from the image item to the parent viewer and extending the scale hook to optionally return updated translation offsets.
Changes:
- Expose
modalBoxRef/transform/resetTransformfromTImageItemso the parent viewer can measure overflow and update translation during zoom. - Extend
useScaleto accept optional zoom-center/translate inputs and return a computednewTranslatefor compensation. - Update
image-viewer.tsxto detect overflow and adjusttransformon wheel zoom-out, and to reset transforms on “reset”.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| packages/components/image-viewer/image-viewer.tsx | Adds overflow detection and wheel zoom-out convergence logic; wires a ref to TImageItem and resets its transform on reset. |
| packages/components/image-viewer/hooks/index.ts | Reworks scaling hook to optionally compute translation compensation and returns it to the caller; simplifies scale clamping. |
| packages/components/image-viewer/base/ImageItem.tsx | Adds expose() of internal refs/state (modalBoxRef, transform, resetTransform) and attaches a DOM ref for measurements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.

🤔 这个 PR 的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
📝 更新日志
tdesign-vue-next
@tdesign-vue-next/chat
@tdesign-vue-next/auto-import-resolver
☑️ 请求合并前的自查清单