FIX: fix plate name height

Change-Id: I531d846e4db0c0b39e6b79ad8274c739713ae7ae
This commit is contained in:
zhou.xu 2023-07-04 11:22:59 +08:00 committed by Lane.Wei
parent 7fe0adb6e8
commit d7b31ae2b7
1 changed files with 40 additions and 40 deletions

View File

@ -49,6 +49,8 @@ static unsigned int GLOBAL_PLATE_INDEX = 0;
static const double LOGICAL_PART_PLATE_GAP = 1. / 5.;
static const int PARTPLATE_ICON_SIZE = 16;
static const int PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE = 12;
static const int PARTPLATE_PLATE_NAME_FIX_HEIGHT_SIZE = 20;
static const int PARTPLATE_ICON_GAP_TOP = 3;
static const int PARTPLATE_ICON_GAP_LEFT = 3;
static const int PARTPLATE_ICON_GAP_Y = 5;
@ -423,7 +425,7 @@ void PartPlate::calc_vertex_for_plate_name(GLTexture &texture, GeometryBuffer &b
ExPolygon poly;
float offset_x = 1;
w = int(factor * (texture.get_width() * 16) / texture.get_height());
h = int(factor * 16);
h = PARTPLATE_PLATE_NAME_FIX_HEIGHT_SIZE;
Vec2d p = bed_ext[3] + Vec2d(0, PARTPLATE_PLATENAME_OFFSET_Y + h * texture.m_original_height / texture.get_height());
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x), scale_(p(1) - h )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w - offset_x), scale_(p(1) - h )});
@ -448,16 +450,14 @@ void PartPlate::calc_vertex_for_plate_name_edit_icon(GLTexture *texture, int ind
ExPolygon poly;
Vec2d p = bed_ext[3];
float offset_x = 1;
const int plate_name_edit_icon_height = 12;
const int plate_name_edit_icon_width = 12;
h = plate_name_edit_icon_height;
h = PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE;
p += Vec2d(0, PARTPLATE_PLATENAME_OFFSET_Y + h);
if (texture && texture->get_width() > 0 && texture->get_height()) {
w = int(factor * (texture->get_original_width() * 16) / texture->get_height()) + 1;
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w), scale_(p(1) - h )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w + plate_name_edit_icon_width), scale_(p(1) - h )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w + plate_name_edit_icon_width), scale_(p(1) )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w + PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE), scale_(p(1) - h)});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w + PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE), scale_(p(1))});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + w), scale_(p(1) )});
auto triangles = triangulate_expolygon_2f(poly, NORMALS_UP);
@ -466,8 +466,8 @@ void PartPlate::calc_vertex_for_plate_name_edit_icon(GLTexture *texture, int ind
} else {
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x ), scale_(p(1) - h )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x+ plate_name_edit_icon_width), scale_(p(1) - h )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x+ plate_name_edit_icon_width), scale_(p(1) )});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x + PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE), scale_(p(1) - h)});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x + PARTPLATE_EDIT_PLATE_NAME_ICON_SIZE), scale_(p(1))});
poly.contour.append({scale_(p(0) + PARTPLATE_ICON_GAP_LEFT + offset_x), scale_(p(1) )});
auto triangles = triangulate_expolygon_2f(poly, NORMALS_UP);