diff --git a/VolumePacker.php b/VolumePacker.php index a25df088..446449a8 100644 --- a/VolumePacker.php +++ b/VolumePacker.php @@ -254,7 +254,7 @@ protected function tryAndStackItemsIntoSpace( $maxLength, $maxDepth ) { - while (!$this->items->isEmpty() && $this->remainingWeight >= $this->items->top()->getWeight()) { + while (!$this->items->isEmpty() && $this->checkNonDimensionalConstraints($this->items->top(), $packedItems)) { $stackedItem = $this->getOrientationForItem( $this->items->top(), $prevItem,