30#ifndef __ZOOM_CONTROLLER_H
31#define __ZOOM_CONTROLLER_H
66 using TIMEOUT = std::chrono::milliseconds;
69 using CLOCK = std::chrono::steady_clock;
72 using TIME_PT = std::chrono::time_point<CLOCK>;
75 static constexpr TIMEOUT DEFAULT_TIMEOUT = std::chrono::milliseconds( 500 );
78 static constexpr double DEFAULT_ACCELERATION_SCALE = 5.0;
102 const TIMEOUT& aAccTimeout = DEFAULT_TIMEOUT,
105 double GetScaleForRotation(
int aRotation )
override;
114 m_accTimeout = aNewTimeout;
131 bool m_prevRotationPositive =
false;
151 double GetScaleForRotation(
int aRotation )
override;
154 static constexpr double GTK3_SCALE = 0.002;
157 static constexpr double MAC_SCALE = 0.01;
160 static constexpr double MSW_SCALE = 0.005;
163 static constexpr double MANUAL_SCALE_FACTOR = 0.001;
virtual ~TIMESTAMP_PROVIDER()=default
virtual TIME_PT GetTimestamp()=0
Class that zooms faster if scroll events happen very close together.
void SetTimeout(const TIMEOUT &aNewTimeout)
std::chrono::time_point< CLOCK > TIME_PT
The default timeout, after which a another scroll will not be accelerated.
std::chrono::milliseconds TIMEOUT
The clock used for the timestamp (guaranteed to be monotonic).
TIME_PT m_prevTimestamp
The timeout value.
std::chrono::steady_clock CLOCK
The type of the time stamps.
double m_scale
A multiplier for the minimum zoom step size.
TIMESTAMP_PROVIDER * m_timestampProv
< The timestamp provider to use (might be provided externally).
TIMEOUT GetTimeout() const
std::unique_ptr< TIMESTAMP_PROVIDER > m_ownTimestampProv
The timestamp of the previous event.
A CONSTANT_ZOOM_CONTROLLER that zooms by a fixed factor based only on the magnitude of the scroll whe...
double m_scale
< The scale factor set by the constructor.
Handle the response of the zoom scale to external inputs.
virtual ~ZOOM_CONTROLLER()=default
virtual double GetScaleForRotation(int aRotation)=0
Get the scale factor produced by a given mousewheel rotation.
The Cairo implementation of the graphics abstraction layer.