bigdataviewer / bigdataviewer-playground

BSD 2-Clause "Simplified" License
19 stars 5 forks source link

ColorChanger does not trigger BDV repaint #236

Closed tischi closed 2 years ago

tischi commented 3 years ago

@NicoKiaru For me, changing a color with the ColorChanger does not trigger a bdv.repaint().

Currently we have those lines of code:

if ( SourceAndConverterServices.getBdvDisplayService()!=null)
                SourceAndConverterServices.getBdvDisplayService().getConverterSetup(sourceAndConverter).setColor(color);

Maybe that's not enough? Maybe we also need to find all the bdvHandle where the sac is displayed and trigger a repaint there?

tischi commented 3 years ago

Or maybe we don't do this on purpose such that one can trigger the repaint somewhere else more efficiently?

NicoKiaru commented 3 years ago

Not sure if it's done on purpose, but you can repaint all windows which contains a certain source by calling

https://github.com/bigdataviewer/bigdataviewer-playground/blob/9ed7adb1abc1beebb25ef6dd19365df10a25345a/src/main/java/sc/fiji/bdvpg/scijava/services/SourceAndConverterBdvDisplayService.java#L395

tischi commented 3 years ago

And what's your feeling? Should we add this to the ColorChanger?

It would be convenient, however if you change the color of many sac it might be more efficient to first change all their colors and only then trigger the update of the display...

NicoKiaru commented 3 years ago

Right, maybe for efficiency, we should trigger it in the command, but not in color changer.

One line needs to be added here: https://github.com/bigdataviewer/bigdataviewer-playground/blob/d0db4c18218bb744f464de5167fd279eea873cf6/src/main/java/sc/fiji/bdvpg/scijava/command/source/SourceColorChangerCommand.java#L54

tischi commented 3 years ago

@NicoKiaru I made a PR. Please close this issue in case you gonna merge it.

NicoKiaru commented 2 years ago

Perfect, thanks!

NicoKiaru commented 2 years ago

PR for reference: https://github.com/bigdataviewer/bigdataviewer-playground/pull/243