Skip to content

Commit

Permalink
roll back the empty painterpath generated by click mouse
Browse files Browse the repository at this point in the history
  • Loading branch information
sirius1242 committed Jan 30, 2020
1 parent 4bb735b commit b79c987
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions PaintPlugin/src/DkPaintPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ void DkPaintViewPort::mousePressEvent(QMouseEvent *event) {
if(QRectF(QPointF(), viewport->getImage().size()).contains(mapToImage(event->pos()))) {

isOutside = false;

// roll back the empty painterpath generated by click mouse
if(!paths.empty())
if(paths.last().isEmpty())
undoLastPaint();

// create new painterpath
paths.append(QPainterPath());
paths.last().moveTo(mapToImage(event->pos()));
//paths.last().lineTo(mapToImage(event->pos())+QPointF(0.1,0));
Expand Down

0 comments on commit b79c987

Please sign in to comment.