-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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(components): [image-viewer] Add rotate event when rotating images #14138
Conversation
👋 @HADB, seems like this is your first time contribution to element-plus.
|
@btea Hi, could you please take a look at this PR when you have time? Any chance of getting it merged? |
I don't think it would be useful to emit this event, can you elaborate on your rationale? |
比如说,我有一堆图片,通过 ImageViewer 去做预览,其中有些图片的旋转角度是有问题的,需要调整,那我在预览的时候点了旋转这个操作,我希望能够 emit 出来,这样我可以对这些图片进行旋转的处理。不然这两个旋转按钮就只是用来看,没有实际的意义了。 For example, let's say I have a bunch of images, and I use ImageViewer to preview them. Some of these images have incorrect rotation angles that need adjustment. When I'm previewing them, I click the rotation button. I hope this action can be emitted so that I can apply rotation adjustments to these specific images. Otherwise, these two rotation buttons would merely be for viewing, without any practical purpose. The specific scenario is that I'm working on a tool in a web browser that combines multiple images into a PDF. Some of the images uploaded by users require rotation before being included in the PDF. Currently, I'm using ImageViewer for high-resolution previews, and I noticed that there are rotation buttons available. This inspired me to utilize these rotation buttons for actual image rotation. |
🧪 Playground Preview: https://element-plus.run/?pr=14138 |
Based on your description, I think using the According to your actual scenario, I think using a library similar to fabric.js may be more appropriate.🤔 |
Fabric.js is too heavy for this scenario because I just need the direction of rotation like "clockwise" or "anticlockwise". Or is it more acceptable to emit "clockwise/anticlockwise" directions instead of the degrees? |
Co-authored-by: btea <2356281422@qq.com>
element-plus#14138) * feat(components): [image-viewer] Add rotate event when rotating images * Update docs/en-US/component/image.md Co-authored-by: btea <2356281422@qq.com> --------- Co-authored-by: btea <2356281422@qq.com>
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.Description
🤖 Generated by Copilot at 2920ecd
This pull request adds a new
rotate
event to theImage Viewer
component and its documentation. The event allows users to listen for changes in the image rotation and get the current rotation degree.Related Issue
Fixes #14136.
Explanation of Changes
🤖 Generated by Copilot at 2920ecd
rotate
to theImage Viewer
component that is triggered when the user rotates the image and passes the current rotation degree as a parameter (link, link, link)docs/en-US/component/image.md
to include the new event and its parameter (link)packages/components/image-viewer/src/image-viewer.ts
to ensure it is a number (link)packages/components/image-viewer/src/image-viewer.vue
whenever the user clicks the clockwise or anticlockwise buttons and pass the updated rotation degree as a parameter (link)