feat(web): zoom suggestion-carousel tiles onto the ref's boundingBox #1054
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/carousel-face-zoom-web"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Adds the
boundingBoxzoom lane to the suggestions carousel (apps/web only), giving suggestion tiles the same face-framing result as the people page's "Vis område" toggle.The carousel already had a zoom lane driven by the
scopeenrichment (ScopedInstanceThumbnail+bboxCropStyle, 1:1 pixels, no upscale). This PR adds the parallel lane contracted on the camelCaseboundingBoxfield, usingscopeCropFit— the exact patternDiscoveryInstanceDetailuses for "Vis område".Behaviour
Ref carries
boundingBox(and a media item):/api/media/{mediaItemId}/derived/thumbnail?size=512.scopeCropFittransform (tileAspect = 1,allowSliceShift: true) that frames the face;object-positioncomes from the same fit,object-coveris kept.<img>(naturalWidth/Heightinto aSvelteMap), so the tile renders untransformed until the first load — no flash of a wrong crop.group-hover:scale-105is dropped on these tiles so the hover scale cannot fight the bbox transform.loading="lazy", alt texts and the rest of the card markup are untouched.Ref without
boundingBox(or with an unusable box / no media item):scopezoom → face crop → derived thumbnail → "No preview". The parser is defensive:boundingBoxorbounding_box, non-numeric/zero/negative values → treated as absent.Safe to ship in any API order — the PR it pairs with (apps/api #1053) has already merged and mirrors
scopeintoboundingBox; this UI only feature-detects.Changes
apps/web/src/lib/api/discovery.ts— typed optionalboundingBoxonClassInstanceCandidateOccurrenceRef.apps/web/src/lib/components/DomainSuggestionsCarousel.svelte—refBoundingBoxparser,refFullPhotoUrl,fitlane onrefPreview, measured-aspectSvelteMap, and a sharedrefTileMediasnippet so card tiles and detail-dialog crops render identically.apps/web/tests/discovery-review.spec.ts— two new specs: box present (transform wrapper +?size=512src, no face-crop request, dialog parity) and malformed box (falls back to the unchanged face crop).Verification
npm run check— 0 errors (22 pre-existing warnings, none in touched files)npm run test:unit— 66/66 passednpm test— 801 passed, 0 failed, 23 skipped; 2 flaky (plant-assignment.spec.tshover/amber-border, pre-existing, passed on retry)tests/discovery-review.spec.tsfull run — 122/122 passed