37 using namespace KIGFX;
49 return ACCELERATING_ZOOM_CONTROLLER::CLOCK::now();
56 m_accTimeout( aAccTimeout ),
76 const double minStep = 1.05;
79 auto timeDiff = std::chrono::duration_cast<TIMEOUT>( timestamp -
m_lastTimestamp );
84 wxString::Format(
"Rot %d, time diff: %ldms", aRotation, (
long)timeDiff.count() ) );
94 zoomScale = std::max( zoomScale, minStep );
97 zoomScale = 1.0 / zoomScale;
101 zoomScale = ( aRotation > 0 ) ? minStep : 1 / minStep;
119 aRotation = ( aRotation > 0 ) ? std::min( aRotation, 100 ) : std::max( aRotation, -100 );
121 double dscale = aRotation *
m_scale;
123 double zoom_scale = ( aRotation > 0 ) ? ( 1 + dscale ) : 1 / ( 1 - dscale );
double GetScaleForRotation(int aRotation) override
Get the scale factor produced by a given mousewheel rotation.
const wxChar *const traceZoomScroll
Flag to enable debug output of zoom-scrolling calculations in KIGFX::ZOOM_CONTROLLER and derivatives.
The Cairo implementation of the graphics abstraction layer.
std::chrono::time_point< CLOCK > TIME_PT
The default timeout, after which a another scroll will not be accelerated.
CONSTANT_ZOOM_CONTROLLER(double aScale)
TIME_PT m_lastTimestamp
The timeout value.
static constexpr TIMEOUT DEFAULT_TIMEOUT
The default minimum step factor for accelerating controller.
double m_scale
A multiplier for the minimum zoom step size.
TIMESTAMP_PROVIDER * m_timestampProv
< The timestamp provider to use (might be provided externally).
ACCELERATING_ZOOM_CONTROLLER(double aScale=DEFAULT_ACCELERATION_SCALE, const TIMEOUT &aAccTimeout=DEFAULT_TIMEOUT, TIMESTAMP_PROVIDER *aTimestampProv=nullptr)
static constexpr double GTK3_SCALE
A suitable (magic) scale factor for Mac systems.
std::chrono::milliseconds TIMEOUT
The clock used for the timestamp (guaranteed to be monotonic).
double m_scale
< The scale factor set by the constructor.
static constexpr double MAC_SCALE
Multiplier for manual scale ssetting.
wxLogTrace helper definitions.
double GetScaleForRotation(int aRotation) override
A suitable (magic) scale factor for GTK3 systems.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
A very simple timestamper that uses the KIGFX::ACCELERATING_ZOOM_CONTROLLER::CLOCK to provide a times...
virtual TIME_PT GetTimestamp()=0
std::unique_ptr< TIMESTAMP_PROVIDER > m_ownTimestampProv
The timestamp of the last event.
ACCELERATING_ZOOM_CONTROLLER::TIME_PT GetTimestamp() override