Techdraw: Use std::numeric_limits and std::numbers instead of defines

This commit is contained in:
Benjamin Nauck
2025-03-27 19:02:45 +01:00
parent f5244d404c
commit bfdaa9aab2
40 changed files with 243 additions and 220 deletions

View File

@@ -130,7 +130,7 @@ void DrawView::checkScale()
TechDraw::DrawPage *page = findParentPage();
if(page) {
if (ScaleType.isValue("Page")) {
if(std::abs(page->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
if(std::abs(page->Scale.getValue() - Scale.getValue()) > std::numeric_limits<float>::epsilon()) {
Scale.setValue(page->Scale.getValue());
Scale.purgeTouched();
}
@@ -190,7 +190,7 @@ void DrawView::onChanged(const App::Property* prop)
}
if (ScaleType.isValue("Page")) {
Scale.setStatus(App::Property::ReadOnly, true);
if(std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) {
if(std::abs(page->Scale.getValue() - getScale()) > std::numeric_limits<float>::epsilon()) {
Scale.setValue(page->Scale.getValue());
}
} else if ( ScaleType.isValue("Custom") ) {
@@ -200,7 +200,7 @@ void DrawView::onChanged(const App::Property* prop)
Scale.setStatus(App::Property::ReadOnly, true);
if (!checkFit(page)) {
double newScale = autoScale(page->getPageWidth(), page->getPageHeight());
if(std::abs(newScale - getScale()) > FLT_EPSILON) {
if(std::abs(newScale - getScale()) > std::numeric_limits<float>::epsilon()) {
Scale.setValue(newScale);
}
}