Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
apply #2973
git-svn-id: http://svn.osgeo.org/qgis/trunk@14259 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Sep 19, 2010
1 parent 86c37b2 commit f2e5e4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/qgsmaptoolselectutils.cpp
Expand Up @@ -132,6 +132,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas,
QgsFeatureIds newSelectedFeatures;
QgsFeature f;
int closestFeatureId = 0;
bool foundSingleFeature = false;
double closestFeatureDist = std::numeric_limits<double>::max();
while ( vlayer->nextFeature( f ) )
{
Expand All @@ -142,6 +143,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas,
}
if ( singleSelect )
{
foundSingleFeature = true;
double distance = g->distance( selectGeomTrans );
if ( distance <= closestFeatureDist )
{
Expand All @@ -154,7 +156,7 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas,
newSelectedFeatures.insert( f.id() );
}
}
if ( singleSelect && closestFeatureId > 0 )
if ( singleSelect && foundSingleFeature )
{
newSelectedFeatures.insert( closestFeatureId );
}
Expand Down

0 comments on commit f2e5e4b

Please sign in to comment.