optimized plate name location

This commit is contained in:
SoftFever 2023-04-10 22:54:06 +08:00
parent 07d048ef36
commit 65e397767c

View file

@ -1567,11 +1567,8 @@ void PartPlate::generate_plate_name_texture()
m_name_texture.reset();
auto text = m_name.empty()? _L("Untitled") : m_name;
wxCoord w, h;
#ifdef WIN32
auto* font = &Label::Head_48;
#else
auto* font = &Label::Head_32;
#endif
wxColour foreground(0xf2, 0x75, 0x4e, 0xff);
if (!m_name_texture.generate_from_text_string(text.ToStdString(), *font, *wxBLACK, foreground))
@ -1582,7 +1579,7 @@ void PartPlate::generate_plate_name_texture()
float offset_x = 1;
w = int(factor * (m_name_texture.get_width() * 16) / m_name_texture.get_height());
h = int(factor * 16);
Vec2d p = bed_ext[3] + Vec2d(0, h*0.6);
Vec2d p = bed_ext[3] + Vec2d(0, h * m_name_texture.m_original_height / m_name_texture.get_height());
poly.contour.append({ scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x), scale_(p(1) - h + PARTPLATE_TEXT_OFFSET_Y) });
poly.contour.append({ scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w - offset_x), scale_(p(1) - h + PARTPLATE_TEXT_OFFSET_Y) });
poly.contour.append({ scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w - offset_x), scale_(p(1) - PARTPLATE_TEXT_OFFSET_Y)});