FIX: the icon diffs in normal and dark display

jira: [STUDIO-9786]
Change-Id: I935133161d3ecf09b72eb235bba335c5086e5674
This commit is contained in:
xin.zhang 2025-01-14 21:14:17 +08:00 committed by lane.wei
parent b5e3b96764
commit fed792d379
3 changed files with 18 additions and 16 deletions

View File

@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="7.77482" cy="7.85898" r="7.70859" fill="#262E30"/>
</svg>

After

Width:  |  Height:  |  Size: 166 B

View File

@ -126,8 +126,7 @@ void TempInput::Create(wxWindow *parent, wxString text, wxString label, wxString
text_ctrl->SetForegroundColour(StateColor::darkModeColorFor(*wxBLACK));
if (!normal_icon.IsEmpty()) { this->normal_icon = ScalableBitmap(this, normal_icon.ToStdString(), 16); }
if (!actice_icon.IsEmpty()) { this->actice_icon = ScalableBitmap(this, actice_icon.ToStdString(), 16); }
this->left_icon = ScalableBitmap(this, "L", 16);
this->right_icon = ScalableBitmap(this, "R", 16);
this->round_scale_hint_icon = ScalableBitmap(this, "round", 16);
this->degree_icon = ScalableBitmap(this, "degree", 16);
messureSize();
}
@ -310,8 +309,7 @@ void TempInput::Rescale()
{
if (this->normal_icon.bmp().IsOk()) this->normal_icon.msw_rescale();
if (this->degree_icon.bmp().IsOk()) this->degree_icon.msw_rescale();
if (this->left_icon.bmp().IsOk()) this->left_icon.msw_rescale();
if (this->right_icon.bmp().IsOk()) this->right_icon.msw_rescale();
if (this->round_scale_hint_icon.bmp().IsOk()) this->round_scale_hint_icon.msw_rescale();
messureSize();
}
@ -356,7 +354,7 @@ void TempInput::DoSetSize(int x, int y, int width, int height, int sizeFlags)
left += 9;
if (m_input_type == TEMP_OF_MAIN_NOZZLE_TYPE || m_input_type == TEMP_OF_DEPUTY_NOZZLE_TYPE) {
wxSize szIcon = left_icon.GetBmpSize();
wxSize szIcon = round_scale_hint_icon.GetBmpSize();
left += szIcon.x + 3;
}
@ -434,10 +432,13 @@ void TempInput::render(wxDC &dc)
}
pt.x += szIcon.x + 9;
if (left_icon.bmp().IsOk() && m_input_type == TEMP_OF_DEPUTY_NOZZLE_TYPE){
wxSize szIcon = left_icon.GetBmpSize();
ScalableBitmap round_icon(this, "round", 16);/*icon diffs in normal and dark mode*/
round_icon.msw_rescale();
if (round_icon.bmp().IsOk() && m_input_type == TEMP_OF_DEPUTY_NOZZLE_TYPE){
wxSize szIcon = round_icon.GetBmpSize();
pt.y = (size.y - szIcon.y) / 2;
dc.DrawBitmap(left_icon.bmp(), pt);
dc.DrawBitmap(round_icon.bmp(), pt);
dc.SetFont(::Label::Body_12);
auto sepSize = dc.GetMultiLineTextExtent(wxString("L"));
@ -449,10 +450,10 @@ void TempInput::render(wxDC &dc)
pt.x += szIcon.x + 3;
}
if (right_icon.bmp().IsOk() && m_input_type == TEMP_OF_MAIN_NOZZLE_TYPE) {
wxSize szIcon = right_icon.GetBmpSize();
if (round_icon.bmp().IsOk() && m_input_type == TEMP_OF_MAIN_NOZZLE_TYPE) {
wxSize szIcon = round_icon.GetBmpSize();
pt.y = (size.y - szIcon.y) / 2;
dc.DrawBitmap(right_icon.bmp(), pt);
dc.DrawBitmap(round_icon.bmp(), pt);
dc.SetFont(::Label::Body_12);
auto sepSize = dc.GetMultiLineTextExtent(wxString("R"));
@ -531,7 +532,7 @@ void TempInput::messureMiniSize()
width += 9;
if (m_input_type == TEMP_OF_MAIN_NOZZLE_TYPE || m_input_type == TEMP_OF_DEPUTY_NOZZLE_TYPE) {
wxSize szIcon = left_icon.GetBmpSize();
wxSize szIcon = round_scale_hint_icon.GetBmpSize();
width += szIcon.x;
}
width += 3;
@ -591,7 +592,7 @@ void TempInput::messureSize()
width += 9;
if (m_input_type == TEMP_OF_MAIN_NOZZLE_TYPE || m_input_type == TEMP_OF_DEPUTY_NOZZLE_TYPE) {
wxSize szIcon = left_icon.GetBmpSize();
wxSize szIcon = round_scale_hint_icon.GetBmpSize();
width += szIcon.x;
}
width += 3;

View File

@ -23,9 +23,7 @@ class TempInput : public wxNavigationEnabled<StaticBox>
ScalableBitmap normal_icon;
ScalableBitmap actice_icon;
ScalableBitmap degree_icon;
ScalableBitmap left_icon;
ScalableBitmap right_icon;
ScalableBitmap round_scale_hint_icon;/*the size hint of icon, use to compute size*/
StateColor label_color;
StateColor text_color;