Skip to content

Commit b645fc3

Browse files
committed
fix(demo): overlay compare-cell label and correct baseline explanation
- .compare-image-cell::before used position: sticky inside a flex row, making the label a flex item that consumed horizontal space beside the img and produced slightly different widths for left vs right labels. Switch to position: absolute (cell is already position: relative) so the label overlays the image without affecting layout. - The 'Both panels show the unmodified source' message only checked right.kind === 'baseline', which was incorrect when the user swapped the left picker to a tile while right was baseline. Guard it on both sides being baseline; add a right-only baseline case.
1 parent 02bf8b2 commit b645fc3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/demo-page.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,12 @@ export const DEMO_PAGE_HTML = `<!DOCTYPE html>
274274
}
275275
.compare-image-cell::before {
276276
content: attr(data-side);
277-
position: sticky; top: 6px; left: 6px;
277+
position: absolute; top: 6px; left: 6px;
278278
background: rgba(0,0,0,0.65); color: var(--text);
279279
font-size: 10px; font-family: var(--mono);
280280
padding: 2px 6px; border-radius: 3px;
281281
text-transform: uppercase; letter-spacing: 0.08em;
282-
z-index: 2; align-self: flex-start;
282+
z-index: 2;
283283
}
284284
.compare-image-cell img {
285285
display: block; width: 100%; height: auto;
@@ -851,8 +851,10 @@ function renderCompare() {
851851
852852
// Explanation pulled from the right-hand entry's binding (the "strategy")
853853
let explain = '';
854-
if (right.kind === 'baseline') {
854+
if (left.kind === 'baseline' && right.kind === 'baseline') {
855855
explain = 'Both panels show the unmodified source. Pan and zoom to inspect the original.';
856+
} else if (right.kind === 'baseline') {
857+
explain = 'Right panel shows the unmodified source. Compare against the left panel'+'\u2019'+'s encode.';
856858
} else if (right.binding === 'target') {
857859
explain =
858860
'Right panel: proxy encoded at <code>' + right.encodeW + '×' + right.encodeH + '</code> ' +

0 commit comments

Comments
 (0)