Fix edit buttons appearing inside selection (#1856)
* Fix edit buttons appearing inside selection * Reformat files
This commit is contained in:
@@ -246,27 +246,32 @@ void ButtonHandler::resetRegionTrack()
|
||||
|
||||
void ButtonHandler::updateBlockedSides()
|
||||
{
|
||||
QRegion screenRegion{};
|
||||
for (const QRect& rect : m_screenRegions) {
|
||||
screenRegion += rect;
|
||||
}
|
||||
|
||||
const int EXTENSION = m_separator * 2 + m_buttonBaseSize;
|
||||
// Right
|
||||
QPoint pointA(m_selection.right() + EXTENSION, m_selection.bottom());
|
||||
QPoint pointB(pointA.x(), m_selection.top());
|
||||
m_blockedRight =
|
||||
!(m_screenRegions.contains(pointA) && m_screenRegions.contains(pointB));
|
||||
!(screenRegion.contains(pointA) && screenRegion.contains(pointB));
|
||||
// Left
|
||||
pointA.setX(m_selection.left() - EXTENSION);
|
||||
pointB.setX(pointA.x());
|
||||
m_blockedLeft =
|
||||
!(m_screenRegions.contains(pointA) && m_screenRegions.contains(pointB));
|
||||
!(screenRegion.contains(pointA) && screenRegion.contains(pointB));
|
||||
// Bottom
|
||||
pointA = QPoint(m_selection.left(), m_selection.bottom() + EXTENSION);
|
||||
pointB = QPoint(m_selection.right(), pointA.y());
|
||||
m_blockedBotton =
|
||||
!(m_screenRegions.contains(pointA) && m_screenRegions.contains(pointB));
|
||||
!(screenRegion.contains(pointA) && screenRegion.contains(pointB));
|
||||
// Top
|
||||
pointA.setY(m_selection.top() - EXTENSION);
|
||||
pointB.setY(pointA.y());
|
||||
m_blockedTop =
|
||||
!(m_screenRegions.contains(pointA) && m_screenRegions.contains(pointB));
|
||||
!(screenRegion.contains(pointA) && screenRegion.contains(pointB));
|
||||
// Auxiliary
|
||||
m_oneHorizontalBlocked =
|
||||
(!m_blockedRight && m_blockedLeft) || (m_blockedRight && !m_blockedLeft);
|
||||
@@ -377,13 +382,10 @@ bool ButtonHandler::contains(const QPoint& p) const
|
||||
|
||||
void ButtonHandler::updateScreenRegions(const QVector<QRect>& rects)
|
||||
{
|
||||
m_screenRegions = QRegion();
|
||||
for (const QRect& rect : rects) {
|
||||
m_screenRegions += rect;
|
||||
}
|
||||
m_screenRegions = rects;
|
||||
}
|
||||
|
||||
void ButtonHandler::updateScreenRegions(const QRect& rect)
|
||||
{
|
||||
m_screenRegions = QRegion(rect);
|
||||
m_screenRegions = { rect };
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
|
||||
QVector<CaptureToolButton*> m_vectorButtons;
|
||||
|
||||
QRegion m_screenRegions;
|
||||
QVector<QRect> m_screenRegions;
|
||||
|
||||
QRect m_selection;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user