From 2a4802bf12b2252f3000d719342cd10ca52395ca Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 02:36:21 +0100 Subject: [PATCH] fix(editor): the keys of the line of the brush only while the brush is the one along a line Points left from a line, after a switch to the circle or to the single model, were put by Enter there, and Backspace and Esc took them back unseen. Enter, Backspace and Esc now act on the line only while the brush is the one of many models along a line (brush_on_line()). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd --- application/editormode.cpp | 6 +++--- application/editormode.h | 2 ++ application/editormodebrush.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/application/editormode.cpp b/application/editormode.cpp index 659f0c3ba..a1089756b 100644 --- a/application/editormode.cpp +++ b/application/editormode.cpp @@ -7394,7 +7394,7 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in break; } // the line of the brush being clicked given up - if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty()) + if (is_press(Action) && brush_on_line() && false == m_brush_line.empty()) { m_brush_line.clear(); break; @@ -7472,7 +7472,7 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in if (is_press(Action) && ui()->mode() == nodebank_panel::FILL && !m_fill_points.empty()) m_fill_points.pop_back(); // the line of the brush: the last point taken back - if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty()) + if (is_press(Action) && brush_on_line() && false == m_brush_line.empty()) m_brush_line.pop_back(); if (is_press(Action) && ui()->mode() == nodebank_panel::TRACK && m_lay.active && !m_lay.points.empty()) lay_back(); @@ -7495,7 +7495,7 @@ void editor_mode::on_key(int const Key, int const Scancode, int const Action, in if (is_press(Action) && ui()->mode() == nodebank_panel::TRACK && m_lay.active) lay_enter(); // the models of the brush put along the line clicked - if (is_press(Action) && ui()->mode() == nodebank_panel::BRUSH && false == m_brush_line.empty()) + if (is_press(Action) && brush_on_line() && false == m_brush_line.empty()) brush_line_finish(); if (is_press(Action) && m_route.trace.active && route_active()) route_trace_end(true); diff --git a/application/editormode.h b/application/editormode.h index 9025358a4..de0424b3e 100644 --- a/application/editormode.h +++ b/application/editormode.h @@ -222,6 +222,8 @@ class editor_mode : public application_mode, private editor_track::observer, pri // one dab of the stroke of many models, at the cursor on the ground void brush_dab(); // the many along a line: a point of it at the cursor, the models put along it, the line and its band drawn on the ground + // the brush is the one of many models along a line: the keys of the line (Enter, Backspace, Esc) are its + bool brush_on_line(); void brush_line_point(); void brush_line_finish(); void draw_brush_line(glm::dvec3 const *Cursor); diff --git a/application/editormodebrush.cpp b/application/editormodebrush.cpp index b425997f6..3866f4725 100644 --- a/application/editormodebrush.cpp +++ b/application/editormodebrush.cpp @@ -173,6 +173,12 @@ void editor_mode::end_brush_stroke() ui()->set_status(format(STR_C("Brush: %zu models put; Ctrl+Z takes the whole stroke back"), count)); } +bool editor_mode::brush_on_line() +{ + auto const &settings{ui()->brush()}; + return ui()->mode() == nodebank_panel::BRUSH && settings.way == brush_object_list::kind::multi && settings.stroke == brush_object_list::shape::line; +} + void editor_mode::brush_line_point() { if (false == viewport_click())