feat(app): graph pan, zoom and expanded view
This commit is contained in:
@@ -159,7 +159,8 @@ class RunGraphEdgePainter extends CustomPainter {
|
||||
/// outcome labels only for routes the run actually took.
|
||||
///
|
||||
/// [layout] and [routing] are the caller's measured geometry. The canvas never
|
||||
/// changes them and never assumes a node size.
|
||||
/// changes them and never assumes a node size; the caller supplies the pan/zoom
|
||||
/// viewport around this content.
|
||||
class RunGraphCanvas extends StatelessWidget {
|
||||
const RunGraphCanvas({
|
||||
super.key,
|
||||
@@ -202,55 +203,47 @@ class RunGraphCanvas extends StatelessWidget {
|
||||
final executedColor = cupertino
|
||||
? CupertinoTheme.of(context).primaryColor
|
||||
: Theme.of(context).colorScheme.primary;
|
||||
return InteractiveViewer(
|
||||
constrained: false,
|
||||
minScale: 0.3,
|
||||
maxScale: 3,
|
||||
child: SizedBox.fromSize(
|
||||
size: size,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: RunGraphEdgeLayer(
|
||||
executedRoutes: executed,
|
||||
untakenRoutes: untaken,
|
||||
canvasSize: size,
|
||||
executedColor: executedColor,
|
||||
untakenColor: style.edgeColor,
|
||||
strokeWidth: style.edgeWidth,
|
||||
return Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: RunGraphEdgeLayer(
|
||||
executedRoutes: executed,
|
||||
untakenRoutes: untaken,
|
||||
canvasSize: size,
|
||||
executedColor: executedColor,
|
||||
untakenColor: style.edgeColor,
|
||||
strokeWidth: style.edgeWidth,
|
||||
),
|
||||
),
|
||||
for (final box in layout.nodes)
|
||||
Positioned(
|
||||
left: box.x,
|
||||
top: box.y,
|
||||
width: box.width,
|
||||
height: box.height,
|
||||
child: RunGraphNode(
|
||||
node: nodesByKey[box.key]!,
|
||||
recordedStatus: recordedStatuses[box.key],
|
||||
selected: box.key == selectedStage,
|
||||
opensVisit:
|
||||
!nodesByKey[box.key]!.terminal &&
|
||||
state.isStageVisited(box.key),
|
||||
onSelected: onStageSelected,
|
||||
),
|
||||
),
|
||||
// A run labels only the routes that actually happened.
|
||||
for (final label in routing.labels)
|
||||
if (executedIds.contains(label.edgeId))
|
||||
Positioned(
|
||||
left: label.x,
|
||||
top: label.y,
|
||||
child: Text(
|
||||
routing.routeFor(label.edgeId)!.label,
|
||||
style: style.labelStyle,
|
||||
),
|
||||
),
|
||||
for (final box in layout.nodes)
|
||||
Positioned(
|
||||
left: box.x,
|
||||
top: box.y,
|
||||
width: box.width,
|
||||
height: box.height,
|
||||
child: RunGraphNode(
|
||||
node: nodesByKey[box.key]!,
|
||||
recordedStatus: recordedStatuses[box.key],
|
||||
selected: box.key == selectedStage,
|
||||
opensVisit:
|
||||
!nodesByKey[box.key]!.terminal &&
|
||||
state.isStageVisited(box.key),
|
||||
onSelected: onStageSelected,
|
||||
),
|
||||
),
|
||||
// A run labels only the routes that actually happened.
|
||||
for (final label in routing.labels)
|
||||
if (executedIds.contains(label.edgeId))
|
||||
Positioned(
|
||||
left: label.x,
|
||||
top: label.y,
|
||||
child: Text(
|
||||
routing.routeFor(label.edgeId)!.label,
|
||||
style: style.labelStyle,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user