Commit ab2691e8 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix monitor preview messing monitor zoom

parent eadb5bb1
Pipeline #36392 passed with stage
in 11 minutes and 56 seconds
...@@ -1245,8 +1245,8 @@ QRect GLWidget::displayRect() const ...@@ -1245,8 +1245,8 @@ QRect GLWidget::displayRect() const
QPoint GLWidget::offset() const QPoint GLWidget::offset() const
{ {
return {m_offset.x() - ((int)((float)m_profileSize.width() * m_zoom) - width()) / 2, return {m_offset.x() - ((int) width() * m_zoom / 2),
m_offset.y() - ((int)((float)m_profileSize.height() * m_zoom) - height()) / 2}; m_offset.y() - ((int) height() * m_zoom / 2)};
} }
void GLWidget::setZoom(float zoom) void GLWidget::setZoom(float zoom)
......
...@@ -844,25 +844,23 @@ void Monitor::adjustScrollBars(float horizontal, float vertical) ...@@ -844,25 +844,23 @@ void Monitor::adjustScrollBars(float horizontal, float vertical)
{ {
if (m_glMonitor->zoom() > 1.0f) { if (m_glMonitor->zoom() > 1.0f) {
m_horizontalScroll->setPageStep(m_glWidget->width()); 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()))); m_horizontalScroll->setValue(qRound(horizontal * float(m_horizontalScroll->maximum())));
emit m_horizontalScroll->valueChanged(m_horizontalScroll->value()); emit m_horizontalScroll->valueChanged(m_horizontalScroll->value());
m_horizontalScroll->show(); m_horizontalScroll->show();
} else { } else {
int max = (int)((float)m_glMonitor->profileSize().width() * m_glMonitor->zoom()) - m_glWidget->width(); emit m_horizontalScroll->valueChanged(qRound(0.5 * m_glWidget->width() * m_glMonitor->zoom()));
emit m_horizontalScroll->valueChanged(qRound(0.5 * max));
m_horizontalScroll->hide(); m_horizontalScroll->hide();
} }
if (m_glMonitor->zoom() > 1.0f) { if (m_glMonitor->zoom() > 1.0f) {
m_verticalScroll->setPageStep(m_glWidget->height()); 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)); m_verticalScroll->setValue((int)((float)m_verticalScroll->maximum() * vertical));
emit m_verticalScroll->valueChanged(m_verticalScroll->value()); emit m_verticalScroll->valueChanged(m_verticalScroll->value());
m_verticalScroll->show(); m_verticalScroll->show();
} else { } else {
int max = (int)((float)m_glMonitor->profileSize().height() * m_glMonitor->zoom()) - m_glWidget->height(); emit m_verticalScroll->valueChanged(qRound(0.5 * m_glWidget->height() * m_glMonitor->zoom()));
emit m_verticalScroll->valueChanged(qRound(0.5 * max));
m_verticalScroll->hide(); 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