mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[graph] Force same grid unit on orthonormal graphs
Change-Id: I2abca9eb1c4a14057323ee97e1044715f89620ff
This commit is contained in:
committed by
Émilie Feral
parent
7322751453
commit
26754a3230
@@ -33,6 +33,22 @@ void InteractiveCurveViewRange::setYMax(float yMax) {
|
||||
MemoizedCurveViewRange::protectedSetYMax(yMax, k_lowerMaxFloat, k_upperMaxFloat);
|
||||
}
|
||||
|
||||
float InteractiveCurveViewRange::yGridUnit() const {
|
||||
float res = MemoizedCurveViewRange::yGridUnit();
|
||||
if (m_zoomNormalize) {
|
||||
/* When m_zoomNormalize is active, both xGridUnit and yGridUnit will be the
|
||||
* same. To declutter the X axis, we try a unit twice as large. We check
|
||||
* that it allows enough graduations on the Y axis, but if the standard
|
||||
* unit would lead to too many graduations on the X axis, we force the
|
||||
* larger unit anyways. */
|
||||
float numberOfUnits = (yMax() - yMin()) / res;
|
||||
if (numberOfUnits > k_maxNumberOfXGridUnits || numberOfUnits / 2.f > k_minNumberOfYGridUnits) {
|
||||
return 2 * res;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void InteractiveCurveViewRange::zoom(float ratio, float x, float y) {
|
||||
float xMi = xMin();
|
||||
float xMa = xMax();
|
||||
|
||||
Reference in New Issue
Block a user