| 498 | } |
| 499 | |
| 500 | bool UBGraphicsScene::inputDeviceMove(const QPointF& scenePos, const qreal& pressure, Qt::KeyboardModifiers modifiers) |
| 501 | { |
| 502 | bool accepted = false; |
| 503 | |
| 504 | UBDrawingController *dc = UBDrawingController::drawingController(); |
| 505 | UBStylusTool::Enum currentTool = (UBStylusTool::Enum)dc->stylusTool(); |
| 506 | |
| 507 | QPointF position = QPointF(scenePos); |
| 508 | mCurrentPoint = position; |
| 509 | |
| 510 | if (currentTool == UBStylusTool::Eraser) |
| 511 | { |
| 512 | drawEraser(position, mInputDeviceIsPressed); |
| 513 | accepted = true; |
| 514 | } |
| 515 | |
| 516 | else if (currentTool == UBStylusTool::Marker) { |
| 517 | if (mInputDeviceIsPressed) |
| 518 | hideMarkerCircle(); |
| 519 | else { |
| 520 | drawMarkerCircle(position); |
| 521 | accepted = true; |
| 522 | } |
| 523 | } |
| 524 | |
| 525 | else if (currentTool == UBStylusTool::Pen) { |
| 526 | if (mInputDeviceIsPressed) |
| 527 | hidePenCircle(); |
| 528 | else { |
| 529 | drawPenCircle(position); |
| 530 | accepted = true; |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | if (mInputDeviceIsPressed) |
| 535 | { |
| 536 | if (dc->isDrawingTool()) |
| 537 | { |
| 538 | qreal width = 0; |
| 539 | |
| 540 | if (currentTool != UBStylusTool::Line){ |
| 541 | // Handle the pressure |
| 542 | width = dc->currentToolWidth() * qMax(pressure, 0.2); |
| 543 | }else{ |
| 544 | // Ignore pressure for line tool |
| 545 | width = dc->currentToolWidth(); |
| 546 | } |
| 547 | |
| 548 | width /= UBApplication::boardController->systemScaleFactor(); |
| 549 | width /= UBApplication::boardController->currentZoom(); |
| 550 | |
| 551 | std::optional<QPointF> altPosition; |
| 552 | |
| 553 | if (currentTool == UBStylusTool::Line || dc->activeRuler()) |
| 554 | { |
| 555 | if (UBDrawingController::drawingController()->stylusTool() != UBStylusTool::Marker) |
| 556 | if(NULL != mpLastPolygon && NULL != mCurrentStroke && mAddedItems.size() > 0){ |
| 557 | UBCoreGraphicsScene::removeItemFromDeletion(mpLastPolygon); |
no test coverage detected