@@ -716,10 +716,10 @@ bool UBGraphicsScene::inputDeviceRelease(int tool)
716716 addPolygonItemToCurrentStroke (poly);
717717 }
718718
719- if (multiDrawLines.isEmpty ()) // is it not polygons drawing by multiDraw
720719 // replace the stroke by a simplified version of it
721- if ((currentTool == UBStylusTool::Pen && UBSettings::settings ()->boardSimplifyPenStrokes ->get ().toBool ())
722- || (currentTool == UBStylusTool::Marker && UBSettings::settings ()->boardSimplifyMarkerStrokes ->get ().toBool ()))
720+ if (multiDrawLines.isEmpty () && // is it not polygons drawing by multiDraw
721+ ((currentTool == UBStylusTool::Pen && UBSettings::settings ()->boardSimplifyPenStrokes ->get ().toBool ())
722+ || (currentTool == UBStylusTool::Marker && UBSettings::settings ()->boardSimplifyMarkerStrokes ->get ().toBool ())))
723723 {
724724 simplifyCurrentStroke ();
725725 }
@@ -3150,22 +3150,16 @@ void UBGraphicsScene::initStroke()
31503150void UBGraphicsScene::MultiTouchDrawing (QTouchEvent* event, UBStylusTool::Enum currentTool)
31513151{
31523152 QList <QTouchEvent::TouchPoint> touchPoints = event->touchPoints ();
3153+ QPointF lastPoint, endPoint;
31533154 foreach (QTouchEvent::TouchPoint point, touchPoints)
31543155 {
3155- lastPoint_m = point.lastPos ();
3156- endPoint_m = point.pos ();
3157-
3158- int distance = sqrt (pow ((lastPoint_m.x () - endPoint_m.x ()),2 ) + pow ((lastPoint_m.y () - endPoint_m.y ()),2 )) + 1 ;
3159- distance = sqrt (distance);
3160- if (distance > 6 )
3161- distance = 6 ;
3162- else if (distance < 4 )
3163- distance = 4 ;
3156+ lastPoint = point.lastPos ();
3157+ endPoint = point.pos ();
31643158
31653159 UBBoardView* boardView = controlView ();
31663160 QLineF line;
3167- line.setP1 (boardView->mapToScene (UBGeometryUtils::pointConstrainedInRect (lastPoint_m .toPoint (), boardView->rect ())));
3168- line.setP2 (boardView->mapToScene (UBGeometryUtils::pointConstrainedInRect (endPoint_m .toPoint (), boardView->rect ())));
3161+ line.setP1 (boardView->mapToScene (UBGeometryUtils::pointConstrainedInRect (lastPoint .toPoint (), boardView->rect ())));
3162+ line.setP2 (boardView->mapToScene (UBGeometryUtils::pointConstrainedInRect (endPoint .toPoint (), boardView->rect ())));
31693163 if (!multiDrawLines.contains (line)) // to eliminate duplicates
31703164 {
31713165 multiDrawLines.append (line);
@@ -3182,7 +3176,6 @@ void UBGraphicsScene::MultiTouchDrawing(QTouchEvent* event, UBStylusTool::Enum c
31823176 addPolygonItemToCurrentStroke (polygonItem);
31833177 }
31843178
3185- lastPoint_m = endPoint_m;
31863179 }
31873180}
31883181
0 commit comments