Skip to content

Commit

Permalink
Fix selection offset (flameshot-org#2630)
Browse files Browse the repository at this point in the history
Signed-off-by: Haris Gušić <[email protected]>
  • Loading branch information
veracioux authored May 31, 2022
1 parent 1b97fb5 commit 0116740
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/widgets/capture/selectionwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,17 @@ void SelectionWidget::parentMouseMoveEvent(QMouseEvent* e)
mouseSide = getMouseSide(e->pos());
}

QPoint pos;

if (!isVisible() || !mouseSide) {
show();
m_dragStartPos = e->pos();
m_activeSide = TOPLEFT_SIDE;
setGeometry({ e->pos(), e->pos() });
pos = m_dragStartPos;
setGeometry({ pos, pos });
} else {
pos = e->pos();
}

QPoint pos = e->pos();
auto geom = geometry();
bool symmetryMod = qApp->keyboardModifiers() & Qt::ShiftModifier;

Expand Down Expand Up @@ -280,7 +283,7 @@ void SelectionWidget::parentMouseMoveEvent(QMouseEvent* e)
setGeometry(geom.normalized());
m_activeSide = getProperSide(m_activeSide, geom);
}
m_dragStartPos = pos;
m_dragStartPos = e->pos();
}

void SelectionWidget::paintEvent(QPaintEvent*)
Expand Down

0 comments on commit 0116740

Please sign in to comment.