Hi! Can I ask what would be a proper way to implement code which changes a few layers, including the current one, live based on user’s changes in drawing? I currently run it from DRAWFOREGROUND but the undo behavior is not good because it doesn’t affect any layers except for the current one and keeps every callback call which is a lot.
Do you mean layer of different glyphs? Each glyph has its own undo so you can group across multiple glyphs. So you need to undo in each glyph.
And DRAWFOREGROUND is not a good place to change the layers as those changes might trigger a redraw and that could loop.
The undo grouping is only for all changes to layer their belong to the same glyph. But in most cases you don’t need to do that manually. Only if you do some changes while dragging kit otherwise over several callbacks.
No, because you never know what else was done in that other glyph in the mean time. So if you do your change, then go to the other glyph and manually change something. Then come back to the first one and undo you get into problems.