mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-27 19:01:02 +00:00
Hover pre-highlight: show what a click would take, before it is taken
Third and last piece of the selection model. The other two turned out to be built already — the rubber band is pick_bodies_in_rectangle and vertex picking is SolidSel::Vertex with its camera-facing square, both live — so this closes what the issue actually still described. Vertex beats edge beats face is a rule the user cannot see until after they have committed to a click. Showing the outcome under the pointer is what makes the precedence learnable at all, and is the charter's L5 read honestly: one click, one visible change means the change has to be predictable BEFORE the click, not only explicable after it. The resolution is now one function, resolve_solid_pick, const and writing only into its out-parameter. The click applies it and then runs its escalation unchanged; the hover applies nothing. Split this way the promise cannot drift from the act — a second implementation of "what is under the cursor" would eventually disagree with the first, and the disagreement would look like a picking bug rather than a duplication one. Rendering is likewise one function called twice. The pre-highlight draws first so the committed selection paints over it, and is suppressed entirely when the two are the same thing: two coats of the same colour reads as a rendering fault, and a promise about a click that would change nothing is not worth making. It is desaturated toward white rather than given its own hue — a distinct colour would read as a distinct KIND of selection, when it is the same selection one moment earlier. Two things that would have been silent bugs. The edge ribbon and the vertex square render with GL_BLEND off, so an alpha below 1 there is ignored; those two are quietened by a muted rgb and only the blended face fill takes the alpha multiplier. And the pre-highlight is cleared in clear_solid_selection, because it names a face by an index into a shape a recompute has just rebuilt — left behind, it would keep glowing on whatever now sits at that index, a real entity but not the one meant. Hover runs on plain motion only, with no button down and no band running: during a drag the pointer is doing something else and a promise about clicking would be a lie. It returns false so the event still reaches the camera — it asks for a repaint, it does not consume the gesture. snaporca-9xw. Reviewed and compiled (RC=0), not exercised.
This commit is contained in:
@@ -975,6 +975,22 @@ private:
|
||||
std::vector<Vec3d> m_sel_edge_pts;
|
||||
Vec3d m_sel_vertex_pt{Vec3d::Zero()}; // world point of a picked vertex
|
||||
bool handle_solid_click(GLCanvas3D& canvas, const wxMouseEvent& evt); // pick + notify
|
||||
// What a click at (mx,my) WOULD take, resolved without touching the selection. One
|
||||
// implementation, two callers: the click, and the hover pre-highlight that promises what the
|
||||
// click is about to do. Split so the promise cannot drift from the act.
|
||||
struct SolidPick {
|
||||
SolidSel kind{SolidSel::None};
|
||||
int body{-1}, face{-1}, edge{-1};
|
||||
std::vector<Vec3d> edge_pts;
|
||||
Vec3d vertex_pt{Vec3d::Zero()};
|
||||
};
|
||||
bool resolve_solid_pick(GLCanvas3D& canvas, int mx, int my, SolidPick& out) const;
|
||||
// HOVER PRE-HIGHLIGHT (snaporca-9xw part 3). Vertex-beats-edge-beats-face is a rule the user
|
||||
// cannot see until after they commit to a click; showing the outcome under the pointer is
|
||||
// what makes the precedence learnable at all, and is the charter's L5 (one click, one visible
|
||||
// change) read honestly — the change has to be predictable before the click, not only after.
|
||||
SolidPick m_pre; // what the pointer is currently over (kind None = nothing)
|
||||
bool update_solid_hover(GLCanvas3D& canvas, const wxMouseEvent& evt); // true when it changed
|
||||
// Left-drag rubber band: sweep a rectangle over the plate to take a whole body. Orbit
|
||||
// moves to middle-drag in this canvas (DesignCanvas::set_cad_navigation) so the left
|
||||
// button is free for it, which is the CAD convention (Onshape/SolidWorks).
|
||||
@@ -988,6 +1004,10 @@ private:
|
||||
double& edge_d, int& face_feat, int& face_reg) const;
|
||||
bool m_right_consumed{false}; // last RightDown was a gesture terminator, not a menu
|
||||
void render_solid_highlight();
|
||||
// The shared body of the above: one highlight from explicit arguments, so the committed
|
||||
// selection and the hover pre-highlight cannot drift apart in how they look.
|
||||
void render_solid_sel(SolidSel kind, int body, int face, const std::vector<Vec3d>& edge_pts,
|
||||
const Vec3d& vertex_pt, const ColorRGBA& rgb, float alpha_mul);
|
||||
void render_datum_planes(); // translucent rectangles for datum/reference planes
|
||||
void render_view_helpers(); // world origin planes + axis triad (P / A toggles)
|
||||
bool m_show_planes{false};
|
||||
|
||||
Reference in New Issue
Block a user