mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-12-04 23:45:17 +01:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QRgQ1K1Qu7TCsa74zsNURd
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user