mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-19 06:53:02 +00:00
Design: vertex picking — a click near a corner takes the corner
Completes the precedence Tommaso asked for: vertex, then edge, then face, all from ONE click, all decided in screen pixels. Verified on :11 by sweeping into the right corner of a plate — x=1250 and 1290 report "face 5 selected", x=1308, 1318 and 1323 report "vertex selected" — and the cyan marker lands exactly on the corner in the render. The vertex tolerance (11 px) is deliberately LARGER than the edge one (8 px). A corner lies ON its edges, so equal radii would make vertices unreachable: every click near one would resolve to the edge underneath. Bigger-wins-first is what makes the smallest entity actually pickable. Vertices come from the sampled edge polylines' endpoints rather than a separate topology walk — every corner of a face is the end of one of its edges, so the data was already in hand. The highlight is a camera-facing square scaled by 1/zoom, the same trick the edge ribbon uses, so it reads as a constant dot at any zoom. This is why vertex picking did not ship with the previous commit: the Edge render path billboards a ribbon and degenerates on a two-point input, and a selection you cannot see is not a selection (L5). Better to add the primitive than to fake the feature. DesignPanel now distinguishes level 4: a picked corner sets neither face nor edge, because a corner is not its face, and the offer classifies it as OfferSel::Vertex — where Plane, Axis and Coord Sys already accept it. snaporca-9xw (rubber band still open — see the issue).
This commit is contained in:
@@ -3117,8 +3117,9 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
if (m_viewport->moving_body()) m_viewport->clear_move_gizmo();
|
||||
// Remember which body + face/edge so Extrude / dress-up target the RIGHT body.
|
||||
m_sel_solid_body = (level >= 1) ? body : -1;
|
||||
m_sel_solid_face = (level >= 2) ? face : -1;
|
||||
m_sel_solid_face = (level == 2) ? face : -1; // 4 = Vertex: a corner is not its face
|
||||
m_sel_solid_edge = (level == 3) ? edge : -1;
|
||||
m_sel_solid_vertex = (level == 4);
|
||||
// Keep the hit face even at whole-body level: the cycle's first click means "this body",
|
||||
// but the user pointed AT a face and a sketch should be able to use it. snaporca-3a2.
|
||||
m_pick_face_body = (level >= 1) ? body : -1;
|
||||
@@ -3240,7 +3241,8 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
||||
m_status->SetForegroundColour(wxNullColour);
|
||||
const int nb = int(m_doc.bodies.size());
|
||||
const wxString bodytag = (nb > 1) ? wxString::Format(_L("Body %d "), body + 1) : wxString();
|
||||
m_status->SetLabel(level == 1 ? bodytag + _L("selected (whole body)")
|
||||
m_status->SetLabel(level == 4 ? bodytag + _L("vertex selected")
|
||||
: level == 1 ? bodytag + _L("selected (whole body)")
|
||||
: level == 2 ? bodytag + wxString::Format(_L("face %d selected — Extrude to push/pull it"), face)
|
||||
: level == 3 ? bodytag + wxString::Format(_L("edge %d selected — Fillet/Chamfer to dress it"), edge)
|
||||
: _L("Nothing selected"));
|
||||
@@ -4915,6 +4917,8 @@ int DesignPanel::offer_selection_kind() const
|
||||
return int(OfferSel::SkNone);
|
||||
|
||||
const int nb = int(m_doc.bodies.size());
|
||||
if (m_sel_solid_vertex && m_sel_solid_body >= 0 && m_sel_solid_body < nb)
|
||||
return int(OfferSel::Vertex);
|
||||
if (m_sel_solid_edge >= 0 && m_sel_solid_body >= 0 && m_sel_solid_body < nb) {
|
||||
const TopoDS_Edge e = GeometryEngine::edge_by_index(m_doc.bodies[m_sel_solid_body].shape,
|
||||
m_sel_solid_edge);
|
||||
|
||||
Reference in New Issue
Block a user