# HG changeset patch # User Teemu Piippo # Date 1655286117 -10800 # Node ID 011600b3cf73e9c8b0203a1c31b31048ee4d72a1 # Parent 60d6b797a12e983a2fc2e0551f0d477013e91384 Render line segments during draw mode nicer diff -r 60d6b797a12e -r 011600b3cf73 src/document.cpp --- a/src/document.cpp Wed Jun 15 12:33:16 2022 +0300 +++ b/src/document.cpp Wed Jun 15 12:41:57 2022 +0300 @@ -188,15 +188,18 @@ case DrawMode: painter->setPen(pens.polygonPen); for (const ModelAction& action : this->actions()) { - const opt> points = modelActionPoints(action); - if (points.has_value()) { - if (worldPolygonWinding(*points, this->renderer) == Winding::Clockwise) { + const std::vector points = modelActionPoints(action).value_or(std::vector{}); + if (points.size() == 2) { + drawWorldPolyline(painter, points, renderer); + } + else { + if (worldPolygonWinding(points, this->renderer) == Winding::Clockwise) { painter->setBrush(pens.greenPolygonBrush); } else { painter->setBrush(pens.redPolygonBrush); } - drawWorldPolygon(painter, *points, this->renderer); + drawWorldPolygon(painter, points, this->renderer); } } //drawWorldPolyline(painter, this->previewPolygon, this->renderer);