From de70025316b156fe479e2ad25f4effba2514763c Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 24 Jan 2026 14:29:11 +0100 Subject: [PATCH] Finish rulers by pressing the Enter key --- src/ant/ant/antService.cc | 16 +++++++++++++++- src/ant/ant/antService.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/ant/ant/antService.cc b/src/ant/ant/antService.cc index cb3e685cb..90f070655 100644 --- a/src/ant/ant/antService.cc +++ b/src/ant/ant/antService.cc @@ -1878,9 +1878,23 @@ Service::mouse_double_click_event (const db::DPoint & /*p*/, unsigned int button finish_drawing (); return true; + } else { + return false; } +} - return false; +bool +Service::key_event (unsigned int key, unsigned int buttons) +{ + if (m_drawing && buttons == 0 && (key == lay::KeyEnter || key == lay::KeyReturn)) { + + // ends the current ruler (specifically in multi-segment mode) + finish_drawing (); + return true; + + } else { + return false; + } } lay::TwoPointSnapToObjectResult diff --git a/src/ant/ant/antService.h b/src/ant/ant/antService.h index 6213dc642..2bd5c574d 100644 --- a/src/ant/ant/antService.h +++ b/src/ant/ant/antService.h @@ -644,6 +644,7 @@ private: virtual bool mouse_press_event (const db::DPoint &p, unsigned int buttons, bool prio); virtual bool mouse_click_event (const db::DPoint &p, unsigned int buttons, bool prio); virtual bool mouse_double_click_event (const db::DPoint &p, unsigned int buttons, bool prio); + virtual bool key_event (unsigned int key, unsigned int buttons); virtual void deactivated (); void snap_rulers (lay::angle_constraint_type ac);