src/tools/drawtool.cpp

changeset 164
8305e2f968fb
parent 163
36ea1a8aee33
child 168
24590af32ad6
equal deleted inserted replaced
163:36ea1a8aee33 164:8305e2f968fb
114 114
115 void DrawTool::overpaint(Canvas* canvas, QPainter* painter) const 115 void DrawTool::overpaint(Canvas* canvas, QPainter* painter) const
116 { 116 {
117 painter->setBrush(this->isconcave ? ::badPolygonBrush : ::polygonBrush); 117 painter->setBrush(this->isconcave ? ::badPolygonBrush : ::polygonBrush);
118 painter->setPen(::polygonPen); 118 painter->setPen(::polygonPen);
119 canvas->drawWorldPolygon(painter, this->previewPolygon); 119 if (this->previewPolygon.size() > 2)
120 {
121 canvas->drawWorldPolygon(painter, this->previewPolygon);
122 }
123 else
124 {
125 canvas->drawWorldPolyline(painter, this->previewPolygon);
126 }
120 painter->setBrush(::pointBrush); 127 painter->setBrush(::pointBrush);
121 painter->setPen(::pointPen); 128 painter->setPen(::pointPen);
122 for (const glm::vec3& point : this->polygon) 129 for (const glm::vec3& point : this->polygon)
123 { 130 {
124 canvas->drawWorldPoint(painter, point); 131 canvas->drawWorldPoint(painter, point);

mercurial