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

Clear canvas and UI #383

Closed
superstar1128 opened this issue Apr 17, 2020 · 10 comments
Closed

Clear canvas and UI #383

superstar1128 opened this issue Apr 17, 2020 · 10 comments

Comments

@superstar1128
Copy link

How can I clear all objects from canvas and UI?
When load img, menu is activated automatically.
I want to add "Clear" button, so when click "clear", clear canvas and hide menu.
How can I do it?
I called imageEditor.clearObjects(), but loaded image is remained on the canvas.

@auto-comment
Copy link

auto-comment bot commented Apr 17, 2020

Thank you for raising an issue.
We will try and get back to you as soon as possible.

Please make sure you have filled out issue respecting our form in English and given us as much context as possible. If not, the issue will be closed or not replied.

@stale
Copy link

stale bot commented May 17, 2020

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!

@stale stale bot added the inactive label May 17, 2020
@junghwan-park
Copy link
Member

@superstar1128
Sorry for late reply.

The only way to remove loaded image is destroy and create new ImageEditor instance for now.

As you know, imageEditor.clearObjects() clear only objects on the canvas(shape, line, text, icon). And ImageEditor treats the loaded image as background image.
So currently, loaded image remains until replacing another image.

I'll discuss adding API for clear ImageEditor with initial instance state with my team. Thanks.

@stale
Copy link

stale bot commented Jun 21, 2020

This issue has been automatically marked as inactive because there hasn’t been much going on it lately. It is going to be closed after 7 days. Thanks!

@stale stale bot added the inactive label Jun 21, 2020
@stale
Copy link

stale bot commented Jun 28, 2020

This issue will be closed due to inactivity. Thanks for your contribution!

@stale stale bot closed this as completed Jun 28, 2020
@Geetanjali2029
Copy link

How to clear image on canvas? Please help

Thank you in advance

@Geetanjali2029
Copy link

Geetanjali2029 commented Jul 22, 2020

I have tried many ways sir but still no success.

imageEditorInst.loadImageFromURL("null", "image").then(() => {
imageEditorInst.clearObjects();
imageEditorInst.clearUndoStack();
imageEditorInst.clearRedoStack();
}).catch((e)=>{console.log(e) });

OR

    imageEditorInst.clearObjects();
    imageEditorInst.clearUndoStack();
    imageEditorInst.clearRedoStack();

OR

imageEditorInst.ui.initCanvas();

@eomttt
Copy link

eomttt commented Dec 3, 2021

i have same problem can i claer image?

@dano1066
Copy link

dano1066 commented Jan 6, 2022

Also wondering how to clear an image from the canvas. UI can get laggy when a large image is there, I want to get rid of it once the user has saved the result without destroying the entire canvas

@lja1018
Copy link
Contributor

lja1018 commented Jan 12, 2022

@dano1066
There is no way to erase the background image yet. I'll consider it.

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

No branches or pull requests

6 participants