mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 08:41:02 +08:00
#0 [UI] Fixed zooming for charts (histogram, arbitrary value) with mouse wheel
This commit is contained in:
parent
2b75e65535
commit
b10965ee92
@ -539,12 +539,12 @@ void GraphicsSliderArea::wheelEvent(QWheelEvent* _event)
|
|||||||
{
|
{
|
||||||
const auto w = m_slider->halfwidth() * (_event->delta() < 0 ? profiler_gui::SCALING_COEFFICIENT : profiler_gui::SCALING_COEFFICIENT_INV);
|
const auto w = m_slider->halfwidth() * (_event->delta() < 0 ? profiler_gui::SCALING_COEFFICIENT : profiler_gui::SCALING_COEFFICIENT_INV);
|
||||||
setValue(mapToScene(_event->pos()).x() - m_minimumValue - w);
|
setValue(mapToScene(_event->pos()).x() - m_minimumValue - w);
|
||||||
emit EASY_GLOBALS.events.chartWheeled(w * m_windowScale, _event->delta());
|
emit EASY_GLOBALS.events.chartWheeled(m_value + w * m_windowScale, _event->delta());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto x = static_cast<qreal>(_event->pos().x()) / m_windowScale;
|
auto x = static_cast<qreal>(_event->pos().x()) / m_windowScale;
|
||||||
if (m_bBindMode)
|
if (m_bBindMode) // check m_bBindMode because it may differ from bindMode() for arbitrary value complexity chart
|
||||||
x *= sliderWidth() / range();
|
x *= sliderWidth() / range();
|
||||||
emit EASY_GLOBALS.events.chartWheeled(m_value + x, _event->delta());
|
emit EASY_GLOBALS.events.chartWheeled(m_value + x, _event->delta());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user