feat(draw): per-object data-* caption overlay on the drawing card (T-318)

DrawingCard stacks a caption layer over the SVG: each data-label /
data-description annotation renders a themed caption just below its
element, mapped to pixel space via a shared svgViewportFit (refactored out
of the painter so the overlay and the paint use identical viewBox-fit
math). Display-only (IgnorePointer). Widget-tested. data-lightbox is
captured in the model; the tap-to-zoom interaction is the last follow-on.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-28 22:35:12 +02:00
co-authored by Claude Opus 4.8
parent 78b0a7b8a4
commit 3e43746c17
3 changed files with 77 additions and 9 deletions
+10
View File
@@ -33,4 +33,14 @@ void main() {
expect(find.byType(SvgView), findsOneWidget);
expect(find.text('Build pipeline'), findsNothing);
});
testWidgets('renders per-object captions from data-* annotations (T-318)', (tester) async {
final doc = buildSvgDocument(
'<svg viewBox="0 0 100 50"><rect x="10" y="10" width="40" height="20" data-label="Node A" data-description="the entry point"/></svg>',
);
await tester.pumpWidget(anchoredHarness(f, SizedBox(width: 400, child: DrawingCard(document: doc))));
await tester.pump();
expect(find.text('Node A'), findsOneWidget);
expect(find.text('the entry point'), findsOneWidget);
});
}