Fix Delaunay point removal

This commit is contained in:
Maxime Gimeno 2020-06-02 14:08:03 +02:00
parent e28a3ac2cc
commit dd701e28fa
1 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,7 @@ protected:
Converter<K> convert;
QGraphicsScene *scene_;
Point p;
bool do_insert;
};
@ -44,7 +45,7 @@ template <typename T>
TriangulationPointInputAndConflictZone<T>::TriangulationPointInputAndConflictZone(QGraphicsScene* s,
T * dt_,
QObject* parent)
: GraphicsViewInput(parent), dt(dt_), scene_(s)
: GraphicsViewInput(parent), dt(dt_), scene_(s), do_insert(true)
{}
@ -54,6 +55,12 @@ template <typename T>
void
TriangulationPointInputAndConflictZone<T>::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
if(event->modifiers() & ::Qt::ShiftModifier){
do_insert = false;
return;
}
else
do_insert = true;
p = convert(event->scenePos());
if(dt->dimension() < 2 ||
event->modifiers() != 0 ||
@ -91,7 +98,8 @@ TriangulationPointInputAndConflictZone<T>::mouseReleaseEvent(QGraphicsSceneMouse
delete *it;
}
qfaces.clear();
Q_EMIT( generate(CGAL::make_object(p)));
if(do_insert)
Q_EMIT( generate(CGAL::make_object(p)));
}