mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-14 06:31:47 +08:00
ObjectLayers: Negative value for layer heights are suppressed
+ Set last valid value, when invalid numeric value was inputted + Linux specific: Fixed a crash, when alternate decimal separator was used in input
This commit is contained in:
parent
9d20b01c5b
commit
ba9993c198
@ -427,16 +427,13 @@ coordf_t LayerRangeEditor::get_value()
|
|||||||
const char dec_sep = is_decimal_separator_point() ? '.' : ',';
|
const char dec_sep = is_decimal_separator_point() ? '.' : ',';
|
||||||
const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
|
const char dec_sep_alt = dec_sep == '.' ? ',' : '.';
|
||||||
// Replace the first incorrect separator in decimal number.
|
// Replace the first incorrect separator in decimal number.
|
||||||
if (str.Replace(dec_sep_alt, dec_sep, false) != 0)
|
str.Replace(dec_sep_alt, dec_sep, false);
|
||||||
SetValue(str);
|
|
||||||
|
|
||||||
if (str == ".")
|
if (str == ".")
|
||||||
layer_height = 0.0;
|
layer_height = 0.0;
|
||||||
else {
|
else if (!str.ToDouble(&layer_height) || layer_height < 0.0f) {
|
||||||
if (!str.ToDouble(&layer_height) || layer_height < 0.0f) {
|
show_error(m_parent, _L("Invalid numeric input."));
|
||||||
show_error(m_parent, _L("Invalid numeric input."));
|
assert(m_valid_value.ToDouble(&layer_height));
|
||||||
SetValue(double_to_string(layer_height));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return layer_height;
|
return layer_height;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user