This commit is contained in:
bubnikv 2019-04-04 09:03:08 +02:00
commit 43ce5accc2
6 changed files with 36 additions and 18 deletions

View file

@ -85,6 +85,7 @@ void ObjectSettings::update_settings_list()
#endif // __WXMSW__
btn->Bind(wxEVT_BUTTON, [opt_key, config, this](wxEvent &event) {
config->erase(opt_key);
wxGetApp().obj_list()->part_settings_changed();
wxTheApp->CallAfter([this]() {
wxWindowUpdateLocker noUpdates(m_parent);
update_settings_list();

View file

@ -330,8 +330,12 @@ bool GLGizmoSlaSupports::gizmo_event(SLAGizmoEventType action, const Vec2d& mous
m_canvas_width = m_parent.get_canvas_size().get_width();
m_canvas_height = m_parent.get_canvas_size().get_height();
}
else {
if (m_editing_mode_cache[m_hover_id].selected)
unselect_point(m_hover_id);
else
select_point(m_hover_id);
}
return true;
}
@ -791,6 +795,19 @@ void GLGizmoSlaSupports::select_point(int i)
}
void GLGizmoSlaSupports::unselect_point(int i)
{
m_editing_mode_cache[i].selected = false;
m_selection_empty = true;
for (const CacheEntry& ce : m_editing_mode_cache) {
if (ce.selected) {
m_selection_empty = false;
break;
}
}
}
void GLGizmoSlaSupports::editing_mode_discard_changes()
{

View file

@ -93,6 +93,7 @@ private:
NoPoints,
};
void select_point(int i);
void unselect_point(int i);
void editing_mode_apply_changes();
void editing_mode_discard_changes();
void editing_mode_reload_cache();

View file

@ -340,13 +340,11 @@ bool ImGuiWrapper::want_any_input() const
void ImGuiWrapper::init_font()
{
const float font_size = m_font_size * m_style_scaling;
destroy_font();
ImGuiIO& io = ImGui::GetIO();
io.Fonts->Clear();
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), font_size, nullptr, m_glyph_ranges);
ImFont* font = io.Fonts->AddFontFromFileTTF((Slic3r::resources_dir() + "/fonts/NotoSans-Regular.ttf").c_str(), m_font_size, nullptr, m_glyph_ranges);
if (font == nullptr) {
font = io.Fonts->AddFontDefault();
if (font == nullptr) {

View file

@ -45,8 +45,8 @@ public:
void new_frame();
void render();
float scaled(float x) const { return x * m_font_size * m_style_scaling; }
ImVec2 scaled(float x, float y) const { return ImVec2(x * m_font_size * m_style_scaling, y * m_font_size * m_style_scaling); }
float scaled(float x) const { return x * m_font_size; }
ImVec2 scaled(float x, float y) const { return ImVec2(x * m_font_size, y * m_font_size); }
ImVec2 calc_text_size(const wxString &text);
void set_next_window_pos(float x, float y, int flag);

View file

@ -108,18 +108,23 @@ void Selection::add(unsigned int volume_idx, bool as_single_selection)
if (is_wipe_tower() && volume->is_wipe_tower)
return;
bool keep_instance_mode = (m_mode == Instance) && !as_single_selection && (is_single_full_instance() || is_multiple_full_instance());
// resets the current list if needed
bool needs_reset = as_single_selection;
needs_reset |= volume->is_wipe_tower;
needs_reset |= is_wipe_tower() && !volume->is_wipe_tower;
needs_reset |= !is_modifier() && volume->is_modifier;
needs_reset |= !keep_instance_mode && !is_modifier() && volume->is_modifier;
needs_reset |= is_modifier() && !volume->is_modifier;
if (needs_reset)
clear();
if (!contains_volume(volume_idx))
{
if (!keep_instance_mode)
m_mode = volume->is_modifier ? Volume : Instance;
}
else
// keep current mode
return;
@ -1142,17 +1147,13 @@ void Selection::_update_type()
}
if (modifiers_count == 0)
{
m_type = MultipleVolume;
requires_disable = true;
}
else if (modifiers_count == (unsigned int)m_list.size())
{
m_type = MultipleModifier;
}
requires_disable = true;
}
}
}
else if ((selected_instances_count > 1) && (selected_instances_count * volumes_count == (unsigned int)m_list.size()))
{
m_type = MultipleFullInstance;