MCPcopy Create free account
hub / github.com/OpenBoard-org/OpenBoard / inputDeviceMove

Method inputDeviceMove

src/domain/UBGraphicsScene.cpp:500–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498}
499
500bool 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);

Callers 2

UBBoardView.cppFile · 0.80
mouseMoveEventMethod · 0.80

Calls 15

stylusToolMethod · 0.80
isDrawingToolMethod · 0.80
currentToolWidthMethod · 0.80
systemScaleFactorMethod · 0.80
currentZoomMethod · 0.80
activeRulerMethod · 0.80
emptyMethod · 0.80
polygonsMethod · 0.80
setAngleMethod · 0.80
currentEraserWidthMethod · 0.80
sizeMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected