bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

BasicViewerState `removeSources` has a typo which messes up SourceGroups #177

Closed NicoKiaru closed 1 month ago

NicoKiaru commented 2 months ago

If a Source is present in a SourceGroup, calling state.removeSources will remove the sources from the viewer and the 'main' panel works, but it stays in the SourceGroup.

Also, when removeSources is called, all sources from all SourceGroup are removed (and it does not care about the argument of removeAll method).

I think this is due to a typo here:

https://github.com/bigdataviewer/bigdataviewer-core/blob/4d3550f768e601f6ef44aa6e6c38901a24305837/src/main/java/bdv/viewer/BasicViewerState.java#L840

It's rather:

sourceToGroupAssignmentChanged |= groupData.sources.removeAll( collection );

This would solve

https://github.com/bigdataviewer/bigdataviewer-playground/issues/272

and maybe ? https://github.com/bigdataviewer/bigdataviewer-core/issues/146

I'll make a quick PR

NicoKiaru commented 2 months ago

Here's the PR: https://github.com/bigdataviewer/bigdataviewer-core/pull/178

I think I did a small mistake in the PR since there's an extra commit from Tobias. I don't know ow it came in the PR

NicoKiaru commented 1 month ago

PR https://github.com/bigdataviewer/bigdataviewer-core/pull/178 merged, so let's close this issue.