Skip to content

Commit d5c22fa

Browse files
committed
clear code
clear code after code review by Vekhir
1 parent 5ad0a9c commit d5c22fa

2 files changed

Lines changed: 8 additions & 16 deletions

File tree

src/domain/UBGraphicsScene.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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()
31503150
void 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

src/domain/UBGraphicsScene.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,6 @@ public slots:
505505

506506
UBGraphicsCache* mGraphicsCache;
507507

508-
QPointF lastPoint_m, endPoint_m;
509508
QList<QLineF> multiDrawLines;
510509
};
511510

0 commit comments

Comments
 (0)