forked from 1b-agent/opencadstudio-upstream
fix(input): numpad decimal key always types a decimal point
On German/European layouts the numpad decimal key emits a comma, which the coordinate parser rejects. Match the physical NumpadDecimal / NumpadComma key and emit '.' regardless of the OS layout. (#201) Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
7bab7c7b8d
commit
24f7329468
1 file changed
+17
@@ -1478,6 +1478,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
iced::Event::Keyboard(keyboard::Event::KeyPressed {
|
||||
key,
|
||||
physical_key,
|
||||
modifiers,
|
||||
text,
|
||||
..
|
||||
@@ -1496,6 +1497,22 @@ impl OpenCADStudio {
|
||||
// those numpad digits aren't swallowed as history
|
||||
// navigation. Whitespace / control text (Space,
|
||||
// Enter, Tab) falls through to the named handlers.
|
||||
// The numpad decimal key emits the OS-layout separator
|
||||
// (a comma on German/European layouts), which the
|
||||
// coordinate parser rejects. Force it to a decimal point
|
||||
// from the physical key, independent of layout.
|
||||
if !accel
|
||||
&& status == Status::Ignored
|
||||
&& matches!(
|
||||
physical_key,
|
||||
keyboard::key::Physical::Code(
|
||||
keyboard::key::Code::NumpadDecimal
|
||||
| keyboard::key::Code::NumpadComma
|
||||
)
|
||||
)
|
||||
{
|
||||
return Some(Message::CommandAppendChar(".".to_string()));
|
||||
}
|
||||
if !accel && status == Status::Ignored {
|
||||
if let Some(t) = text.as_deref() {
|
||||
if !t.is_empty()
|
||||
|
||||
Reference in new issue
Block a user