Core: SoShapeScale fix weird scaling on viewport resize. See https://github.com/FreeCAD/FreeCAD/issues/18382#issuecomment-2527623758

This commit is contained in:
PaddleStroke
2024-12-09 14:25:36 +01:00
committed by wwmayer
parent 09be35359e
commit dbdbc9934e
10 changed files with 21 additions and 19 deletions

View File

@@ -78,7 +78,6 @@ void ViewProviderDatum::attach(App::DocumentObject* pcObject)
{
ViewProviderGeometryObject::attach(pcObject);
float defaultSz = ViewProviderCoordinateSystem::defaultSize();
// Create an external separator
auto sep = new SoSeparator();
@@ -93,8 +92,8 @@ void ViewProviderDatum::attach(App::DocumentObject* pcObject)
// Setup font size
auto font = new SoFont();
float fontRatio = 4.0f;
font->size.setValue(defaultSz / fontRatio);
static const float size = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetFloat("DatumFontSize", 15.0);
font->size.setValue(size);
sep->addChild(font);
// Create the selection node
@@ -135,7 +134,7 @@ void ViewProviderDatum::attach(App::DocumentObject* pcObject)
// Scale feature to the given size
float sz = App::GetApplication()
.GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")
->GetFloat("LocalCoordinateSystemSize", 2.0); // NOLINT
->GetFloat("LocalCoordinateSystemSize", 1.0); // NOLINT
soScale->setPart("shape", sep);
soScale->scaleFactor = sz;