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 <noreply@anthropic.com>
This commit is contained in:
parent
7bab7c7b8d
commit
24f7329468
1 changed files with 17 additions and 0 deletions
|
|
@ -1478,6 +1478,7 @@ impl OpenCADStudio {
|
||||||
}
|
}
|
||||||
iced::Event::Keyboard(keyboard::Event::KeyPressed {
|
iced::Event::Keyboard(keyboard::Event::KeyPressed {
|
||||||
key,
|
key,
|
||||||
|
physical_key,
|
||||||
modifiers,
|
modifiers,
|
||||||
text,
|
text,
|
||||||
..
|
..
|
||||||
|
|
@ -1496,6 +1497,22 @@ impl OpenCADStudio {
|
||||||
// those numpad digits aren't swallowed as history
|
// those numpad digits aren't swallowed as history
|
||||||
// navigation. Whitespace / control text (Space,
|
// navigation. Whitespace / control text (Space,
|
||||||
// Enter, Tab) falls through to the named handlers.
|
// 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 !accel && status == Status::Ignored {
|
||||||
if let Some(t) = text.as_deref() {
|
if let Some(t) = text.as_deref() {
|
||||||
if !t.is_empty()
|
if !t.is_empty()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue