30#ifndef __ZOOM_CONTROLLER_H
31#define __ZOOM_CONTROLLER_H
65 using TIMEOUT = std::chrono::milliseconds;
68 using CLOCK = std::chrono::steady_clock;
71 using TIME_PT = std::chrono::time_point<CLOCK>;
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.
static constexpr TIMEOUT DEFAULT_TIMEOUT
The default minimum step factor for accelerating controller.
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.
bool m_prevRotationPositive
Previous rotation was positive.
double m_scale
A multiplier for the minimum zoom step size.
TIMESTAMP_PROVIDER * m_timestampProv
< The timestamp provider to use (might be provided externally).
double GetScaleForRotation(int aRotation) override
Get the scale factor produced by a given mousewheel rotation.
ACCELERATING_ZOOM_CONTROLLER(double aScale=DEFAULT_ACCELERATION_SCALE, const TIMEOUT &aAccTimeout=DEFAULT_TIMEOUT, TIMESTAMP_PROVIDER *aTimestampProv=nullptr)
TIMEOUT GetTimeout() const
static constexpr double DEFAULT_ACCELERATION_SCALE
std::unique_ptr< TIMESTAMP_PROVIDER > m_ownTimestampProv
The timestamp of the previous event.
A #ZOOM_CONTROLLER that zooms by a fixed factor based only on the magnitude of the scroll wheel rotat...
double GetScaleForRotation(int aRotation) override
A suitable (magic) scale factor for GTK3 systems.
static constexpr double MSW_SCALE
A suitable (magic) scale factor for Windows systems.
double m_scale
< The scale factor set by the constructor.
static constexpr double MAC_SCALE
CONSTANT_ZOOM_CONTROLLER(double aScale)
static constexpr double GTK3_SCALE
A suitable (magic) scale factor for Mac systems.
static constexpr double MANUAL_SCALE_FACTOR
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.