Skip to content

Commit 4b5112a

Browse files
committed
addImage fix
1 parent 65b265e commit 4b5112a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/DrawingWidget.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,10 +439,12 @@ void DrawingWidget::goNext(){
439439
loadImage(images.last_image_num);
440440
}
441441

442+
static int num_of_press = 0;
442443
void DrawingWidget::eventHandler(int source, int type, int id, QPointF pos, float pressure){
443444
int ev_pen = penType;
444445
switch(type) {
445446
case PRESS:
447+
num_of_press++;
446448
curs.drawing[id] = true;
447449
mergeSelection();
448450
imageBackup = image;
@@ -488,6 +490,7 @@ void DrawingWidget::eventHandler(int source, int type, int id, QPointF pos, floa
488490
penType = ev_pen;
489491
break;
490492
case RELEASE:
493+
num_of_press--;
491494
if(curEventButtons & Qt::LeftButton && geo.size(id) < 2) {
492495
addPoint(-1, pos+QPointF(0,1));
493496
drawLineToFunc(id, pressure);
@@ -504,7 +507,9 @@ void DrawingWidget::eventHandler(int source, int type, int id, QPointF pos, floa
504507

505508
curEventButtons = 0;
506509
curs.hide(id);
507-
addImage(image);
510+
if(num_of_press == 0) {
511+
addImage(image);
512+
}
508513
break;
509514
}
510515
}

0 commit comments

Comments
 (0)