Clamp diagram zoom.
- avoid poor performance and unusable UI when zooming out
This commit is contained in:
parent
242e79f5e9
commit
6ee7e51af3
1 changed files with 8 additions and 2 deletions
|
@ -38,6 +38,8 @@
|
||||||
const float rec = 6378137; // earth radius, equator (?)
|
const float rec = 6378137; // earth radius, equator (?)
|
||||||
const float rpol = 6356752.314f; // earth radius, polar (?)
|
const float rpol = 6356752.314f; // earth radius, polar (?)
|
||||||
|
|
||||||
|
const double MINIMUM_SCALE = 0.002;
|
||||||
|
|
||||||
//Returns Earth radius at a given latitude (Ellipsoide equation with two equal axis)
|
//Returns Earth radius at a given latitude (Ellipsoide equation with two equal axis)
|
||||||
static float earth_radius_lat( float lat )
|
static float earth_radius_lat( float lat )
|
||||||
{
|
{
|
||||||
|
@ -547,12 +549,16 @@ void BaseDiagram::wheelEvent(QWheelEvent *we)
|
||||||
m_wheelAngleDeltaAccumulator += delta;
|
m_wheelAngleDeltaAccumulator += delta;
|
||||||
if (m_wheelAngleDeltaAccumulator > 120) {
|
if (m_wheelAngleDeltaAccumulator > 120) {
|
||||||
m_wheelAngleDeltaAccumulator = 0;
|
m_wheelAngleDeltaAccumulator = 0;
|
||||||
m_scale *= 2.0;
|
|
||||||
|
m_scale *= 1.5;
|
||||||
|
|
||||||
} else if (m_wheelAngleDeltaAccumulator < -120) {
|
} else if (m_wheelAngleDeltaAccumulator < -120) {
|
||||||
m_wheelAngleDeltaAccumulator = 0;
|
m_wheelAngleDeltaAccumulator = 0;
|
||||||
m_scale *= 0.5;
|
|
||||||
|
m_scale *= 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SG_CLAMP_RANGE(m_scale, MINIMUM_SCALE, 1.0);
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue