Skip to content

Commit

Permalink
add pos zero
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Jul 12, 2024
1 parent cf4a56c commit 9046fa0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,15 @@ func (p *Packer) packToBox(b *Box, items []*Item) []*Item {

// Try to put each item in the box
for k := 0; k < len(copyItems) && itemsFit < len(copyItems); k++ {
// Try to put item in the box
for j := len(backup.items) - 1; j >= 0; j-- {
dimension := backup.items[j].GetDimension()

// Check if item can be put in the box
if backup.PutItem(copyItems[k], backup.items[j].position) {
itemsFit++
break

Check failure on line 246 in packer.go

View workflow job for this annotation

GitHub Actions / lint (1.22)

break with no blank line before (nlreturn)
}

// Try to put item in each axis
for _, pt := range []Axis{WidthAxis, HeightAxis, DepthAxis} {
// Calculate pivot position
Expand All @@ -261,7 +266,6 @@ func (p *Packer) packToBox(b *Box, items []*Item) []*Item {
// If item can be put in the box
if backup.PutItem(copyItems[k], pv) {
itemsFit++

break

Check failure on line 269 in packer.go

View workflow job for this annotation

GitHub Actions / lint (1.22)

break with no blank line before (nlreturn)
}
}
Expand All @@ -287,3 +291,4 @@ func (p *Packer) packToBox(b *Box, items []*Item) []*Item {

// return unpacked slice
return unpacked
}

0 comments on commit 9046fa0

Please sign in to comment.