Commit a6937dc3 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Fix monitor preview messing monitor zoom

parent ef83deec
......@@ -1245,8 +1245,8 @@ QRect GLWidget::displayRect() const
QPoint GLWidget::offset() const
{
return {m_offset.x() - ((int)((float)m_profileSize.width() * m_zoom) - width()) / 2,
m_offset.y() - ((int)((float)m_profileSize.height() * m_zoom) - height()) / 2};
return {m_offset.x() - ((int) width() * m_zoom / 2),
m_offset.y() - ((int) height() * m_zoom / 2)};
}
void GLWidget::setZoom(float zoom)
......
......@@ -843,25 +843,23 @@ void Monitor::adjustScrollBars(float horizontal, float vertical)
{
if (m_glMonitor->zoom() > 1.0f) {
m_horizontalScroll->setPageStep(m_glWidget->width());
m_horizontalScroll->setMaximum((int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_horizontalScroll->pageStep());
m_horizontalScroll->setMaximum(m_glWidget->width() * m_glMonitor->zoom());
m_horizontalScroll->setValue(qRound(horizontal * float(m_horizontalScroll->maximum())));
emit m_horizontalScroll->valueChanged(m_horizontalScroll->value());
m_horizontalScroll->show();
} else {
int max = (int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_glWidget->width();
emit m_horizontalScroll->valueChanged(qRound(0.5 * max));
emit m_horizontalScroll->valueChanged(qRound(0.5 * m_glWidget->width() * m_glMonitor->zoom()));
m_horizontalScroll->hide();
}
if (m_glMonitor->zoom() > 1.0f) {
m_verticalScroll->setPageStep(m_glWidget->height());
m_verticalScroll->setMaximum((int)((float)m_glMonitor->profileSize().height() * m_glMonitor->zoom()) - m_verticalScroll->pageStep());
m_verticalScroll->setMaximum(m_glWidget->height() * m_glMonitor->zoom());
m_verticalScroll->setValue((int)((float)m_verticalScroll->maximum() * vertical));
emit m_verticalScroll->valueChanged(m_verticalScroll->value());
m_verticalScroll->show();
} else {
int max = (int)((float)m_glMonitor->profileSize().height() * m_glMonitor->zoom()) - m_glWidget->height();
emit m_verticalScroll->valueChanged(qRound(0.5 * max));
emit m_verticalScroll->valueChanged(qRound(0.5 * m_glWidget->height() * m_glMonitor->zoom()));
m_verticalScroll->hide();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment