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

[求助]——下载选中区域的图片功能 #3

Open
slince-zero opened this issue May 14, 2024 · 0 comments
Open

[求助]——下载选中区域的图片功能 #3

slince-zero opened this issue May 14, 2024 · 0 comments

Comments

@slince-zero
Copy link
Owner

目前,我已经完成点击‘截选按钮’ 出现一个可以拖动、拉伸的框框,但是下载选中区域的图片,这个功能遇到了一些问题。

问题如下:

图片和一些编辑操作都在 CenterBoard 组件中,所以在最外层的div里面写一个ref={imageContainerRef}>,可以很容易的拿到整个页面的dom元素,然后再借助 dom-to-image 这个库就可以实现下载。

但是,我将一个名为ScreenCapture 的组件放在了 CenterBoard 组件中,所以,我不知道应该怎么拿到选中区域的图片,希望有人可以帮我解决下这个问题。

I have currently implemented a feature where clicking on a 'crop button' creates a draggable and resizable box. However, I'm facing some issues with downloading the selected area of the image.

The problem is as follows:

Both the image and some editing operations are within the CenterBoard component. So, by adding a ref={imageContainerRef} to the outermost div, I can easily access the DOM elements of the entire page, and then with the help of the dom-to-image library, I can achieve the download functionality.

However, I have a component called ScreenCapture placed within the CenterBoard component. Therefore, I'm unsure how to access the image of the selected area. I hope someone can help me resolve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant