Merge branch 'main' into main
This commit is contained in:
commit
b651ff6651
1 changed files with 29 additions and 16 deletions
|
@ -7789,11 +7789,23 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
|||
float margin_size = 4.0f * f_scale;
|
||||
float button_margin = frame_padding;
|
||||
|
||||
const float y_offset = is_collapse_toolbar_on_left() ? (get_collapse_toolbar_height() + 5) : 0;
|
||||
// Make sure the window does not overlap the 3d navigator
|
||||
auto window_height_max = canvas_h - y_offset;
|
||||
if (wxGetApp().show_3d_navigator()) {
|
||||
float sc = get_scale();
|
||||
#ifdef WIN32
|
||||
const int dpi = get_dpi_for_window(wxGetApp().GetTopWindow());
|
||||
sc *= (float) dpi / (float) DPI_DEFAULT;
|
||||
#endif // WIN32
|
||||
window_height_max -= (128 * sc + 5);
|
||||
}
|
||||
|
||||
ImGuiWrapper& imgui = *wxGetApp().imgui();
|
||||
int item_count = m_sel_plate_toolbar.m_items.size() + (m_sel_plate_toolbar.show_stats_item ? 1 : 0);
|
||||
bool show_scroll = item_count * (button_height + frame_padding * 2.0f + button_margin) - button_margin + 22.0f * f_scale > canvas_h ? true: false;
|
||||
bool show_scroll = item_count * (button_height + frame_padding * 2.0f + button_margin) - button_margin + 22.0f * f_scale > window_height_max ? true: false;
|
||||
show_scroll = m_sel_plate_toolbar.is_display_scrollbar && show_scroll;
|
||||
float window_height = std::min(item_count * (button_height + (frame_padding + margin_size) * 2.0f + button_margin) - button_margin + 28.0f * f_scale, canvas_h);
|
||||
float window_height = std::min(item_count * (button_height + (frame_padding + margin_size) * 2.0f + button_margin) - button_margin + 28.0f * f_scale, window_height_max);
|
||||
float window_width = m_sel_plate_toolbar.icon_width + margin_size * 2 + (show_scroll ? 28.0f * f_scale : 20.0f * f_scale);
|
||||
|
||||
ImVec4 window_bg = ImVec4(0.82f, 0.82f, 0.82f, 0.5f);
|
||||
|
@ -7816,7 +7828,6 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f);
|
||||
|
||||
const float y_offset = is_collapse_toolbar_on_left() ? (get_collapse_toolbar_height() + 5) : 0;
|
||||
imgui.set_next_window_pos(canvas_w * 0, canvas_h * 0 + y_offset, ImGuiCond_Always, 0, 0);
|
||||
imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always);
|
||||
|
||||
|
@ -7888,25 +7899,25 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
|||
if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::UNSLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
ImVec2 size = ImVec2(button_width, button_height * all_plates_stats_item->percent / 100.0f);
|
||||
ImVec2 rect_start_pos = ImVec2(start_pos.x, start_pos.y + size.y);
|
||||
ImVec2 rect_end_pos = ImVec2(start_pos.x + button_width, start_pos.y + button_height);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetForegroundDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetWindowDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
}
|
||||
else if (all_plates_stats_item->slice_state == IMToolbarItem::SliceState::SLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
}
|
||||
|
||||
// draw text
|
||||
|
@ -7948,7 +7959,9 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
|||
ImGui::PushStyleColor(ImGuiCol_Border, button_active);
|
||||
}
|
||||
else {
|
||||
if (ImGui::IsMouseHoveringRect(button_pos, button_pos + button_size)) {
|
||||
// Translate window pos to abs pos, also account for the window scrolling
|
||||
auto hover_rect = button_pos + ImGui::GetWindowPos() - ImGui::GetCurrentWindow()->Scroll;
|
||||
if (ImGui::IsMouseHoveringRect(hover_rect, hover_rect + button_size)) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, button_hover);
|
||||
}
|
||||
else {
|
||||
|
@ -7974,22 +7987,22 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
|
|||
if (item->slice_state == IMToolbarItem::SliceState::UNSLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 80));
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICING) {
|
||||
ImVec2 size = ImVec2(button_width, button_height * item->percent / 100.0f);
|
||||
ImVec2 rect_start_pos = ImVec2(start_pos.x, start_pos.y + size.y);
|
||||
ImVec2 rect_end_pos = ImVec2(start_pos.x + button_width, start_pos.y + button_height);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, rect_end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(rect_start_pos, rect_end_pos, IM_COL32(0, 0, 0, 80));
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetForegroundDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(40, 1, 1, 64));
|
||||
ImGui::GetWindowDrawList()->AddRect(start_pos, end_pos, IM_COL32(208, 27, 27, 255), 0.0f, 0, 1.0f);
|
||||
} else if (item->slice_state == IMToolbarItem::SliceState::SLICED) {
|
||||
ImVec2 size = ImVec2(button_width, button_height);
|
||||
ImVec2 end_pos = ImVec2(start_pos.x + size.x, start_pos.y + size.y);
|
||||
ImGui::GetForegroundDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
ImGui::GetWindowDrawList()->AddRectFilled(start_pos, end_pos, IM_COL32(0, 0, 0, 10));
|
||||
}
|
||||
|
||||
// draw text
|
||||
|
|
Loading…
Reference in a new issue