mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[shared/interactive_curve_view_range] Factor zoom
The zoom method to zoom in and out on a curve view make use of the SetZoom method in Poincare::Zoom.
This commit is contained in:
committed by
EmilieNumworks
parent
71070ee052
commit
3cdb076c2c
@@ -101,19 +101,16 @@ void InteractiveCurveViewRange::zoom(float ratio, float x, float y) {
|
||||
}
|
||||
float centerX = std::isnan(x) || std::isinf(x) ? xCenter() : x;
|
||||
float centerY = std::isnan(y) || std::isinf(y) ? yCenter() : y;
|
||||
float newXMin = centerX*(1.0f-ratio)+ratio*xMi;
|
||||
float newXMax = centerX*(1.0f-ratio)+ratio*xMa;
|
||||
if (!std::isnan(newXMin) && !std::isnan(newXMax)) {
|
||||
Zoom::SetZoom(ratio, centerX, centerY, &xMi, &xMa, &yMi, &yMa);
|
||||
if (!std::isnan(xMi) && !std::isnan(xMa)) {
|
||||
setZoomAuto(false);
|
||||
m_xRange.setMax(newXMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetXMin(newXMin, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
m_xRange.setMax(xMa, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetXMin(xMi, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
float newYMin = centerY*(1.0f-ratio)+ratio*yMi;
|
||||
float newYMax = centerY*(1.0f-ratio)+ratio*yMa;
|
||||
if (!std::isnan(newYMin) && !std::isnan(newYMax)) {
|
||||
if (!std::isnan(yMi) && !std::isnan(yMa)) {
|
||||
setZoomAuto(false);
|
||||
m_yRange.setMax(newYMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetYMin(newYMin, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
m_yRange.setMax(yMa, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
MemoizedCurveViewRange::protectedSetYMin(yMi, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
m_offscreenYAxis *= ratio;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user