feat(IMP-11): D-2 — frame min_height_px hint (backend → UI)
Step 9 v4_all_judgments[] now exposes per-candidate min_height_px from catalog frame_contracts.visual_hints.min_height_px (None when contract unregistered). SlideCanvas pendingLayout zones render a red ring + 'min H Npx' badge when zone height falls below the active frame's threshold. Visual hint only; resize clamp (minSize=0.05) unchanged. 5 axes (single commit per Stage 5 plan): - u1 backend: src/phase_z2_pipeline.py — Step 9 builder adds min_height_px via single get_contract(c.template_id) lookup; reuses _contract for catalog_registered (no double-lookup). - u2 type: Front/client/src/types/designAgent.ts — FrameCandidate gains optional minHeightPx?: number. - u3 mapper: Front/client/src/services/designAgentApi.ts — maps snake-case min_height_px → camelCase minHeightPx on v4_all_judgments path; v4_candidates fallback remains undefined (graceful). - u4 active-frame lookup: Front/client/src/components/SlideCanvas.tsx — activeFrameId = overrideFrameId ?? defaultFrameId; activeCandidate via region.frame_candidates.find. - u5 hint render: Front/client/src/components/SlideCanvas.tsx — zoneHeightPx = height * SLIDE_H (logical px, no double-apply); compare against activeCandidate.minHeightPx in pendingLayout mode only; red border + badge when below. Tests: 5/5 pass in tests/test_phase_z2_step9_v4_all_judgments_min_height.py (source-string + catalog-shape guards + None propagation, registered and unregistered template_ids). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -612,6 +612,28 @@ export default function SlideCanvas({
|
||||
: null;
|
||||
const previewUrl = previewCandidate?.thumbnailUrl ?? null;
|
||||
|
||||
// IMP-11 u4: active frame lookup — distinct axis from preview.
|
||||
// preview is shown only when override differs from default; active is
|
||||
// always defined as override-if-present-else-default. Used by u5 to
|
||||
// compare the active frame's catalog min_height_px against zone height.
|
||||
const activeFrameId = overrideFrameId ?? defaultFrameId;
|
||||
const activeCandidate = activeFrameId
|
||||
? region?.frame_candidates?.find((c) => c.id === activeFrameId)
|
||||
: undefined;
|
||||
|
||||
// IMP-11 u5: catalog min_height_px violation hint. height is already
|
||||
// a fraction of SLIDE_H (1280x720 logical px coordinate space), so
|
||||
// logical px = height * SLIDE_H. measuredSlideBody.h is intentionally
|
||||
// not re-multiplied (double-apply would shrink the comparison value).
|
||||
// Hint is pendingLayout-only; resize clamp (minSize=0.05) is unchanged.
|
||||
const zoneHeightPx = isPendingLayout ? height * SLIDE_H : null;
|
||||
const minHeightPx = activeCandidate?.minHeightPx ?? null;
|
||||
const belowMinHeight =
|
||||
isPendingLayout &&
|
||||
minHeightPx != null &&
|
||||
zoneHeightPx != null &&
|
||||
zoneHeightPx < minHeightPx;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={zone.id}
|
||||
@@ -695,6 +717,18 @@ export default function SlideCanvas({
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* IMP-11 u5: red border + 'min H Npx' badge when zone height
|
||||
is below the active frame's catalog min_height_px. Visual
|
||||
hint only, no clamp/resize behavior change. */}
|
||||
{belowMinHeight && minHeightPx != null && (
|
||||
<>
|
||||
<div className="absolute inset-0 pointer-events-none border-2 border-red-500" />
|
||||
<span className="absolute bottom-1 right-1 text-[9px] font-black uppercase tracking-tighter px-1.5 py-0.5 rounded bg-red-500 text-white shadow pointer-events-none">
|
||||
min H {minHeightPx}px
|
||||
</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
{/* zone 라벨 — 좌상단. 주 라벨 = section ids (S1, S1+S2),
|
||||
부 라벨 = backend zone position (top, bottom, primary). */}
|
||||
<div className="absolute top-1 left-1 flex items-center gap-1 pointer-events-none">
|
||||
|
||||
@@ -527,6 +527,10 @@ export async function loadRun(runId: string): Promise<LoadRunResult> {
|
||||
// backend step09 의 catalog_registered (frame_contracts.yaml 등록 여부).
|
||||
// v4_all_judgments 에만 있음. v4_candidates fallback 시 undefined.
|
||||
catalogRegistered: c.catalog_registered,
|
||||
// backend step09 의 min_height_px (frame_contracts.yaml visual_hints.min_height_px).
|
||||
// logical 1280x720 px 좌표계. contract 미등록 또는 visual_hints 부재 시 undefined.
|
||||
// v4_all_judgments 에만 있음. v4_candidates fallback 시 undefined (graceful).
|
||||
minHeightPx: c.min_height_px ?? undefined,
|
||||
}));
|
||||
|
||||
const displayStrategy = (
|
||||
|
||||
@@ -127,6 +127,10 @@ export interface FrameCandidate {
|
||||
/** backend frame_contracts.yaml 에 catalog 등록 여부. false 면 사용자가 override
|
||||
* 시도해도 Step 7-A 가 skip (render path 미연결). UI 회색 + "render path 미적용" 표시. */
|
||||
catalogRegistered?: boolean;
|
||||
/** IMP-11 D-2 — frame contract visual_hints.min_height_px (logical 1280x720 px).
|
||||
* Source = templates/phase_z2/catalog/frame_contracts.yaml visual_hints.min_height_px.
|
||||
* Undefined when contract unregistered or visual_hints absent (frontend tolerates undefined). */
|
||||
minHeightPx?: number;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user