HaikuArchives / ArtPaint

ArtPaint is a painting and image processing program.
https://haikuarchives.github.io/ArtPaint/
29 stars 18 forks source link

LayerWindow: add ability to undo/redo layer 'meta-data' changes #492

Closed dsizzle closed 1 year ago

dsizzle commented 1 year ago

Partially addresses #240

The remaining piece from the ticket is layer re-arranging. However, another area that should be improved is deleting a layer. Currently all layer settings are lost when you delete and then undo.

dsizzle commented 1 year ago

actually I got layer data working for undo, but not redo. that is to say:

but it's better than before. also works for merging/undo merge the same way.

humdingerb commented 1 year ago

Nice! I gave it a little test run. Here's one thing I found:

dsizzle commented 1 year ago

I figured out the problem, not sure of the fix yet. A difference with this change is that when you un-delete a layer, it gets selected. Previously undoing a layer deletion kept the current selection (which I think is wrong). Seems like some percentage of the time, the layer isn't really selected until you click on it, so the UI doesn't work. Hmm....

dsizzle commented 1 year ago

ok. I think it's fixed by sort of forcing an update of the Layer window.

humdingerb commented 1 year ago

Hmm... doing the same as described above, still the transparency isn't restored after undoing the "Delete layer".

dsizzle commented 1 year ago

doing the same as described above, still the transparency isn't restored after undoing the "Delete layer".

but does everything else work?

humdingerb commented 1 year ago

Not completely. If I do this:

then undo one by one:

then re-do everything. then undo one by one again:

It's a bit complicated... best try yourself, do these steps from above:

dsizzle commented 1 year ago

So the transparency part is a problem. But I mentioned above that undo/redo/undo/redo doesn’t work. But undo/redo should.

dsizzle commented 1 year ago

Ok, I fixed the transparency for undoing a deleted layer. But still, undo/redo/undo/redo doesn't work, as before.

I had forgotten I needed to do a bit of a hack for transparency because it's a live updating slider. So I only want an Undo event when you stop sliding, but I need to update the layer transparency every time the slider moves. That means I need to keep track of what the original transparency was before the user started messing with it. I think it's good now.

humdingerb commented 1 year ago

Sorry, I misunderstood and thought you've fixed it completely. :) Anyway, aside from redoing a deleted layer, it works very nicely now. Merge!