diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index f76e95292a..b43399f060 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed +- Fixed misaligned labels in the Input Actions editor properties pane. [UUM-154536](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-154536) - Fixed a single click producing two simultaneous touches when the Device Simulator view is open and "Simulate Touch Input From Mouse or Pen" is enabled in the Input Debugger; Touch Simulation now suppresses its events while a Device Simulator view is open [UUM-153420] - Fixed the search field in the "Add supported device" popup (Input System Package Settings > Supported Devices > "+") drawing flush against the popup's left edge with no left margin, unlike its right-side spacing; it is now inset to match [UUM-150217](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-150217) - Fixed the "Supported Devices" list in the Input System Package Settings sitting flush against the panel edge with no left/right margin, unlike the surrounding fields; it is now inset to line up with the other settings controls [UUM-150207](https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-150207) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index 895fb96908..989dbffd73 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -78,6 +78,9 @@ public void SetExpectedControlLayoutFromAttribute() SetExpectedControlLayout(attribute.layout); } + // Fixed label width in pixels; zero sizes the label to its text. + internal float labelWidth { get; set; } + public void OnGUI() { EditorGUILayout.BeginHorizontal(); @@ -96,7 +99,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert var lineRect = rect; var labelRect = lineRect; - labelRect.width = EditorStyles.label.CalcSize(pathLabel).x + 20; // Fit to label with some padding + labelRect.width = labelWidth > 0 ? labelWidth : EditorStyles.label.CalcSize(pathLabel).x + 20; EditorGUI.LabelField(labelRect, pathLabel); lineRect.x += labelRect.width; lineRect.width -= labelRect.width; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs index 1d25d69635..db8dfe3f95 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs @@ -21,6 +21,11 @@ internal static class InputActionsEditorConstants /// Classes public static readonly string HiddenStyleClassName = "unity-input-actions-editor-hidden"; + public static readonly string PropertiesFieldStyleClassName = "properties-field"; + + // Must stay in sync with the .properties-field label width in InputActionsEditorStyles.uss. + // Only the IMGUI control path editor needs it as a number; UITK fields get it from USS. + public const int PropertiesLabelWidth = 120; public const string CompositePartAssignmentTooltip = "The named part of the composite that the binding is assigned to. Multiple bindings may be assigned the same part. All controls from " diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss index cee4211595..d88ede9e7d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss @@ -237,3 +237,8 @@ #control-schemes-toolbar-container { flex-shrink: 0; } + +.properties-field > .unity-base-field__label { + min-width: 120px; + width: 120px; +} diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs index 45ab346662..bfe2eb0288 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs @@ -11,7 +11,6 @@ namespace UnityEngine.InputSystem.Editor internal class ActionPropertiesView : ViewBase<(SerializedInputAction?, List)> { private readonly Foldout m_ParentFoldout; - private readonly int m_DropdownLabelWidth = 90; public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer stateContainer) : base(root, stateContainer) @@ -43,11 +42,7 @@ public override void RedrawUI((SerializedInputAction ? , List) viewState tooltip = inputAction.actionTypeTooltip }; - // Tighten up the gap between the label and dropdown so the latter is more readable when the parent pane is at min width. - var actionLabel = actionType.Q