FIX: dailytips window and gcodeviwer legend window size issue
reset to original logic of dailytips and legend window size jira: new Change-Id: Iacb016bb222ba3f87317cfbe1f2b003802d773a5
This commit is contained in:
parent
6e595f251c
commit
e46f0cace5
|
@ -4420,7 +4420,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
||||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabHovered, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||||
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
ImGui::PushStyleColor(ImGuiCol_ScrollbarGrabActive, ImVec4(0.93f, 0.93f, 0.93f, 1.00f));
|
||||||
ImGui::SetNextWindowBgAlpha(0.8f);
|
ImGui::SetNextWindowBgAlpha(0.8f);
|
||||||
const float max_height = 0.45f * static_cast<float>(cnv_size.get_height());
|
const float max_height = 0.75f * static_cast<float>(cnv_size.get_height());
|
||||||
const float child_height = 0.3333f * max_height;
|
const float child_height = 0.3333f * max_height;
|
||||||
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, max_height });
|
ImGui::SetNextWindowSizeConstraints({ 0.0f, 0.0f }, { -1.0f, max_height });
|
||||||
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
imgui.begin(std::string("Legend"), ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove);
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr int BEFORE_COMPLETE_DURATION = 3000; //ms
|
static constexpr int BEFORE_COMPLETE_DURATION = 4000; //ms
|
||||||
static constexpr int REFRESH_TIMEOUT = 100; //ms
|
static constexpr int REFRESH_TIMEOUT = 100; //ms
|
||||||
|
|
||||||
void NotificationManager::SlicingProgressNotification::on_change_color_mode(bool is_dark)
|
void NotificationManager::SlicingProgressNotification::on_change_color_mode(bool is_dark)
|
||||||
|
@ -259,7 +259,8 @@ void NotificationManager::SlicingProgressNotification::render(GLCanvas3D& canvas
|
||||||
const float progress_panel_height = (58.0f * scale);
|
const float progress_panel_height = (58.0f * scale);
|
||||||
const float dailytips_panel_width = (m_window_width - 2 * dailytips_child_window_padding.x);
|
const float dailytips_panel_width = (m_window_width - 2 * dailytips_child_window_padding.x);
|
||||||
const float gcodeviewer_height = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_legend_height();
|
const float gcodeviewer_height = wxGetApp().plater()->get_preview_canvas3D()->get_gcode_viewer().get_legend_height();
|
||||||
const float dailytips_panel_height = std::min(380.0f * scale, std::max(90.0f, (cnv_size.get_height() - gcodeviewer_height - progress_panel_height - dailytips_child_window_padding.y - initial_y - m_line_height * 4)));
|
//const float dailytips_panel_height = std::min(380.0f * scale, std::max(90.0f, (cnv_size.get_height() - gcodeviewer_height - progress_panel_height - dailytips_child_window_padding.y - initial_y - m_line_height * 4)));
|
||||||
|
const float dailytips_panel_height = 380.0f * scale;
|
||||||
|
|
||||||
float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0);
|
float right_gap = right_margin + (move_from_overlay ? overlay_width + m_line_height * 5 : 0);
|
||||||
m_window_pos = ImVec2((float)cnv_size.get_width() - right_gap - m_window_width, (float)cnv_size.get_height() - m_top_y);
|
m_window_pos = ImVec2((float)cnv_size.get_width() - right_gap - m_window_width, (float)cnv_size.get_height() - m_top_y);
|
||||||
|
@ -384,21 +385,28 @@ void Slic3r::GUI::NotificationManager::SlicingProgressNotification::render_text(
|
||||||
m_before_complete_start = GLCanvas3D::timestamp_now();
|
m_before_complete_start = GLCanvas3D::timestamp_now();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// timer to close
|
||||||
|
int64_t now = GLCanvas3D::timestamp_now();
|
||||||
|
int64_t duration_time = now - m_before_complete_start;
|
||||||
|
if (duration_time < 1000) {
|
||||||
|
imgui.push_bold_font();
|
||||||
|
ImGui::SetCursorScreenPos(ImVec2(pos.x + icon_size.x + ImGui::CalcTextSize(" ").x, pos.y + (icon_size.y - m_line_height) / 2));
|
||||||
|
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
|
||||||
|
imgui.pop_bold_font();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (duration_time > BEFORE_COMPLETE_DURATION) {
|
||||||
|
set_progress_state(SlicingProgressState::SP_COMPLETED);
|
||||||
|
return;
|
||||||
|
}
|
||||||
// complete text
|
// complete text
|
||||||
imgui.push_bold_font();
|
imgui.push_bold_font();
|
||||||
ImGui::SetCursorScreenPos(ImVec2(pos.x + icon_size.x + ImGui::CalcTextSize(" ").x, pos.y));
|
ImGui::SetCursorScreenPos(ImVec2(pos.x + icon_size.x + ImGui::CalcTextSize(" ").x, pos.y));
|
||||||
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
|
imgui.text(m_text1.substr(0, m_endlines[0]).c_str());
|
||||||
imgui.pop_bold_font();
|
imgui.pop_bold_font();
|
||||||
|
// closing text
|
||||||
// timer to close
|
|
||||||
int64_t now = GLCanvas3D::timestamp_now();
|
|
||||||
int64_t duration_time = now - m_before_complete_start;
|
|
||||||
if (duration_time > BEFORE_COMPLETE_DURATION) {
|
|
||||||
set_progress_state(SlicingProgressState::SP_COMPLETED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boost::format fmt(_u8L("Closing in %ds"));
|
boost::format fmt(_u8L("Closing in %ds"));
|
||||||
fmt % (3 - duration_time / 1000);
|
fmt % (4 - duration_time / 1000);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, ImColor(144, 144, 144).Value);
|
ImGui::PushStyleColor(ImGuiCol_Text, ImColor(144, 144, 144).Value);
|
||||||
ImGui::SetCursorScreenPos(ImVec2(pos.x + icon_size.x + ImGui::CalcTextSize(" ").x, pos.y + m_line_height + m_line_height / 2));
|
ImGui::SetCursorScreenPos(ImVec2(pos.x + icon_size.x + ImGui::CalcTextSize(" ").x, pos.y + m_line_height + m_line_height / 2));
|
||||||
imgui.text(fmt.str());
|
imgui.text(fmt.str());
|
||||||
|
|
Loading…
Reference in New Issue