Mercurial > hg > svgui
changeset 846:f84f1828420b
Clarify some sneaky logic
author | Chris Cannam |
---|---|
date | Wed, 03 Sep 2014 11:41:58 +0100 |
parents | 0f5961c1bb6c |
children | 312b92ffb04e |
files | layer/RegionLayer.cpp |
diffstat | 1 files changed, 16 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/layer/RegionLayer.cpp Wed Sep 03 11:33:57 2014 +0100 +++ b/layer/RegionLayer.cpp Wed Sep 03 11:41:58 2014 +0100 @@ -47,6 +47,10 @@ SingleColourLayer(), m_model(0), m_editing(false), + m_dragPointX(0), + m_dragPointY(0), + m_dragStartX(0), + m_dragStartY(0), m_originalPoint(0, 0.0, 0, tr("New Region")), m_editingPoint(0, 0.0, 0, tr("New Region")), m_editingCommand(0), @@ -564,13 +568,21 @@ i = close.begin(); // Scan through the close points first, then the more distant ones - // if no suitable close one is found + // if no suitable close one is found. So the while-termination + // condition here can only happen once i has passed through the + // whole of the close container and then the whole of the separate + // points container. The two iterators are totally distinct, but + // have the same type so we cheekily use the same variable and a + // single loop for both. while (i != points.end()) { - if (i == close.end()) { - i = points.begin(); - distant = true; + if (!distant) { + if (i == close.end()) { + // switch from the close container to the points container + i = points.begin(); + distant = true; + } } if (snap == SnapRight) {