New feature: menu option toggle sticky vertices

This commit is contained in:
Alexandre Quessy
2014-10-14 01:48:00 -04:00
parent 39ee4903c7
commit 1b73d45a89
4 changed files with 28 additions and 2 deletions
+9 -2
View File
@@ -29,7 +29,8 @@ MapperGLCanvas::MapperGLCanvas(MainWindow* mainWindow, QWidget* parent, const QG
_activeVertex(NO_VERTEX),
_shapeGrabbed(false), // comment out?
_shapeFirstGrab(false), // comment out?
_displayControls(true)
_displayControls(true),
_stickyVertices(true)
{
}
@@ -156,7 +157,8 @@ void MapperGLCanvas::mouseMoveEvent(QMouseEvent* event)
p.setY(event->y());
// Stick to vertices.
glueVertex(shape, &p);
if (stickyVertices())
glueVertex(shape, &p);
shape->setVertex(_activeVertex, p);
update();
@@ -254,6 +256,11 @@ void MapperGLCanvas::enableDisplayControls(bool display)
updateCanvas();
}
void MapperGLCanvas::enableStickyVertices(bool value)
{
_stickyVertices = value;
}
/* Stick vertex p of Shape orig to another Shape's vertex, if the 2 vertices are
* close enough. The distance per coordinate is currently set in dist_stick
* variable. Perhaps the sticky-sensitivity should be configurable through GUI */