MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / updateDrawHover

Method updateDrawHover

src/tools/draw_path_tool.cpp:644–668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642}
643
644void DrawPathTool::updateDrawHover()
645{
646 if (!shift_pressed)
647 angle_helper->getConstrainedCursorPosMap(cur_pos_map, constrained_pos_map);
648 if (!previous_point_is_curve_point && !left_mouse_down && editingInProgress())
649 {
650 // Show a line to the cursor position as preview
651 hidePreviewPoints();
652
653 if (!path_has_preview_point)
654 {
655 preview_path->addCoordinate(MapCoord(constrained_pos_map));
656 path_has_preview_point = true;
657 }
658 preview_path->setCoordinate(preview_path->getCoordinateCount() - 1, MapCoord(constrained_pos_map));
659
660 updatePreviewPath();
661 updateDirtyRect(); // TODO: Possible optimization: mark only the last segment as dirty
662 }
663 else if (previous_point_is_curve_point && !left_mouse_down && editingInProgress())
664 {
665 setPreviewPointsPosition(constrained_pos_map, 1);
666 updateDirtyRect();
667 }
668}
669
670void DrawPathTool::createPreviewCurve(MapCoord position, qreal direction)
671{

Callers

nothing calls this directly

Calls 5

setCoordinateMethod · 0.80
getCoordinateCountMethod · 0.80
MapCoordClass · 0.50
addCoordinateMethod · 0.45

Tested by

no test coverage detected