This commit is contained in:
2026-06-13 19:14:24 +02:00
parent 0b3e22c97e
commit 81e505e040
19 changed files with 194 additions and 56 deletions
+14 -4
View File
@@ -255,7 +255,7 @@ func (HeuristicEngine) Propose(photos []PhotoAnalysis, profile ProfileInfo) ([]T
cool: sorted[0].Warmth < 0.02,
}
if len(sorted) > 1 {
plan.inserts = sorted[1:min(len(sorted), 3)] // hero + up to 2 inserts
plan.inserts = sorted[1:min(len(sorted), 5)] // hero + up to 4 inserts
}
// Only side-column inserts (or none): a bottom strip collides with the QSO
@@ -671,9 +671,19 @@ func placeInserts(inserts []PhotoAnalysis, hero PhotoAnalysis, archetype string)
return els, pxRect{x: margin, y: cardH - 380, w: cardW - 2*margin, h: 380 - margin}
}
// Side column: pick the calmer half of the hero photo.
n := min(len(inserts), 3)
w, gap, margin := 400.0, 20.0, 70.0
// Side column: pick the calmer half of the hero photo. The insert width
// shrinks as needed so up to 4 framed photos stack down the side.
n := min(len(inserts), 4)
gap, margin := 20.0, 70.0
availH := float64(cardH) - 2*margin - float64(n-1)*gap
var arSum float64
for i := 0; i < n; i++ {
arSum += float64(inserts[i].H) / float64(inserts[i].W)
}
w := 400.0
if arSum > 0 {
w = clamp(availH/arSum, 240, 400) // fit all n vertically, within sane bounds
}
left := halfDetail(hero, true) < halfDetail(hero, false)
x := cardW - w - margin
if left {