Skip to content
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
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
SetExpectedControlLayout(attribute.layout);
}

// Fixed label width in pixels; zero sizes the label to its text.
internal float labelWidth { get; set; }

Check warning on line 82 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L82

Added line #L82 was not covered by tests

public void OnGUI()
{
EditorGUILayout.BeginHorizontal();
Expand All @@ -96,7 +99,7 @@

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;

Check warning on line 102 in Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs#L102

Added line #L102 was not covered by tests
EditorGUI.LabelField(labelRect, pathLabel);
lineRect.x += labelRect.width;
lineRect.width -= labelRect.width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,8 @@
#control-schemes-toolbar-container {
flex-shrink: 0;
}

.properties-field > .unity-base-field__label {
min-width: 120px;
width: 120px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace UnityEngine.InputSystem.Editor
internal class ActionPropertiesView : ViewBase<(SerializedInputAction?, List<string>)>
{
private readonly Foldout m_ParentFoldout;
private readonly int m_DropdownLabelWidth = 90;

public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer stateContainer)
: base(root, stateContainer)
Expand Down Expand Up @@ -43,11 +42,7 @@ public override void RedrawUI((SerializedInputAction ? , List<string>) 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<Label>();
actionLabel.style.minWidth = m_DropdownLabelWidth;
actionLabel.style.width = m_DropdownLabelWidth;

actionType.AddToClassList(InputActionsEditorConstants.PropertiesFieldStyleClassName);
actionType.RegisterValueChangedCallback(evt =>
{
Dispatch(Commands.ChangeActionType(inputAction, (InputActionType)evt.newValue));
Expand All @@ -58,12 +53,7 @@ public override void RedrawUI((SerializedInputAction ? , List<string>) viewState
{
var controlTypes = viewState.Item2;
var controlType = new DropdownField("Control Type");

// Tighten up the gap between the label and dropdown so the latter is more readable when the parent pane is at min width.
var controlLabel = controlType.Q<Label>();
controlLabel.style.minWidth = m_DropdownLabelWidth;
controlLabel.style.width = m_DropdownLabelWidth;

controlType.AddToClassList(InputActionsEditorConstants.PropertiesFieldStyleClassName);
controlType.choices.Clear();
controlType.choices.AddRange(controlTypes.Select(ObjectNames.NicifyVariableName).ToList());
var controlTypeIndex = controlTypes.FindIndex(s => s == inputAction.expectedControlType);
Expand Down Expand Up @@ -95,9 +85,7 @@ public override void RedrawUI((SerializedInputAction ? , List<string>) viewState
{
tooltip = InputActionsEditorConstants.ActionPriorityTooltip
};
var priorityLabel = priorityField.Q<Label>();
priorityLabel.style.minWidth = m_DropdownLabelWidth;
priorityLabel.style.width = m_DropdownLabelWidth;
priorityField.AddToClassList(InputActionsEditorConstants.PropertiesFieldStyleClassName);
priorityField.SetValueWithoutNotify(inputAction.priority);
priorityField.RegisterCallback<FocusOutEvent>(_ => ScheduleCommitActionPriority(priorityField, inputAction));
priorityField.RegisterCallback<BlurEvent>(_ => ScheduleCommitActionPriority(priorityField, inputAction));
Expand All @@ -116,6 +104,7 @@ public override void RedrawUI((SerializedInputAction ? , List<string>) viewState
{
tooltip = InputActionsEditorConstants.InitialStateCheckTooltip
};
initialStateCheck.AddToClassList(InputActionsEditorConstants.PropertiesFieldStyleClassName);
initialStateCheck.SetValueWithoutNotify(inputAction.initialStateCheck);
initialStateCheck.RegisterValueChangedCallback(evt =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
{
var controlPathEditor = new InputControlPathEditor(viewState.selectedBindingPath, new InputControlPickerState(),
() => { Dispatch(Commands.ApplyModifiedProperties()); });
controlPathEditor.labelWidth = InputActionsEditorConstants.PropertiesLabelWidth;

Check warning on line 63 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs#L63

Added line #L63 was not covered by tests
controlPathEditor.SetControlPathsToMatch(viewState.currentControlScheme.deviceRequirements.Select(x => x.controlPath));

var inputAction = viewState.selectedInputAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

m_PathEditorContainer = container.Q<IMGUIContainer>("path-editor-container");
m_CompositePartField = container.Q<DropdownField>("composite-part-dropdown");
m_CompositePartField.AddToClassList(InputActionsEditorConstants.PropertiesFieldStyleClassName);

Check warning on line 28 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs#L28

Added line #L28 was not covered by tests

CreateSelector(Selectors.GetSelectedBinding,
(b, s) => b.HasValue && b.Value.isPartOfComposite ? Selectors.GetCompositePartBindingViewState(b.Value, s) : null);
Expand All @@ -37,6 +38,7 @@
// TODO: Persist control picker state
var controlPathEditor = new InputControlPathEditor(viewState.selectedBindingPath, new InputControlPickerState(),
() => { Dispatch(Commands.ApplyModifiedProperties()); });
controlPathEditor.labelWidth = InputActionsEditorConstants.PropertiesLabelWidth;

Check warning on line 41 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs#L41

Added line #L41 was not covered by tests

controlPathEditor.SetControlPathsToMatch(viewState.currentControlScheme.deviceRequirements.Select(x => x.controlPath));
controlPathEditor.SetExpectedControlLayout(viewState.expectedControlLayoutName);
Expand Down
Loading