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>;
virtual ~TIMESTAMP_PROVIDER()=default
virtual TIME_PT GetTimestamp()=0
void SetTimeout(const TIMEOUT &aNewTimeout)
std::chrono::time_point< CLOCK > TIME_PT
The type of the time stamps.
std::chrono::milliseconds TIMEOUT
The type of the acceleration timeout.
static constexpr TIMEOUT DEFAULT_TIMEOUT
The default timeout, after which a another scroll will not be accelerated.
TIME_PT m_prevTimestamp
The timestamp of the previous event.
TIMEOUT m_accTimeout
The timeout value.
std::chrono::steady_clock CLOCK
The clock used for the timestamp (guaranteed to be monotonic).
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
The default minimum step factor for accelerating controller.
std::unique_ptr< TIMESTAMP_PROVIDER > m_ownTimestampProv
Any provider owned by this class (the default one, if used).
double GetScaleForRotation(int aRotation) override
Get the scale factor produced by a given mousewheel rotation.
static constexpr double MAC_SCALE
A suitable (magic) scale factor for Mac systems.
double m_scale
The scale factor set by the constructor.
CONSTANT_ZOOM_CONTROLLER(double aScale)
static constexpr double MSW_SCALE
A suitable (magic) scale factor for Windows systems.
static constexpr double GTK3_SCALE
A suitable (magic) scale factor for GTK3 systems.
static constexpr double MANUAL_SCALE_FACTOR
Multiplier for manual scale ssetting.
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.