From: vsv Date: Wed, 13 May 2020 09:06:59 +0000 (+0300) Subject: bos #19051: EDF - selection by polygon is almost freezing the computer X-Git-Tag: V9_5_0b1~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fvsv%2F19051_POLYGON_SELECTION;p=modules%2Fgui.git bos #19051: EDF - selection by polygon is almost freezing the computer --- diff --git a/src/OCCViewer/OCCViewer_ViewSketcher.cxx b/src/OCCViewer/OCCViewer_ViewSketcher.cxx index bd31ff3b3..6e2cbc007 100644 --- a/src/OCCViewer/OCCViewer_ViewSketcher.cxx +++ b/src/OCCViewer/OCCViewer_ViewSketcher.cxx @@ -473,7 +473,7 @@ void OCCViewer_PolygonSketcher::onMouse( QMouseEvent* e ) if ( e->type() == QEvent::MouseButtonRelease && ( e->button() & sketchButton() ) ) { - myResult = closed? Accept : Reject; + myResult = (closed && (points->count() > 2)) ? Accept : Reject; QApplication::postEvent( avp, new QMouseEvent( e->type(), e->pos(), e->globalPos(), e->button(), e->buttons(), e->modifiers() ) ); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index a7a0bab06..da790e081 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -3178,7 +3178,7 @@ void OCCViewer_ViewWindow::onSketchingFinished() case Polygon: { QPolygon* aPolygon = (QPolygon*)mypSketcher->data(); - if( aPolygon ) + if( aPolygon && (aPolygon->size() > 2)) { int size = aPolygon->size(); TColgp_Array1OfPnt2d anArray(1, size);