src/document.cpp

changeset 227
011600b3cf73
parent 226
60d6b797a12e
child 228
948867719906
equal deleted inserted replaced
226:60d6b797a12e 227:011600b3cf73
186 case SelectMode: 186 case SelectMode:
187 break; 187 break;
188 case DrawMode: 188 case DrawMode:
189 painter->setPen(pens.polygonPen); 189 painter->setPen(pens.polygonPen);
190 for (const ModelAction& action : this->actions()) { 190 for (const ModelAction& action : this->actions()) {
191 const opt<std::vector<glm::vec3>> points = modelActionPoints(action); 191 const std::vector<glm::vec3> points = modelActionPoints(action).value_or(std::vector<glm::vec3>{});
192 if (points.has_value()) { 192 if (points.size() == 2) {
193 if (worldPolygonWinding(*points, this->renderer) == Winding::Clockwise) { 193 drawWorldPolyline(painter, points, renderer);
194 }
195 else {
196 if (worldPolygonWinding(points, this->renderer) == Winding::Clockwise) {
194 painter->setBrush(pens.greenPolygonBrush); 197 painter->setBrush(pens.greenPolygonBrush);
195 } 198 }
196 else { 199 else {
197 painter->setBrush(pens.redPolygonBrush); 200 painter->setBrush(pens.redPolygonBrush);
198 } 201 }
199 drawWorldPolygon(painter, *points, this->renderer); 202 drawWorldPolygon(painter, points, this->renderer);
200 } 203 }
201 } 204 }
202 //drawWorldPolyline(painter, this->previewPolygon, this->renderer); 205 //drawWorldPolyline(painter, this->previewPolygon, this->renderer);
203 painter->setBrush(pens.pointBrush); 206 painter->setBrush(pens.pointBrush);
204 painter->setPen(pens.pointPen); 207 painter->setPen(pens.pointPen);

mercurial