FIX: one_layer slider ,text doesn't display fully

Change-Id: I9d02b246267bfd0eb74a1cea55dd769ea32da14a
This commit is contained in:
liz.li 2022-11-18 21:05:06 +08:00 committed by Lane.Wei
parent 035c38bdc7
commit f3968c5d99

View file

@ -49,6 +49,7 @@ constexpr double miscalculation = scale_(scale_(1)); // equal to 1 mm2
static const float LEFT_MARGIN = 13.0f + 100.0f; // avoid thumbnail toolbar
static const float SLIDER_LENGTH = 680.0f;
static const float TEXT_WIDTH_DUMMY = 63.0f;
static const float ONE_LAYER_MARGIN = 20.0f;
static const ImVec2 ONE_LAYER_OFFSET = ImVec2(41.0f, 44.0f);
static const ImVec2 HORIZONTAL_SLIDER_SIZE = ImVec2(764.0f, 90.0f);//764 = 680 + handle_dummy_width * 2 + text_right_dummy
static const ImVec2 VERTICAL_SLIDER_SIZE = ImVec2(105.0f, 748.0f);//748 = 680 + text_dummy_height * 2
@ -1238,9 +1239,9 @@ bool IMSlider::render(int canvas_width, int canvas_height)
}
imgui.end();
} else {
float pos_x = canvas_width - (VERTICAL_SLIDER_SIZE.x + TEXT_WIDTH_DUMMY * scale - TEXT_WIDTH_DUMMY) * m_scale;
float pos_x = canvas_width - (VERTICAL_SLIDER_SIZE.x + TEXT_WIDTH_DUMMY * scale - TEXT_WIDTH_DUMMY + ONE_LAYER_MARGIN) * m_scale;
float pos_y = std::max(ONE_LAYER_OFFSET.y, 0.15f * canvas_height - (VERTICAL_SLIDER_SIZE.y - SLIDER_LENGTH) * scale);
ImVec2 size = ImVec2((VERTICAL_SLIDER_SIZE.x + TEXT_WIDTH_DUMMY * scale - TEXT_WIDTH_DUMMY) * m_scale, canvas_height - 2 * pos_y);
ImVec2 size = ImVec2((VERTICAL_SLIDER_SIZE.x + TEXT_WIDTH_DUMMY * scale - TEXT_WIDTH_DUMMY + ONE_LAYER_MARGIN) * m_scale, canvas_height - 2 * pos_y);
imgui.set_next_window_pos(pos_x, pos_y, ImGuiCond_Always);
imgui.begin(std::string("laysers_slider"), windows_flag);