mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-26 16:02:00 +08:00
Fix Percent fields displayed as int in modifiers
supermerill/SuperSlicer#1116
This commit is contained in:
parent
ad44389983
commit
7c1d29acd8
@ -48,6 +48,8 @@ wxString double_to_string(double const value, const int max_precision /*= 8*/)
|
|||||||
// Remove sign from orphaned zero.
|
// Remove sign from orphaned zero.
|
||||||
if (s.compare("-0") == 0)
|
if (s.compare("-0") == 0)
|
||||||
s = "0";
|
s = "0";
|
||||||
|
if (s.Last() == '.')
|
||||||
|
s.erase(s.length() -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,7 +428,7 @@ bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TextCtrl::BUILD() {
|
void TextCtrl::BUILD() {
|
||||||
auto size = wxSize(def_width()*m_em_unit, wxDefaultCoord);
|
auto size = wxSize((this->m_opt.type == ConfigOptionType::coPercent ? def_width_thinner() : def_width())*m_em_unit, wxDefaultCoord);
|
||||||
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
|
if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit);
|
||||||
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
|
if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit);
|
||||||
|
|
||||||
@ -442,7 +444,7 @@ void TextCtrl::BUILD() {
|
|||||||
}
|
}
|
||||||
case coPercent:
|
case coPercent:
|
||||||
{
|
{
|
||||||
text_value = wxString::Format(_T("%i"), int(m_opt.default_value->getFloat()));
|
text_value = double_to_string(m_opt.default_value->getFloat());
|
||||||
text_value += "%";
|
text_value += "%";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -886,8 +886,8 @@ boost::any ConfigOptionsGroup::get_config_value(const DynamicPrintConfig& config
|
|||||||
}
|
}
|
||||||
case coPercent:{
|
case coPercent:{
|
||||||
double val = config.option<ConfigOptionPercent>(opt_key)->value;
|
double val = config.option<ConfigOptionPercent>(opt_key)->value;
|
||||||
text_value = wxString::Format(_T("%i"), int(val));
|
text_value = double_to_string(val);
|
||||||
ret = text_value;// += "%";
|
ret = text_value;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case coPercents:
|
case coPercents:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user