1j01 / jspaint

🎨 Classic MS Paint, REVIVED + ✨Extras
https://jspaint.app/about
MIT License
7.25k stars 567 forks source link

The Recover Document (Woah!) pop-up still occurs despite the following #325

Open MesaBlack opened 1 year ago

MesaBlack commented 1 year ago

It stilll happens, even if my storage is mostly empty as well as after undoing to recover. It happens while I select a portion of a graphic.

1j01 commented 1 year ago

This is a very annoying pop-up, and I want to obliterate it.

This dialog has nothing to do with storage quota. It's concerned with RAM, not disk space. It shows any time the canvas (ignoring the selection) becomes entirely transparent, because this is the only symptom that occurs when the browser decides to rudely toss out the canvas data when low on memory. This usually occurs after you've spent a lot of time and effort on a document, creating many undo states (each taking up memory), so it's important to preserve the document in the case that this happens.

The dialog is very much a kludge, and it has very stupid false positives, like if you hit Select All in a transparent document. Handling that one case would be fairly easy, but there are more complicated scenarios, like if you select all the opaque pixels manually with the Select or Free-Form Select tool. Simply preventing the dialog from showing during a tool action would leave it open to false negatives if the browser clears the canvas forcibly while making a selection.

For more background info, see https://github.com/1j01/jspaint/issues/24 It's very possible there's something simple that I haven't thought of, to remove the need for this dialog.

1j01 commented 6 months ago

I tried to make this dialog a little clearer and more compact in https://github.com/1j01/jspaint/commit/a0abbb3e367b864c0b157c1eefe6e7e1b4112849. I still want to get rid of it though.

Before:

old

After:

newer

Before (Expanded):

old expanded

After (Expanded):

newer expanded