From 0f5159a748cae1d98dc09f5ccd8481223320fdde Mon Sep 17 00:00:00 2001 From: lupoDharkael Date: Tue, 10 Apr 2018 18:57:03 +0200 Subject: [PATCH] Prevent the selection from leaving the area --- src/widgets/capture/capturewidget.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index d32b9612..2dffb57f 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -418,8 +418,11 @@ void CaptureWidget::mouseReleaseEvent(QMouseEvent *e) { m_activeTool = nullptr; } - // Show the buttons after the creation of a new selection + // Show the buttons after the resize of the selection or the creation + // of a new one. if (!m_buttonHandler->isVisible() && !m_context.selection.isNull()) { + // Don't go outside + m_context.selection = m_context.selection.intersected(rect()); updateSizeIndicator(); m_buttonHandler->updatePosition(m_context.selection); m_buttonHandler->show();