Rib: the thickness gets its handle, so the whole tool is draggable

Rib's depth already reused the Extrude arrow. Its thickness could not: the arrow
points along the plane normal, and thickness is an offset either side of the rib
line, IN the plane. Different direction, different handle.

Two square handles at mid ± perp·half, plus the slab's actual footprint drawn as
a thin closed rectangle — the footprint matters more than the dots, because what
a rib thickness means is how wide that slab lands on the body, and until now
there was no way to see it before committing.

A drag on either handle sets the FULL thickness, twice the perpendicular distance
from the line, because the slab is centred on the line and the handle sits at
half. Both handles behave identically for the same reason, so they share one
colour rather than pretending to be two different actions.

A zero-length line has no direction to grow a slab perpendicular to, so the
shared rib_frame() helper returns false and render and drag both draw nothing
rather than dividing by zero. Non-Line entities clear the gizmo instead of
guessing: the kernel is line-only and a gizmo that guesses would be lying about
what Confirm will build.

Unlike the helix callback this one goes through refresh_preview(), because Rib
builds a real solid ghost that has to rebuild. The helix has none and skips it
deliberately.

Both gizmos coexist and resolve the sketch and entity the same way, so the depth
arrow and the thickness handles can never disagree about which line they are on.

Reviewed and compiled (libslic3r_gui, RC=0); not exercised. snaporca-plew.
This commit is contained in:
Tommaso Bianchi
2026-08-12 21:34:59 +02:00
parent b9d6b59f90
commit e6a14b39c9
6 changed files with 221 additions and 1 deletions
+18
View File
@@ -861,6 +861,24 @@ void DesignCanvas::set_on_helix_changed(std::function<void(double, double, doubl
m_sketch_tool.on_helix_changed = std::move(cb);
}
void DesignCanvas::set_rib_gizmo(const SketchPlane& plane, const Vec2d& p0, const Vec2d& p1,
double thickness)
{
m_sketch_tool.set_rib_gizmo(plane, p0, p1, thickness);
request_repaint();
}
void DesignCanvas::clear_rib_gizmo()
{
m_sketch_tool.clear_rib_gizmo();
request_repaint();
}
void DesignCanvas::set_on_rib_thickness_changed(std::function<void(double)> cb)
{
m_sketch_tool.on_rib_thickness_changed = std::move(cb);
}
void DesignCanvas::set_base_pick(std::vector<SketchPlane> planes, std::vector<int> bases,
std::vector<std::string> labels)
{