The label under an open value field is not drawn twice

This commit is contained in:
Tommaso Bianchi
2026-09-30 08:34:24 +00:00
committed by Claude
parent dc0e269186
commit 812063d085
2 changed files with 20 additions and 0 deletions
+14
View File
@@ -6992,6 +6992,13 @@ void DesignSketchTool::draw_text(GLModel& /*model*/, const std::string& s, const
// ponytail: all sketch labels now render as Measure-gizmo-style ImGui labels for visual
// parity with the Prepare/Preview tabs; the old vector-font path (glyph_strokes/draw_strokes
// for text) is retired. Leader lines/arrows still draw via draw_strokes at the call sites.
//
// The one label we do NOT draw is the one under an OPEN value field: the field is anchored
// over it and carries the same number plus its title, so leaving the label in place shows
// every value twice while the auto-edit chain runs (confirmed for rounded rect W/H/R, and
// the chain is shared, so Rect/Circle/Slot/Polygon/ArcSlot behave identically). Position
// compare is exact — the chain stores the very same Vec2d the label draws from.
if ((center - m_autoedit_label_pos).squaredNorm() < 1e-9) return;
draw_dim_label(s, center);
}
@@ -8479,6 +8486,13 @@ void DesignSketchTool::render(GLCanvas3D& canvas)
{
m_dim_label_seq = 0;
m_render_scale = canvas.get_scale();
// The open value field is anchored OVER the label it edits, and the label draws on top of
// it — the same number twice at the same spot. Record which label that is so draw_text can
// skip exactly it; the shape's other values must stay legible as the chain walks them.
m_autoedit_label_pos = Vec2d(1e18, 1e18);
if (inline_editor != nullptr && m_autoedit_dim_idx >= 0
&& m_autoedit_dim_idx < int(m_autoedit_dims.size()))
m_autoedit_label_pos = m_autoedit_dims[m_autoedit_dim_idx].label;
emit_step_hint(); // before the early returns: an armed tool on an empty sketch still guides
// The value field, BEFORE every early return below. It can be up in Constrain mode on a
// committed feature and on an empty sketch, and a field that is not drawn is a field that is
+6
View File
@@ -988,6 +988,12 @@ private:
};
std::vector<AutoEditStep> m_autoedit_dims; // queued steps to edit in sequence
int m_autoedit_dim_idx{-1}; // index into m_autoedit_dims (-1 = idle)
// Plane coords of the label the OPEN value field sits on. The field is anchored OVER its
// label (open_next_autoedit_dim) and the label is drawn after it, on top — the same number
// twice at the same spot. draw_text skips exactly this position while a step is open; the
// shape's other values stay legible as the chain walks them. Far-off sentinel = suppress
// nothing.
Vec2d m_autoedit_label_pos{1e18, 1e18};
std::vector<int> m_selection; // selected entity indices (Mode::Select)
std::vector<std::pair<int, SketchPointRole>> m_point_sel; // selected individual points
int m_last_mouse_x{0}; // last cursor pos (canvas client px), for