Sketcher: AutoColor should update only colors

Previously AutoColor property forced reinitialization of all subscribed
parameters. It was mostly fine as most of them should stay in sync with
user settings but it also affected grids.
This commit is contained in:
Kacper Donat
2024-09-04 22:51:52 +02:00
committed by Chris Hennes
parent a3f8483032
commit 7646d4b611
2 changed files with 11 additions and 2 deletions

View File

@@ -401,7 +401,13 @@ void ViewProviderSketch::ParameterObserver::OnChange(Base::Subject<const char*>&
{
(void)rCaller;
auto key = parameterMap.find(sReason);
updateFromParameter(sReason);
}
void SketcherGui::ViewProviderSketch::ParameterObserver::updateFromParameter(const char* parameter)
{
auto key = parameterMap.find(parameter);
if (key != parameterMap.end()) {
auto string = key->first;
auto update = std::get<0>(key->second);
@@ -2976,7 +2982,8 @@ void SketcherGui::ViewProviderSketch::finishRestoring()
if (AutoColor.getValue()) {
// update colors according to current user preferences
pObserver->initParameters();
pObserver->updateFromParameter("SketchEdgeColor");
pObserver->updateFromParameter("SketchVertexColor");
}
}

View File

@@ -174,6 +174,8 @@ private:
/** Observer for parameter group. */
void OnChange(Base::Subject<const char*>& rCaller, const char* sReason) override;
void updateFromParameter(const char* property);
private:
void
updateBoolProperty(const std::string& string, App::Property* property, bool defaultvalue);