| 631 | } |
| 632 | |
| 633 | UBGraphicsProtractor::Tool UBGraphicsProtractor::toolFromPos(QPointF pos) |
| 634 | { |
| 635 | pos = pos - rect().center(); |
| 636 | QLineF line(QPointF(0,0), pos); |
| 637 | QTransform t; |
| 638 | t.rotate(mStartAngle); |
| 639 | QPointF p1 = t.map(pos); |
| 640 | t.rotate(mCurrentAngle); |
| 641 | QPointF p2 = t.map(pos); |
| 642 | |
| 643 | |
| 644 | if (resizeButtonRect().contains(p1.x(),p1.y())) |
| 645 | return Resize; |
| 646 | |
| 647 | else if (closeButtonRect().contains(p1)) |
| 648 | return Close; |
| 649 | |
| 650 | else if (resetButtonRect().contains(p1)) |
| 651 | return Reset; |
| 652 | |
| 653 | else if (rotateButtonRect().contains(p1)) |
| 654 | return Rotate; |
| 655 | |
| 656 | else if (markerButtonRect().contains(p2)) |
| 657 | return MoveMarker; |
| 658 | |
| 659 | else if (line.length() <= radius()) |
| 660 | return Move; |
| 661 | |
| 662 | else |
| 663 | return None; |
| 664 | } |
| 665 | |
| 666 | |
| 667 | std::shared_ptr<UBGraphicsScene> UBGraphicsProtractor::scene() const |