| 602 | } |
| 603 | |
| 604 | void EditPointTool::drawImpl(QPainter* painter, MapWidget* widget) |
| 605 | { |
| 606 | auto num_selected_objects = map()->selectedObjects().size(); |
| 607 | if (num_selected_objects > 0) |
| 608 | { |
| 609 | drawSelectionOrPreviewObjects(painter, widget, bool(text_editor)); |
| 610 | |
| 611 | if (!text_editor) |
| 612 | { |
| 613 | Object* object = *map()->selectedObjectsBegin(); |
| 614 | if (num_selected_objects == 1 && |
| 615 | object->getType() == Object::Text && |
| 616 | !object->asText()->hasSingleAnchor()) |
| 617 | { |
| 618 | drawBoundingPath(painter, widget, object->asText()->controlPoints(), hover_state.testFlag(OverFrame) ? active_color : selection_color); |
| 619 | } |
| 620 | else if (selection_extent.isValid()) |
| 621 | { |
| 622 | auto active = hover_state.testFlag(OverFrame) && !hover_state.testFlag(OverObjectNode); |
| 623 | drawBoundingBox(painter, widget, selection_extent, active ? active_color : selection_color); |
| 624 | } |
| 625 | |
| 626 | if (num_selected_objects <= max_objects_for_handle_display) |
| 627 | { |
| 628 | for (const auto* object: map()->selectedObjects()) |
| 629 | { |
| 630 | auto active = hover_state.testFlag(OverObjectNode) && hover_object == object; |
| 631 | auto hover_point = active ? this->hover_point : no_point; |
| 632 | pointHandles().draw(painter, widget, object, hover_point, true, PointHandles::NormalHandleState); |
| 633 | } |
| 634 | } |
| 635 | } |
| 636 | } |
| 637 | |
| 638 | // Text editor |
| 639 | if (text_editor) |
| 640 | { |
| 641 | painter->save(); |
| 642 | widget->applyMapTransform(painter); |
| 643 | text_editor->draw(painter, widget); |
| 644 | painter->restore(); |
| 645 | } |
| 646 | |
| 647 | // Box selection |
| 648 | if (isDragging() && box_selection) |
| 649 | drawSelectionBox(painter, widget, click_pos_map, cur_pos_map); |
| 650 | } |
| 651 | |
| 652 | void EditPointTool::finishEditing() |
| 653 | { |
nothing calls this directly
no test coverage detected