@@ -334,18 +334,46 @@ void ScatterplotPlugin::init()
334334 connect (&getSamplerAction (), &ViewPluginSamplerAction::sampleContextRequested, this , &ScatterplotPlugin::samplePoints);
335335
336336 connect (&_positionDataset, &Dataset<Points>::changed, this , &ScatterplotPlugin::positionDatasetChanged);
337- connect (&_positionDataset, &Dataset<Points>::dataChanged, this , &ScatterplotPlugin::updateData);
337+ connect (&_positionDataset, &Dataset<Points>::dataChanged, this , [this ]() -> void {
338+ updateData ();
339+ updateHeadsUpDisplay ();
340+ });
338341 connect (&_positionDataset, &Dataset<Points>::dataSelectionChanged, this , &ScatterplotPlugin::updateSelection);
342+ connect (&_positionDataset, &Dataset<>::guiNameChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
339343
340- _scatterPlotWidget->installEventFilter (this );
344+ const auto currentColorDatasetChanged = [this ](Dataset<DatasetImpl> currentColorDataset) -> void {
345+ if (_colorDataset == currentColorDataset)
346+ return ;
341347
342- getLearningCenterAction ().getViewPluginOverlayWidget ()->setTargetWidget (_scatterPlotWidget);
348+ if (_colorDataset.isValid ())
349+ disconnect (&_colorDataset, &Dataset<>::guiNameChanged, this , nullptr );
350+
351+ _colorDataset = currentColorDataset;
352+
353+ connect (&_colorDataset, &Dataset<>::guiNameChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
354+
355+ updateHeadsUpDisplay ();
356+ };
357+
358+ connect (&_settingsAction.getColoringAction (), &ColoringAction::currentColorDatasetChanged, this , currentColorDatasetChanged);
359+ connect (&_settingsAction.getColoringAction ().getColorByAction (), &OptionAction::currentIndexChanged, this , [this , currentColorDatasetChanged](const std::int32_t & currentIndex) -> void {
360+ currentColorDatasetChanged (_settingsAction.getColoringAction ().getCurrentColorDataset ());
361+ });
362+
363+ connect (&_settingsAction.getPlotAction ().getPointPlotAction ().getSizeAction (), &ScalarAction::sourceDataChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
364+ connect (&_settingsAction.getPlotAction ().getPointPlotAction ().getOpacityAction (), &ScalarAction::sourceDataChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
365+
366+ connect (&_settingsAction.getMiscellaneousAction ().getBackgroundColorAction (), &ColorAction::colorChanged, this , &ScatterplotPlugin::updateHeadsUpDisplayTextColor);
343367
344368 connect (&getScatterplotWidget ().getPointRendererNavigator ().getNavigationAction ().getZoomSelectionAction (), &TriggerAction::triggered, this , [this ]() -> void {
345369 if (_selectionBoundaries.isValid ())
346370 _scatterPlotWidget->getPointRendererNavigator ().setZoomRectangleWorld (_selectionBoundaries);
347371 });
348372
373+ _scatterPlotWidget->installEventFilter (this );
374+
375+ getLearningCenterAction ().getViewPluginOverlayWidget ()->setTargetWidget (_scatterPlotWidget);
376+
349377#ifdef VIEW_SAMPLING_HTML
350378 getSamplerAction ().setHtmlViewGeneratorFunction ([this ](const ViewPluginSamplerAction::SampleContext& toolTipContext) -> QString {
351379 QStringList localPointIndices, globalPointIndices;
@@ -391,36 +419,7 @@ void ScatterplotPlugin::init()
391419#endif
392420
393421 updateHeadsUpDisplay ();
394-
395- connect (&_positionDataset, &Dataset<>::changed, this , &ScatterplotPlugin::updateHeadsUpDisplay);
396- connect (&_positionDataset, &Dataset<>::guiNameChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
397- connect (&_positionDataset, &Dataset<>::guiNameChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
398-
399- const auto currentColorDatasetChanged = [this ](Dataset<DatasetImpl> currentColorDataset) -> void {
400- if (_colorDataset == currentColorDataset)
401- return ;
402-
403- if (_colorDataset.isValid ())
404- disconnect (&_colorDataset, &Dataset<>::guiNameChanged, this , nullptr );
405-
406- _colorDataset = currentColorDataset;
407-
408- connect (&_colorDataset, &Dataset<>::guiNameChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
409-
410- updateHeadsUpDisplay ();
411- };
412-
413- connect (&_settingsAction.getColoringAction (), &ColoringAction::currentColorDatasetChanged, this , currentColorDatasetChanged);
414- connect (&_settingsAction.getColoringAction ().getColorByAction (), &OptionAction::currentIndexChanged, this , [this , currentColorDatasetChanged](const std::int32_t & currentIndex) -> void {
415- currentColorDatasetChanged (_settingsAction.getColoringAction ().getCurrentColorDataset ());
416- });
417-
418- connect (&_settingsAction.getPlotAction ().getPointPlotAction ().getSizeAction (), &ScalarAction::sourceDataChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
419- connect (&_settingsAction.getPlotAction ().getPointPlotAction ().getOpacityAction (), &ScalarAction::sourceDataChanged, this , &ScatterplotPlugin::updateHeadsUpDisplay);
420-
421422 updateHeadsUpDisplayTextColor ();
422-
423- connect (&_settingsAction.getMiscellaneousAction ().getBackgroundColorAction (), &ColorAction::colorChanged, this , &ScatterplotPlugin::updateHeadsUpDisplayTextColor);
424423}
425424
426425void ScatterplotPlugin::loadData (const Datasets& datasets)
0 commit comments