From a6adfc58b6537b5622863be47a670f027ee5c0c8 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Sat, 22 Apr 2023 14:11:09 +0200 Subject: [PATCH] Sketcher: Fix overlapped points not selecting/preselecting ========================================================= Fixes an issue reported directly by Chrisb. On overlapping points, such as due to coincidence, selection and preselection (e.g. from the ElementsWidget) is not shown for those points which are rendered first. Solution: To raise the points to the highlight height. --- .../Sketcher/Gui/EditModeGeometryCoinManager.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp index 0c23360ec5..a3bc8f1b1b 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp @@ -252,6 +252,12 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade & geol auto preselectcross = ViewProviderSketchCoinAttorney::getPreselectCross(viewProvider); auto preselectcurve = ViewProviderSketchCoinAttorney::getPreselectCurve(viewProvider); + auto raisePoint = [](SbVec3f & point, float height) { + float x, y, z; + point.getValue(x, y, z); + point.setValue(x, y, height); + }; + MultiFieldId preselectpointmfid; if ( preselectcross == 0) { @@ -262,16 +268,22 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade & geol preselectpointmfid = coinMapping.getIndexLayer(preselectpoint); if (MultiFieldId::Invalid != preselectpointmfid && preselectpointmfid.layerId == l && - preselectpointmfid.fieldIndex < PtNum) + preselectpointmfid.fieldIndex < PtNum) { + pcolor[preselectpointmfid.fieldIndex] = drawingParameters.PreselectColor; + + raisePoint(pverts[preselectpointmfid.fieldIndex], drawingParameters.zHighlight); + } } ViewProviderSketchCoinAttorney::executeOnSelectionPointSet(viewProvider, - [pcolor, PtNum, preselectpointmfid, layerId = l, &coinMapping = coinMapping, drawingParameters = this->drawingParameters](const int i) { + [pcolor, pverts, PtNum, preselectpointmfid, layerId = l, &coinMapping = coinMapping, drawingParameters = this->drawingParameters, raisePoint](const int i) { auto pointindex = coinMapping.getIndexLayer(i); if (layerId == pointindex.layerId && pointindex.fieldIndex >= 0 && pointindex.fieldIndex < PtNum) { pcolor[pointindex.fieldIndex] = (preselectpointmfid == pointindex) ? drawingParameters.PreselectSelectedColor : drawingParameters.SelectColor; + + raisePoint(pverts[pointindex.fieldIndex], drawingParameters.zHighlight); } });