Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Inspector V2] Align tree connection lines to widget icons #8842

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1237,14 +1237,10 @@ Paint _defaultPaint(ColorScheme colorScheme) =>
..color = colorScheme.treeGuidelineColor
..strokeWidth = chartLineStrokeWidth;

/// The distance (on the x-axis) between the expand/collapse and the start of
/// the row, as determined by a percentage of the [inspectorColumnIndent].
const _expandCollapseToRowStartXDistancePercentage = 0.68;

/// The distance (on the x-axis) between the center of the widget icon and the
/// start of the row, as determined by a percentage of the
/// [inspectorColumnIndent].
const _iconCenterToRowStartXDistancePercentage = 0.15;
const _iconCenterToRowStartXDistancePercentage = 0.41;

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

final node = row.node;
final showExpandCollapse = node.showExpandCollapse;
final distanceFromExpandCollapseToRowStart =
inspectorColumnIndent * _expandCollapseToRowStartXDistancePercentage;
final distanceFromIconCenterToRowStart =
inspectorColumnIndent * _iconCenterToRowStartXDistancePercentage;
for (final tick in row.ticks) {
final expandCollapseX =
_controller.getDepthIndent(tick) -
distanceFromExpandCollapseToRowStart;
_controller.getDepthIndent(tick) - distanceFromIconCenterToRowStart;
// Draw a vertical line for each tick identifying a connection between
// an ancestor of this node and some other node in the tree.
canvas.drawLine(
Expand All @@ -1296,11 +1291,11 @@ class _RowPainter extends CustomPainter {
if (row.lineToParent) {
final parentExpandCollapseX =
_controller.getDepthIndent(row.depth - 1) -
distanceFromExpandCollapseToRowStart;
distanceFromIconCenterToRowStart;
final width =
showExpandCollapse
? inspectorColumnIndent * 0.6
: inspectorColumnIndent;
? inspectorColumnIndent * 0.45
: inspectorColumnIndent * .6;
canvas.drawLine(
Offset(parentExpandCollapseX, 0.0),
Offset(parentExpandCollapseX, inspectorRowHeight * 0.5),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ typedef TreeEventCallback = void Function(InspectorTreeNode node);

const iconPadding = 4.0;
const chartLineStrokeWidth = 1.0;
double get inspectorColumnIndent => scaleByFontFactor(24.0);
double get inspectorColumnIndent => scaleByFontFactor(36.0);
double get inspectorRowHeight => scaleByFontFactor(20.0);

/// This class could be refactored out to be a reasonable generic collapsible
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading