Skip to content

Commit 1a7e403

Browse files
authored
[Inspector V2] Align tree connection lines to widget icons (#8842)
1 parent d4dd0fd commit 1a7e403

11 files changed

+8
-13
lines changed

packages/devtools_app/lib/src/screens/inspector_v2/inspector_tree_controller.dart

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,14 +1237,10 @@ Paint _defaultPaint(ColorScheme colorScheme) =>
12371237
..color = colorScheme.treeGuidelineColor
12381238
..strokeWidth = chartLineStrokeWidth;
12391239

1240-
/// The distance (on the x-axis) between the expand/collapse and the start of
1241-
/// the row, as determined by a percentage of the [inspectorColumnIndent].
1242-
const _expandCollapseToRowStartXDistancePercentage = 0.68;
1243-
12441240
/// The distance (on the x-axis) between the center of the widget icon and the
12451241
/// start of the row, as determined by a percentage of the
12461242
/// [inspectorColumnIndent].
1247-
const _iconCenterToRowStartXDistancePercentage = 0.15;
1243+
const _iconCenterToRowStartXDistancePercentage = 0.41;
12481244

12491245
/// The distance (on the y-axis) between the bottom of the widget icon and the
12501246
/// top of the row, as determined by a percentage of the [inspectorRowHeight].
@@ -1277,12 +1273,11 @@ class _RowPainter extends CustomPainter {
12771273

12781274
final node = row.node;
12791275
final showExpandCollapse = node.showExpandCollapse;
1280-
final distanceFromExpandCollapseToRowStart =
1281-
inspectorColumnIndent * _expandCollapseToRowStartXDistancePercentage;
1276+
final distanceFromIconCenterToRowStart =
1277+
inspectorColumnIndent * _iconCenterToRowStartXDistancePercentage;
12821278
for (final tick in row.ticks) {
12831279
final expandCollapseX =
1284-
_controller.getDepthIndent(tick) -
1285-
distanceFromExpandCollapseToRowStart;
1280+
_controller.getDepthIndent(tick) - distanceFromIconCenterToRowStart;
12861281
// Draw a vertical line for each tick identifying a connection between
12871282
// an ancestor of this node and some other node in the tree.
12881283
canvas.drawLine(
@@ -1296,11 +1291,11 @@ class _RowPainter extends CustomPainter {
12961291
if (row.lineToParent) {
12971292
final parentExpandCollapseX =
12981293
_controller.getDepthIndent(row.depth - 1) -
1299-
distanceFromExpandCollapseToRowStart;
1294+
distanceFromIconCenterToRowStart;
13001295
final width =
13011296
showExpandCollapse
1302-
? inspectorColumnIndent * 0.6
1303-
: inspectorColumnIndent;
1297+
? inspectorColumnIndent * 0.45
1298+
: inspectorColumnIndent * .6;
13041299
canvas.drawLine(
13051300
Offset(parentExpandCollapseX, 0.0),
13061301
Offset(parentExpandCollapseX, inspectorRowHeight * 0.5),

packages/devtools_app/lib/src/shared/console/eval/inspector_tree_v2.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ typedef TreeEventCallback = void Function(InspectorTreeNode node);
2727

2828
const iconPadding = 4.0;
2929
const chartLineStrokeWidth = 1.0;
30-
double get inspectorColumnIndent => scaleByFontFactor(24.0);
30+
double get inspectorColumnIndent => scaleByFontFactor(36.0);
3131
double get inspectorRowHeight => scaleByFontFactor(20.0);
3232

3333
/// This class could be refactored out to be a reasonable generic collapsible
Loading
Loading
Loading

0 commit comments

Comments
 (0)