diff -r 000781318c36 -r b54b350dff5d src/tools/drawtool.cpp --- a/src/tools/drawtool.cpp Fri Jul 30 01:28:39 2021 +0300 +++ b/src/tools/drawtool.cpp Fri Aug 27 00:55:32 2021 +0300 @@ -10,6 +10,7 @@ static const QPen polygonPen = {QBrush{Qt::black}, 2.0, Qt::DashLine}; static const QPen pointPen = {QBrush{Qt::black}, 2.0}; static const QBrush polygonBrush = {QColor{64, 255, 128, 192}}; +static const QBrush badPolygonBrush = {QColor{255, 96, 96, 192}}; DrawTool::DrawTool(QObject* parent) : BaseTool{parent} {} @@ -83,6 +84,10 @@ { this->previewPolygon.resize(this->polygon.size() + 1); this->previewPolygon.back() = this->previewPoint; + if (this->previewPolygon.size() > 2) + { + this->isconcave = not geom::convex(this->previewPolygon); + } } void DrawTool::reset() @@ -92,7 +97,7 @@ void DrawTool::overpaint(Canvas* canvas, QPainter* painter) const { - painter->setBrush(::polygonBrush); + painter->setBrush(this->isconcave ? ::badPolygonBrush : ::polygonBrush); painter->setPen(::polygonPen); canvas->drawWorldPolygon(painter, this->previewPolygon); painter->setBrush(::pointBrush);