Don't show arrange alignment combo if not on a rectangular bed
This commit is contained in:
parent
0a5a401d32
commit
068134d58b
@ -607,6 +607,12 @@ template<class Fn> auto call_with_bed(const Points &bed, Fn &&fn)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_box(const Points &bed)
|
||||||
|
{
|
||||||
|
return !bed.empty() &&
|
||||||
|
((1.0 - poly_area(bed) / area(BoundingBox(bed))) < 1e-3);
|
||||||
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void arrange(ArrangePolygons & items,
|
void arrange(ArrangePolygons & items,
|
||||||
const ArrangePolygons &excludes,
|
const ArrangePolygons &excludes,
|
||||||
|
@ -143,6 +143,8 @@ inline void arrange(ArrangePolygons &items, const CircleBed &bed, const ArrangeP
|
|||||||
inline void arrange(ArrangePolygons &items, const Polygon &bed, const ArrangeParams ¶ms = {}) { arrange(items, {}, bed, params); }
|
inline void arrange(ArrangePolygons &items, const Polygon &bed, const ArrangeParams ¶ms = {}) { arrange(items, {}, bed, params); }
|
||||||
inline void arrange(ArrangePolygons &items, const InfiniteBed &bed, const ArrangeParams ¶ms = {}) { arrange(items, {}, bed, params); }
|
inline void arrange(ArrangePolygons &items, const InfiniteBed &bed, const ArrangeParams ¶ms = {}) { arrange(items, {}, bed, params); }
|
||||||
|
|
||||||
|
bool is_box(const Points &bed);
|
||||||
|
|
||||||
}} // namespace Slic3r::arrangement
|
}} // namespace Slic3r::arrangement
|
||||||
|
|
||||||
#endif // MODELARRANGE_HPP
|
#endif // MODELARRANGE_HPP
|
||||||
|
@ -4188,7 +4188,9 @@ bool GLCanvas3D::_render_arrange_menu(float pos_x)
|
|||||||
settings_changed = true;
|
settings_changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imgui->combo(_("Alignment"), {"Center", "Top left", "Bottom left", "Bottom right", "Top right", "Random"}, settings.alignment)) {
|
Points bed = m_config ? get_bed_shape(*m_config) : Points{};
|
||||||
|
|
||||||
|
if (arrangement::is_box(bed) && imgui->combo(_("Alignment"), {"Center", "Top left", "Bottom left", "Bottom right", "Top right", "Random"}, settings.alignment)) {
|
||||||
settings_out.alignment = settings.alignment;
|
settings_out.alignment = settings.alignment;
|
||||||
appcfg->set("arrange", align_key.c_str(), std::to_string(settings_out.alignment));
|
appcfg->set("arrange", align_key.c_str(), std::to_string(settings_out.alignment));
|
||||||
settings_changed = true;
|
settings_changed = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user