NEW:add "fit camera" button
jira: none Change-Id: I97d4dd3d79ec8550e73ed21928133be4b4a8c92b (cherry picked from commit 99736e4ccc89f3f6af922ef2936e5e3e06a1bedf)
This commit is contained in:
parent
cb435671d0
commit
6b3a6a40b1
|
@ -0,0 +1,15 @@
|
|||
<svg width="33" height="32" viewBox="0 0 33 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_19252_56165)">
|
||||
<path d="M32.5 16C32.5 7.16344 25.3366 0 16.5 0C7.66344 0 0.5 7.16344 0.5 16C0.5 24.8366 7.66344 32 16.5 32C25.3366 32 32.5 24.8366 32.5 16Z" fill="white" fill-opacity="0.8"/>
|
||||
<path d="M24.8236 13.0105C25.2931 13.0105 25.6736 12.6308 25.6736 12.1625V9.69255L25.6718 9.58843L25.6717 9.58499C25.6137 8.04387 24.3446 6.82436 22.7987 6.82442L20.3257 6.82422L20.252 6.82755L20.2435 6.82837C19.7922 6.87204 19.4546 7.26153 19.4766 7.71342C19.4985 8.16529 19.8722 8.52043 20.3257 8.52037H22.7962L22.8702 8.52245C23.4629 8.55844 23.9355 9.02997 23.9716 9.62122L23.9737 9.69503L23.9735 12.1625L23.9768 12.2356L23.9776 12.2439C24.0196 12.6787 24.3858 13.0105 24.8236 13.0105Z" fill="#6B6B6B"/>
|
||||
<path d="M9.0261 12.1623C9.0261 12.6306 8.64556 13.0103 8.17613 13.0103C7.70671 13.0103 7.32617 12.6306 7.32617 12.1623V9.69235C7.32617 8.10831 8.61328 6.82422 10.201 6.82422H12.6741C13.1436 6.82422 13.5241 7.20388 13.5241 7.67219C13.5241 8.14052 13.1436 8.52017 12.6741 8.52017H10.201C9.57973 8.52013 9.06598 9.0026 9.02819 9.62099L9.0261 9.69478V12.1623Z" fill="#6B6B6B"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.2314 10.19C16.7064 9.92986 16.0857 9.94934 15.578 10.2418L11.8018 12.4168L11.7129 12.4717L11.7083 12.4747C11.2202 12.7983 10.9269 13.3441 10.9269 13.9287L10.9268 18.2788L10.93 18.3832L10.9304 18.3885C10.967 18.9722 11.2942 19.4987 11.8018 19.7911L15.578 21.9662L15.6701 22.0156L15.675 22.0181C16.2 22.278 16.8205 22.2585 17.328 21.9662L21.1047 19.7912L21.1935 19.7361L21.1976 19.7333C21.6859 19.4099 21.9795 18.864 21.9796 18.2793L21.9797 13.9292L21.9764 13.8248L21.9761 13.8195C21.9394 13.2358 21.6122 12.7093 21.1046 12.4169L17.328 10.2418L17.2367 10.1926L17.2314 10.19ZM12.4511 18.2793V14.5765L15.7774 16.493V20.3245L12.5636 18.4732L12.5312 18.4507C12.4805 18.4081 12.4512 18.3454 12.4511 18.2793ZM16.3398 11.5593L16.3758 11.5427C16.4382 11.5202 16.5074 11.5263 16.5648 11.5593L19.7786 13.4102L16.4523 15.3262L13.1261 13.4102L16.3398 11.5593ZM17.3025 16.5933V20.0222L20.2541 18.3225C20.2655 18.3159 20.2737 18.3053 20.2773 18.2928L20.2792 18.2714L20.2788 14.8789L17.3025 16.5933Z" fill="#6B6B6B"/>
|
||||
<path d="M7.3262 19.8363C7.3262 19.368 7.70674 18.9883 8.17617 18.9883C8.61398 18.9884 8.98015 19.3202 9.02218 19.7549L9.02298 19.7632L9.02633 19.8363L9.02613 22.3038L9.02823 22.3776C9.0643 22.9689 9.53693 23.4404 10.1296 23.4764L10.2036 23.4785H12.6741C13.1276 23.4784 13.5013 23.8335 13.5232 24.2854C13.5452 24.7373 13.2076 25.1268 12.7563 25.1705L12.7478 25.1713L12.6741 25.1746L10.2011 25.1744C8.65524 25.1745 7.38609 23.955 7.32812 22.4138L7.32799 22.4104L7.32617 22.3063L7.3262 19.8363Z" fill="#6B6B6B"/>
|
||||
<path d="M23.9736 19.8363C23.9736 19.368 24.3541 18.9883 24.8235 18.9883C25.293 18.9883 25.6735 19.368 25.6735 19.8363V22.3063C25.6735 23.8903 24.3864 25.1744 22.7986 25.1744H20.3256C19.8561 25.1744 19.4756 24.7948 19.4756 24.3264C19.4756 23.8581 19.8561 23.4785 20.3256 23.4785H22.7986C23.4199 23.4785 23.9337 22.996 23.9715 22.3777L23.9736 22.3039V19.8363Z" fill="#6B6B6B"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_19252_56165">
|
||||
<rect width="32" height="32" fill="white" transform="translate(0.5)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
|
@ -0,0 +1,19 @@
|
|||
<svg width="34" height="32" viewBox="0 0 34 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_19252_56154)">
|
||||
<path d="M33.4805 16C33.4805 7.16344 26.317 0 17.4805 0C8.64391 0 1.48047 7.16344 1.48047 16C1.48047 24.8366 8.64391 32 17.4805 32C26.317 32 33.4805 24.8366 33.4805 16Z" fill="white" fill-opacity="0.8"/>
|
||||
<path d="M25.8042 13.0105C26.2736 13.0105 26.6542 12.6308 26.6542 12.1625V9.69255L26.6524 9.58843L26.6522 9.58499C26.5943 8.04387 25.3251 6.82436 23.7793 6.82442L21.3062 6.82422L21.2325 6.82755L21.2241 6.82837C20.7727 6.87204 20.4352 7.26153 20.4571 7.71342C20.4791 8.16529 20.8528 8.52043 21.3063 8.52037H23.7768L23.8508 8.52245C24.4434 8.55844 24.9161 9.02997 24.9521 9.62122L24.9542 9.69503L24.954 12.1625L24.9574 12.2356L24.9582 12.2439C25.0002 12.6787 25.3664 13.0105 25.8042 13.0105Z" fill="#6B6B6B"/>
|
||||
<path d="M10.0066 12.1623C10.0066 12.6306 9.62603 13.0103 9.15661 13.0103C8.68719 13.0103 8.30664 12.6306 8.30664 12.1623L8.30665 9.69235C8.30665 8.10831 9.59376 6.82422 11.1815 6.82422H13.6546C14.124 6.82422 14.5046 7.20388 14.5046 7.67219C14.5046 8.14052 14.124 8.52017 13.6546 8.52017H11.1815C10.5602 8.52013 10.0465 9.0026 10.0087 9.62099L10.0066 9.69478V12.1623Z" fill="#6B6B6B"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M18.2119 10.19C17.6869 9.92986 17.0661 9.94934 16.5585 10.2418L12.7823 12.4168L12.6934 12.4717L12.6888 12.4747C12.2007 12.7983 11.9074 13.3441 11.9073 13.9287L11.9072 18.2788L11.9105 18.3832L11.9108 18.3885C11.9475 18.9722 12.2747 19.4987 12.7823 19.7911L16.5585 21.9662L16.6506 22.0156L16.6555 22.0181C17.1804 22.278 17.8009 22.2585 18.3084 21.9662L22.0851 19.7912L22.1739 19.7361L22.1781 19.7333C22.6664 19.4099 22.9599 18.864 22.9601 18.2793L22.9602 13.9292L22.9569 13.8248L22.9566 13.8195C22.9199 13.2358 22.5927 12.7093 22.0851 12.4169L18.3085 10.2418L18.2171 10.1926L18.2119 10.19ZM13.4316 18.2793V14.5765L16.7578 16.493V20.3245L13.5441 18.4732L13.5117 18.4507C13.461 18.4081 13.4317 18.3454 13.4316 18.2793ZM17.3203 11.5593L17.3563 11.5427C17.4187 11.5202 17.4878 11.5263 17.5453 11.5593L20.759 13.4102L17.4328 15.3262L14.1066 13.4102L17.3203 11.5593ZM18.283 16.5933V20.0222L21.2346 18.3225C21.2459 18.3159 21.2542 18.3053 21.2577 18.2928L21.2597 18.2714L21.2593 14.8789L18.283 16.5933Z" fill="#6B6B6B"/>
|
||||
<path d="M8.30667 19.8363C8.30667 19.368 8.68721 18.9883 9.15664 18.9883C9.59444 18.9884 9.96062 19.3202 10.0026 19.7549L10.0035 19.7632L10.0068 19.8363L10.0066 22.3038L10.0087 22.3776C10.0448 22.9689 10.5174 23.4404 11.11 23.4764L11.184 23.4785H13.6546C14.1081 23.4784 14.4818 23.8335 14.5037 24.2854C14.5256 24.7373 14.1881 25.1268 13.7368 25.1705L13.7283 25.1713L13.6546 25.1746L11.1815 25.1744C9.63571 25.1745 8.36656 23.955 8.30859 22.4138L8.30846 22.4104L8.30664 22.3063L8.30667 19.8363Z" fill="#6B6B6B"/>
|
||||
<path d="M24.954 19.8363C24.954 19.368 25.3346 18.9883 25.804 18.9883C26.2734 18.9883 26.654 19.368 26.654 19.8363V22.3063C26.654 23.8903 25.3669 25.1744 23.7791 25.1744H21.306C20.8366 25.1744 20.4561 24.7948 20.4561 24.3264C20.4561 23.8581 20.8366 23.4785 21.306 23.4785H23.7791C24.4004 23.4785 24.9142 22.996 24.952 22.3777L24.954 22.3039V19.8363Z" fill="#6B6B6B"/>
|
||||
<path d="M25.8042 13.0105C26.2736 13.0105 26.6542 12.6308 26.6542 12.1625V9.69255L26.6524 9.58843L26.6522 9.58499C26.5943 8.04387 25.3251 6.82436 23.7793 6.82442L21.3062 6.82422L21.2325 6.82755L21.2241 6.82837C20.7727 6.87204 20.4352 7.26153 20.4571 7.71342C20.4791 8.16529 20.8528 8.52043 21.3063 8.52037H23.7768L23.8508 8.52245C24.4434 8.55844 24.9161 9.02997 24.9521 9.62122L24.9542 9.69503L24.954 12.1625L24.9574 12.2356L24.9582 12.2439C25.0002 12.6787 25.3664 13.0105 25.8042 13.0105Z" fill="#00AE42"/>
|
||||
<path d="M10.0066 12.1623C10.0066 12.6306 9.62603 13.0103 9.15661 13.0103C8.68719 13.0103 8.30664 12.6306 8.30664 12.1623L8.30665 9.69235C8.30665 8.10831 9.59376 6.82422 11.1815 6.82422H13.6546C14.124 6.82422 14.5046 7.20388 14.5046 7.67219C14.5046 8.14052 14.124 8.52017 13.6546 8.52017H11.1815C10.5602 8.52013 10.0465 9.0026 10.0087 9.62099L10.0066 9.69478V12.1623Z" fill="#00AE42"/>
|
||||
<path d="M8.30667 19.8363C8.30667 19.368 8.68721 18.9883 9.15664 18.9883C9.59444 18.9884 9.96062 19.3202 10.0026 19.7549L10.0035 19.7632L10.0068 19.8363L10.0066 22.3038L10.0087 22.3776C10.0448 22.9689 10.5174 23.4404 11.11 23.4764L11.184 23.4785H13.6546C14.1081 23.4784 14.4818 23.8335 14.5037 24.2854C14.5256 24.7373 14.1881 25.1268 13.7368 25.1705L13.7283 25.1713L13.6546 25.1746L11.1815 25.1744C9.63571 25.1745 8.36656 23.955 8.30859 22.4138L8.30846 22.4104L8.30664 22.3063L8.30667 19.8363Z" fill="#00AE42"/>
|
||||
<path d="M24.954 19.8363C24.954 19.368 25.3346 18.9883 25.804 18.9883C26.2734 18.9883 26.654 19.368 26.654 19.8363V22.3063C26.654 23.8903 25.3669 25.1744 23.7791 25.1744H21.306C20.8366 25.1744 20.4561 24.7948 20.4561 24.3264C20.4561 23.8581 20.8366 23.4785 21.306 23.4785H23.7791C24.4004 23.4785 24.9142 22.996 24.952 22.3777L24.954 22.3039V19.8363Z" fill="#00AE42"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_19252_56154">
|
||||
<rect width="33" height="32" fill="white" transform="translate(0.5)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 5.0 KiB |
|
@ -5890,6 +5890,8 @@ void GLCanvas3D::_render_3d_navigator()
|
|||
}
|
||||
|
||||
const float size = 128 * sc;
|
||||
m_fit_camrea_button_pos[0] = size - 10;
|
||||
m_sc = sc;
|
||||
const bool dirty = ImGuizmo::ViewManipulate(cameraView, cameraProjection, ImGuizmo::OPERATION::ROTATE, ImGuizmo::MODE::WORLD, identityMatrix, camDistance,
|
||||
ImVec2(viewManipulateLeft, viewManipulateTop - size), ImVec2(size, size), 0x00101010);
|
||||
|
||||
|
@ -7646,6 +7648,7 @@ void GLCanvas3D::_render_overlays()
|
|||
}
|
||||
m_labels.render(sorted_instances);
|
||||
_render_3d_navigator();
|
||||
_render_fit_camera_toolbar();
|
||||
glsafe(::glPopMatrix());
|
||||
}
|
||||
|
||||
|
@ -8314,6 +8317,60 @@ void GLCanvas3D::_render_return_toolbar()
|
|||
imgui.end();
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_fit_camera_toolbar()
|
||||
{
|
||||
float font_size = ImGui::GetFontSize();
|
||||
ImVec2 button_icon_size = ImVec2(font_size * 2.5, font_size * 2.5);
|
||||
|
||||
ImGuiWrapper &imgui = *wxGetApp().imgui();
|
||||
float window_width = button_icon_size.x + imgui.scaled(2.0f);
|
||||
float window_height = button_icon_size.y + imgui.scaled(2.0f);
|
||||
|
||||
Size cnv_size = get_canvas_size();
|
||||
m_fit_camrea_button_pos[1] = cnv_size.get_height() - button_icon_size[1] - 20 * m_sc;
|
||||
imgui.set_next_window_pos(m_fit_camrea_button_pos[0], m_fit_camrea_button_pos[1], ImGuiCond_Always, 0, 0);
|
||||
#ifdef __WINDOWS__
|
||||
imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always);
|
||||
#endif
|
||||
|
||||
imgui.begin(_L("Fit camera"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);//
|
||||
|
||||
ImTextureID normal_id = m_gizmos.get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_FIT_CAMERA);
|
||||
if (normal_id == 0) {
|
||||
m_gizmos.init_icon_textures();
|
||||
}
|
||||
normal_id = m_gizmos.get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_FIT_CAMERA);
|
||||
ImTextureID hover_id = m_gizmos.get_icon_texture_id(GLGizmosManager::MENU_ICON_NAME::IC_FIT_CAMERA_HOVER); // IC_FIT_CAMERA_HOVER
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, {0, 0});
|
||||
|
||||
if (ImGui::ImageButton3(normal_id, hover_id, button_icon_size, ImVec2(0, 0), ImVec2(1, 1), -1,
|
||||
ImVec4(0, 0, 0, 0), ImVec4(1, 1, 1, 1), ImVec2(10, 0))) {
|
||||
select_view("plate");
|
||||
if (m_selection.is_empty()) {
|
||||
if (m_canvas_type == ECanvasType::CanvasAssembleView) {
|
||||
zoom_to_volumes();
|
||||
}
|
||||
else {
|
||||
zoom_to_bed();
|
||||
}
|
||||
}
|
||||
else {
|
||||
zoom_to_selection();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
auto temp_tooltip = _L("Fit camera to scene or selected object.");
|
||||
auto width = ImGui::CalcTextSize(temp_tooltip.c_str()).x + imgui.scaled(2.0f);
|
||||
imgui.tooltip(temp_tooltip, width);
|
||||
}
|
||||
ImGui::PopStyleVar(2);
|
||||
|
||||
imgui.end();
|
||||
}
|
||||
|
||||
void GLCanvas3D::_render_separator_toolbar_right() const
|
||||
{
|
||||
if (!m_separator_toolbar.is_enabled())
|
||||
|
|
|
@ -531,6 +531,8 @@ private:
|
|||
mutable IMToolbar m_sel_plate_toolbar;
|
||||
mutable GLToolbar m_assemble_view_toolbar;
|
||||
mutable IMReturnToolbar m_return_toolbar;
|
||||
mutable Vec2i m_fit_camrea_button_pos = {128, 5};
|
||||
mutable float m_sc{1};
|
||||
mutable float m_paint_toolbar_width;
|
||||
|
||||
//BBS: add canvas type for assemble view usage
|
||||
|
@ -1171,6 +1173,7 @@ private:
|
|||
void _render_imgui_select_plate_toolbar();
|
||||
void _render_assemble_view_toolbar() const;
|
||||
void _render_return_toolbar();
|
||||
void _render_fit_camera_toolbar();
|
||||
void _render_separator_toolbar_right() const;
|
||||
void _render_separator_toolbar_left() const;
|
||||
void _render_collapse_toolbar() const;
|
||||
|
|
|
@ -288,6 +288,15 @@ bool GLGizmosManager::init_icon_textures()
|
|||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/fit_camera.svg", 32, 32, texture_id))
|
||||
icon_list.insert(std::make_pair((int) IC_FIT_CAMERA, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/fit_camera_hover.svg", 32, 32, texture_id))
|
||||
icon_list.insert(std::make_pair((int) IC_FIT_CAMERA_HOVER, texture_id));
|
||||
else
|
||||
return false;
|
||||
|
||||
if (IMTexture::load_from_svg_file(Slic3r::resources_dir() + "/images/text_B.svg", 20, 20, texture_id))
|
||||
icon_list.insert(std::make_pair((int)IC_TEXT_B, texture_id));
|
||||
|
|
|
@ -172,6 +172,8 @@ public:
|
|||
IC_TEXT_T,
|
||||
IC_TEXT_T_DARK,
|
||||
IC_NAME_COUNT,
|
||||
IC_FIT_CAMERA,
|
||||
IC_FIT_CAMERA_HOVER,
|
||||
};
|
||||
|
||||
explicit GLGizmosManager(GLCanvas3D& parent);
|
||||
|
|
Loading…
Reference in New Issue