Fix status indication glitch for bed filling
This commit is contained in:
parent
4f7f08d0de
commit
4e90df1ea5
1 changed files with 7 additions and 6 deletions
|
@ -55,18 +55,17 @@ void FillBedJob::prepare()
|
|||
double unsel_area = std::accumulate(m_unselected.begin(),
|
||||
m_unselected.end(), 0.,
|
||||
[](double s, const auto &ap) {
|
||||
return s + ap.poly.area();
|
||||
return s + (ap.bed_idx == 0) * ap.poly.area();
|
||||
}) / sc;
|
||||
|
||||
double fixed_area = unsel_area + m_selected.size() * poly_area;
|
||||
double bed_area = Polygon{m_bedpts}.area() / sc;
|
||||
|
||||
// This is the maximum range, the real number will always be close but less.
|
||||
double bed_area = Polygon{m_bedpts}.area() / sc;
|
||||
|
||||
m_status_range = (bed_area - fixed_area) / poly_area;
|
||||
// This is the maximum number of items, the real number will always be close but less.
|
||||
int needed_items = (bed_area - fixed_area) / poly_area;
|
||||
|
||||
ModelInstance *mi = model_object->instances[0];
|
||||
for (int i = 0; i < m_status_range; ++i) {
|
||||
for (int i = 0; i < needed_items; ++i) {
|
||||
ArrangePolygon ap;
|
||||
ap.poly = m_selected.front().poly;
|
||||
ap.bed_idx = arrangement::UNARRANGED;
|
||||
|
@ -77,6 +76,8 @@ void FillBedJob::prepare()
|
|||
};
|
||||
m_selected.emplace_back(ap);
|
||||
}
|
||||
|
||||
m_status_range = m_selected.size();
|
||||
}
|
||||
|
||||
void FillBedJob::process()
|
||||
|
|
Loading…
Reference in a new issue