mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-24 17:26:47 +00:00
Design: clicking the same face twice takes the body, and the status line moves onto the viewport
A click could point at a face, an edge or a vertex, but never at the body those
belong to: offer_selection_kind() can only return BodySolid when all three are
clear, which a viewport click never produces. The rubber band was the only door,
and the status line said "face 5 selected" while the user believed they had taken
the body. A second click on the SAME sub-element now escalates to it (snaporca-gem).
Not the pick cycle that was removed in bc2b741ce9 -- that one was silent and three
deep, so no click had a predictable meaning. Here the status line names the next
click before you make it, and a further click just takes the face under the cursor
again, which needs no teaching. Double-click is untouched: wx sends Down/Up/DClick/Up
and only the first Up carries a pending press, so a fast double-click still zooms to
fit and picks once.
The status line itself moved to the base of the viewport. In the side panel it was
clipped at ~73 characters with no warning and no wrap -- set_status()'s Wrap() never
took effect (snaporca-8cc) -- which silently length-limited every hint in the tab; the
first version of this change lost a clause to it. m_status is kept, hidden, as the
owner of the text and its colour, and the line is drawn in a bottom-left twin of the
readout HUD where there is a whole window's width.
Three defects found driving it on the rig, none of which the build could see:
* the HUD as a wxFrame took the WM's keyboard focus every time it was raised, and
the canvas then received NO key events -- every sketch shortcut silently dead.
Caught with SNAPORCA_KEYTRACE: shift+S logged a line, the following R logged
nothing. It is a wxPopupWindow now, which cannot be focused. SetFocus() on the
canvas does not fix it: focus was on another toplevel.
* zero vertical padding fits the popup tighter than the font's line box and clips
the glyphs; 6 (what the readout uses) reads as a two-line box. 3 is right.
* "has a caller chosen a colour?" compared the label's foreground against its
PARENT's, which differ by default, so every line counted as chosen and the
neutral text came out the panel's dark grey -- invisible on a dark chip. Compare
against the colour the label was created with, captured before any caller writes.
Verified on both rigs against fresh binaries: sketch -> extrude -> click face ->
click again -> whole body tinted, offer opens with the body rows live and Create /
Add material correctly greyed. Keyboard drives the whole sequence.
Filed and NOT fixed here: snaporca-od0 -- a bare-plate click does not deselect the
solid, so "click away, click back" escalates. Pre-existing; clearing there would also
drop the face the Thicken/Shell/Draft cards hold, which needs its own pass.
Refs: snaporca-gem, snaporca-8cc, snaporca-od0
This commit is contained in:
@@ -3007,17 +3007,17 @@ bool DesignSketchTool::handle_solid_click(GLCanvas3D& canvas, const wxMouseEvent
|
||||
return std::hypot(wx - t * vx, wy - t * vy);
|
||||
};
|
||||
|
||||
// What was selected BEFORE this pick — the escalation below is the only thing that reads
|
||||
// it, and everything from here on overwrites it.
|
||||
const SolidSel prev_kind = m_solid_sel;
|
||||
const int prev_body = m_sel_body, prev_face = m_sel_face, prev_edge = m_sel_edge;
|
||||
const Vec3d prev_vtx = m_sel_vertex_pt;
|
||||
|
||||
m_sel_body = best_body;
|
||||
m_sel_face = best_face;
|
||||
m_sel_edge = -1;
|
||||
m_sel_edge_pts.clear();
|
||||
|
||||
// WHOLE-BODY selection is deliberately NOT bound here. Double-click is already zoom-to-fit
|
||||
// (see the LeftDClick branch at the top of on_mouse) and this pick runs on LeftUp, where
|
||||
// LeftDClick() is never true — a double-click branch here would be dead code that reads as
|
||||
// a working feature. The body gesture is the rubber band, which is its own piece of work;
|
||||
// until it lands, bodies are selected from the Bodies list. Written down rather than
|
||||
// half-done, because a selection model with a silent hole in it is how we got the cycle.
|
||||
{
|
||||
const TopoDS_Shape& bshape = (*m_solid_bodies)[m_sel_body].shape;
|
||||
const TopoDS_Face face = GeometryEngine::face_by_index(bshape, m_sel_face);
|
||||
@@ -3059,6 +3059,26 @@ bool DesignSketchTool::handle_solid_click(GLCanvas3D& canvas, const wxMouseEvent
|
||||
m_solid_sel = SolidSel::Face;
|
||||
}
|
||||
}
|
||||
// CLICK AGAIN ON THE SAME THING -> THE WHOLE BODY (snaporca-gem). Pointing at a face and
|
||||
// pointing at its body are different intents, and until now only the rubber band could
|
||||
// express the second one — so the status line said "face 0 selected" while the user
|
||||
// believed they had taken the body, and every body verb had to opt into the face kinds to
|
||||
// stay reachable. One more click on the SAME sub-element escalates.
|
||||
//
|
||||
// This is not the pick cycle that was removed (bc2b741ce9). That one was silent and three
|
||||
// deep, so no click had a predictable meaning. Here the escalation is announced by the
|
||||
// status line BEFORE you make the click, and a further click just takes the face under the
|
||||
// cursor again — the ordinary meaning of clicking a face, which needs no teaching.
|
||||
//
|
||||
// Double-click is safe: wx sends Down/Up/DClick/Up, and only the first Up carries a
|
||||
// pending press, so a fast double-click zooms to fit and picks ONCE. Escalation needs two
|
||||
// separate clicks, the same "click, pause, click" distinction a file manager uses.
|
||||
if (m_solid_sel == prev_kind && m_sel_body == prev_body && m_sel_face == prev_face
|
||||
&& m_sel_edge == prev_edge
|
||||
&& (m_solid_sel != SolidSel::Vertex || (m_sel_vertex_pt - prev_vtx).norm() < 1e-9)) {
|
||||
select_body(m_sel_body); // clears face/edge/vertex, tints the whole body
|
||||
dp_pick_trace("re-pick -> escalated to whole body %d", m_sel_body);
|
||||
}
|
||||
dp_pick_trace("pick -> sel=%d body=%d face=%d edge=%d",
|
||||
int(m_solid_sel), m_sel_body, m_sel_face, m_sel_edge);
|
||||
if (on_solid_selection_changed)
|
||||
|
||||
Reference in New Issue
Block a user