Finding changed tiles with regionEdited signal. New beforeRegionEdited signal needed?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 12.9k
- Forks
- 2k
- Avg merge
- 4h 27m
- Merged PRs (30d)
- 8
Description
This issue is to track a usability issue when using the new (yet to be officially released) signal "regionEdited".
I found an annoying side-effect with regionEdited in conjunction with undo. In order to know which tiles were added/removed after an edit, I copy the edited region into a variable and I call undo. I then calculate the delta between the 2 states. It works except when the user drags and drop the stamp tool across the map. It only produces 1 undo state, but several regionEdited signals. So I end up calling undo too many times and going back too far in the history.
@bjorn mentioned an elegant potential fix that would see a new signal added akin to "beforeRegionEdited". This signal would occur before the region is edited, which in my case would allow me to save the "before" state of the region. When "regionEdited" finally gets triggered, I can then see the "after" state, and compare the before and after state to find the delta.
Of course there could also be a parameter added to the regionEdited callback with a list of the tiles that have changed (additions/deletions), but that is icing on the cake. This could be done manually as described above, provided we receive a beforeRegionEdited signal.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing where the regionEdited signal is emitted and how undo groups edits when the stamp tool is dragged across the map. Decide whether a beforeRegionEdited signal or changed-tile data is the supported design. Done means callers can compare before and after regions without invoking undo once per signal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- desktop
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100