From c7ec4e5db0d2695e9fbd672df84f247688db0176 Mon Sep 17 00:00:00 2001 From: Eli Pinkerton Date: Sun, 18 Oct 2026 20:38:24 +0000 Subject: [PATCH] Reduce object row spacing Object rows leave excessive vertical space. Reduce the fixed slot from 46 to 40 points while retaining card and control dimensions. Share the slot height with ListView virtualization. Rendered Dx gap falls from 10 to 4 pixels at pixelsPerPoint 1, a 60 percent reduction. The new render regression fails at 10 points on the base and passes for all six shipped themes after the fix. Refresh the README layout capture and its pixel-verified lossless WebP. The full EditMode rerun passes 395 tests. One earlier run failed an existing theme-reset color transition assertion; its focused rerun passes. The 17-step repository gate and scoped image exporter tests pass. Revert this commit to restore prior spacing. Fixes #292. --- CHANGELOG.md | 2 + Editor/DataVisualizer/DataVisualizer.cs | 7 +- Tests/Editor/ObjectRowLayoutTests.cs | 74 ++++++++++++++++++++++ Tests/Editor/ObjectRowLayoutTests.cs.meta | 2 + docs/images/data-visualizer-layout.png | Bin 106618 -> 104561 bytes docs/images/data-visualizer-layout.webp | Bin 27990 -> 27104 bytes 6 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 Tests/Editor/ObjectRowLayoutTests.cs create mode 100644 Tests/Editor/ObjectRowLayoutTests.cs.meta diff --git a/CHANGELOG.md b/CHANGELOG.md index ba32d5c3..6145b09f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), ### Changed +- Reduce the vertical gap between object rows by at least half (#292). + - Point new installs and documentation links to Ambiguous-Interactive/DxVisualizer. Update site bookmarks to ; the old Pages site does not redirect. Existing Git installs keep working (#151). diff --git a/Editor/DataVisualizer/DataVisualizer.cs b/Editor/DataVisualizer/DataVisualizer.cs index 72b5fda4..6cbad226 100644 --- a/Editor/DataVisualizer/DataVisualizer.cs +++ b/Editor/DataVisualizer/DataVisualizer.cs @@ -85,11 +85,10 @@ overwrite the saved preferred size. private const int AsyncLoadPriorityBatchSize = 100; /* - Uniform row height for the virtualized object ListView. Measured live: the .object-item - box renders at ~40px; the slot is forced to this height and centers the box, so the extra - 6px becomes a 3px gap above and below each row. + Keep the fixed-height object ListView slots close to the card height to reduce + empty vertical space. Card padding and controls keep their existing dimensions. */ - private const float ObjectRowFixedHeight = 46f; + private const float ObjectRowFixedHeight = 40f; internal static DataVisualizer Instance; diff --git a/Tests/Editor/ObjectRowLayoutTests.cs b/Tests/Editor/ObjectRowLayoutTests.cs new file mode 100644 index 00000000..2463ce38 --- /dev/null +++ b/Tests/Editor/ObjectRowLayoutTests.cs @@ -0,0 +1,74 @@ +namespace WallstopStudios.DataVisualizer.Tests.Editor +{ + using System.Collections; + using System.Reflection; + using NUnit.Framework; + using UnityEditor; + using UnityEngine; + using UnityEngine.TestTools; + using UnityEngine.UIElements; + using WallstopStudios.DataVisualizer.Editor.Styles; + using DataVisualizerWindow = WallstopStudios.DataVisualizer.Editor.DataVisualizer; + + public sealed class ObjectRowLayoutTests + { + [UnityTest] + public IEnumerator ShouldKeepCompactRowsAndControlsInsideEveryShippedTheme() + { + using TestCleanupScope cleanup = new(); + FieldInfo instanceField = typeof(DataVisualizerWindow).GetField("Instance", BindingFlags.Static | BindingFlags.NonPublic); + object previousInstance = instanceField.GetValue(null); + cleanup.Defer(() => instanceField.SetValue(null, previousInstance)); + DataVisualizerWindow owner = ScriptableObject.CreateInstance(); + cleanup.Defer(() => Object.DestroyImmediate(owner)); + MethodInfo makeRow = typeof(DataVisualizerWindow).GetMethod("MakeObjectRow", BindingFlags.Instance | BindingFlags.NonPublic); + LayoutTestWindow window = ScriptableObject.CreateInstance(); + cleanup.Defer(window.Close); + window.position = new Rect(100, 100, 700, 200); + VisualElement root = window.rootVisualElement; + root.AddToClassList("dataviz-root"); + const string folder = "Packages/com.wallstop-studios.data-visualizer/Editor/DataVisualizer/Styles/"; + root.styleSheets.Add(AssetDatabase.LoadAssetAtPath(folder + "DataVisualizerStyles.uss")); + VisualElement first = (VisualElement)makeRow.Invoke(owner, null); + VisualElement second = (VisualElement)makeRow.Invoke(owner, null); + first.Q