[interactive_curve_view_range] isOrthonormal

Change-Id: I154487908d1a2a11e01b2a4e51ef867e235babab
This commit is contained in:
Gabriel Ozouf
2020-10-08 17:17:16 +02:00
committed by Émilie Feral
parent 29714b401e
commit 5d9c7b0c1f
2 changed files with 8 additions and 3 deletions

View File

@@ -189,9 +189,12 @@ void InteractiveCurveViewRange::panToMakePointVisible(float x, float y, float to
}
void InteractiveCurveViewRange::checkForNormalizedRange() {
float pixelHeight = std::round(Ion::Display::Height * (NormalizedYHalfRange(100.f) / Ion::Display::HeightInTenthOfMillimeter));
float pixelWidth = std::round(Ion::Display::Width * (NormalizedXHalfRange(100.f) / Ion::Display::WidthInTenthOfMillimeter));
m_zoomNormalize = std::round(pixelHeight * (xMax() - xMin())) == std::round(pixelWidth * (yMax() - yMin()));
m_zoomNormalize = isOrthonormal();
}
bool InteractiveCurveViewRange::isOrthonormal(float tolerance) const {
float pixelHeight = std::round(Ion::Display::Height * (NormalizedYHalfRange(100.f) / Ion::Display::HeightInTenthOfMillimeter));
float pixelWidth = std::round(Ion::Display::Width * (NormalizedXHalfRange(100.f) / Ion::Display::WidthInTenthOfMillimeter));
return std::fabs(std::round(pixelHeight * (xMax() - xMin())) - std::round(pixelWidth * (yMax() - yMin()))) <= tolerance;
}
}