diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 8e33b9e86..396891642 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -716,10 +716,10 @@ bool UBGraphicsScene::inputDeviceRelease(int tool) addPolygonItemToCurrentStroke(poly); } - if(multiDrawLines.isEmpty()) // is it not polygons drawing by multiDraw // replace the stroke by a simplified version of it - if ((currentTool == UBStylusTool::Pen && UBSettings::settings()->boardSimplifyPenStrokes->get().toBool()) - || (currentTool == UBStylusTool::Marker && UBSettings::settings()->boardSimplifyMarkerStrokes->get().toBool())) + if(multiDrawLines.isEmpty() && // is it not polygons drawing by multiDraw + ((currentTool == UBStylusTool::Pen && UBSettings::settings()->boardSimplifyPenStrokes->get().toBool()) + || (currentTool == UBStylusTool::Marker && UBSettings::settings()->boardSimplifyMarkerStrokes->get().toBool()))) { simplifyCurrentStroke(); } @@ -3150,22 +3150,16 @@ void UBGraphicsScene::initStroke() void UBGraphicsScene::MultiTouchDrawing(QTouchEvent* event, UBStylusTool::Enum currentTool) { QList touchPoints = event->touchPoints(); + QPointF lastPoint, endPoint; foreach (QTouchEvent::TouchPoint point, touchPoints) { - lastPoint_m = point.lastPos(); - endPoint_m = point.pos(); - - int distance = sqrt(pow((lastPoint_m.x() - endPoint_m.x()),2) + pow((lastPoint_m.y() - endPoint_m.y()),2)) + 1; - distance = sqrt(distance); - if (distance > 6) - distance = 6; - else if(distance < 4) - distance = 4; + lastPoint = point.lastPos(); + endPoint = point.pos(); UBBoardView* boardView = controlView(); QLineF line; - line.setP1(boardView->mapToScene(UBGeometryUtils::pointConstrainedInRect(lastPoint_m.toPoint(), boardView->rect()))); - line.setP2(boardView->mapToScene(UBGeometryUtils::pointConstrainedInRect(endPoint_m.toPoint(), boardView->rect()))); + line.setP1(boardView->mapToScene(UBGeometryUtils::pointConstrainedInRect(lastPoint.toPoint(), boardView->rect()))); + line.setP2(boardView->mapToScene(UBGeometryUtils::pointConstrainedInRect(endPoint.toPoint(), boardView->rect()))); if (!multiDrawLines.contains(line)) // to eliminate duplicates { multiDrawLines.append(line); @@ -3182,7 +3176,6 @@ void UBGraphicsScene::MultiTouchDrawing(QTouchEvent* event, UBStylusTool::Enum c addPolygonItemToCurrentStroke(polygonItem); } - lastPoint_m = endPoint_m; } } diff --git a/src/domain/UBGraphicsScene.h b/src/domain/UBGraphicsScene.h index 207bd7a27..601ec8e2c 100644 --- a/src/domain/UBGraphicsScene.h +++ b/src/domain/UBGraphicsScene.h @@ -505,7 +505,6 @@ public slots: UBGraphicsCache* mGraphicsCache; - QPointF lastPoint_m, endPoint_m; QList multiDrawLines; };