Skip to content

Commit

Permalink
Skip cycling through the rest of the items when the available width is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Nov 12, 2018
1 parent 1f3f611 commit a30406f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/VolumePacker.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ protected function packLayer($startDepth, $widthLeft, $lengthLeft, $depthLeft)
} elseif (count($layer->getItems()) === 0) { // zero items on layer
$this->logger->debug("doesn't fit on layer even when empty, skipping for good");
continue;
} elseif (count($this->items) > 0) { // skip for now, move on to the next item
} elseif ($widthLeft > 0 && count($this->items) > 0) { // skip for now, move on to the next item
$this->logger->debug("doesn't fit, skipping for now");
$this->skippedItems->insert($itemToPack);
} elseif ($x > 0 && $lengthLeft >= min($itemToPack->getWidth(), $itemToPack->getLength(), $itemToPack->getDepth())) {
Expand Down

0 comments on commit a30406f

Please sign in to comment.