Core: avoid conversion from float to double or vice-versa

When synchronizing the Transparency property with the transparency value of the ShapeAppearance property then do not convert between float and
double as otherwise some strange rounding issues can occur.

Example: Set the Transparency property of an object to 35 in the Property Editor. After leaving the editor the value may switch to 34.
This commit is contained in:
wmayer
2024-04-08 18:04:53 +02:00
parent 8cba167241
commit af317be718
3 changed files with 9 additions and 9 deletions

View File

@@ -149,7 +149,7 @@ void ViewProviderGeometryObject::onChanged(const App::Property* prop)
getObject()->touch(true);
}
const App::Material& Mat = ShapeAppearance[0];
long value = (long)(100.0 * ShapeAppearance.getTransparency() + 0.5);
long value = (long)(100.0 * ShapeAppearance.getTransparency());
if (value != Transparency.getValue()) {
Transparency.setValue(value);
}