Skip to content

Commit

Permalink
More deterministic sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Jan 26, 2020
1 parent bb4d4f3 commit f0f88cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/OrientatedItemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ public function getBestOrientation(
$orientationAMinGap = min($orientationAWidthLeft, $orientationALengthLeft);
$orientationBMinGap = min($orientationBWidthLeft, $orientationBLengthLeft);

if ($orientationAMinGap === 0 && ($orientationBMinGap !== 0 || PHP_MAJOR_VERSION > 5)) { // prefer A if it leaves no gap
if ($orientationAMinGap === 0 && $orientationBMinGap === 0) {
return $a->getDepth() - $b->getDepth();
}

if ($orientationAMinGap === 0 && $orientationBMinGap !== 0) { // prefer A if it leaves no gap
return -1;
}
if ($orientationBMinGap === 0) { // prefer B if it leaves no gap
Expand Down

0 comments on commit f0f88cb

Please sign in to comment.