diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-02-06 11:57:52 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-02-07 11:22:04 +0300 |
commit | 21a7fa6af273754143a970e7d7fa6a6eed771797 (patch) | |
tree | e1c01d95b9c8ac220ee848d89ae509623df194ea /src/slic3r/GUI/Field.cpp | |
parent | 7c59c218c1d14234789b5bc5b939c5b885499988 (diff) |
Fix of #1782
Diffstat (limited to 'src/slic3r/GUI/Field.cpp')
-rw-r--r-- | src/slic3r/GUI/Field.cpp | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 862f1b107..e575a919a 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -145,19 +145,24 @@ void Field::get_value_by_opt_type(wxString& str) double val; // Replace the first occurence of comma in decimal number. str.Replace(",", ".", false); - if(!str.ToCDouble(&val)) - { - show_error(m_parent, _(L("Invalid numeric input."))); - set_value(double_to_string(val), true); - } - if (m_opt.min > val || val > m_opt.max) - { - show_error(m_parent, _(L("Input value is out of range"))); - if (m_opt.min > val) val = m_opt.min; - if (val > m_opt.max) val = m_opt.max; - set_value(double_to_string(val), true); - } - m_value = val; + if (str == ".") + val = 0.0; + else + { + if (!str.ToCDouble(&val)) + { + show_error(m_parent, _(L("Invalid numeric input."))); + set_value(double_to_string(val), true); + } + if (m_opt.min > val || val > m_opt.max) + { + show_error(m_parent, _(L("Input value is out of range"))); + if (m_opt.min > val) val = m_opt.min; + if (val > m_opt.max) val = m_opt.max; + set_value(double_to_string(val), true); + } + } + m_value = val; break; } case coString: case coStrings: |