UI: Keymap Editor: Add margin from scrollbar

The "X" button to delete a keymap entry is too close to the scrollbar,
potentially leading to misclicks that would delete data.

Add margin to the right of the buttons to prevent this.
The X button is now aligned when the box is open/closed.

Pull Request: https://projects.blender.org/blender/blender/pulls/130349
This commit is contained in:
Pablo Vazquez
2024-11-18 15:57:42 +01:00
committed by Pablo Vazquez
parent 376f896b1f
commit 1cd0ffd1d6

View File

@@ -66,6 +66,8 @@ def draw_km(display_keymaps, kc, km, children, layout, level):
if km.is_user_modified:
subrow.operator("preferences.keymap_restore", text="Restore")
# Add margin to space the button from the scrollbar.
subrow.separator()
if km.is_modal:
subrow.label(text="", icon='LINKED')
del subrow
@@ -157,6 +159,9 @@ def draw_kmi(display_keymaps, kc, km, kmi, layout, level):
icon=('TRACKING_CLEAR_BACKWARDS' if kmi.is_user_defined else 'X')
).item_id = kmi.id
# Add margin to space the buttons from the scrollbar.
row.separator(factor=0.25 if kmi.show_expanded else 1.0)
# Expanded, additional event settings
if kmi.show_expanded:
box = col.box()
@@ -345,6 +350,8 @@ def draw_filtered(display_keymaps, filter_type, filter_text, layout):
subrow = row.row()
subrow.alignment = 'RIGHT'
subrow.operator("preferences.keymap_restore", text="Restore")
# Add margin to space the button from the scrollbar.
subrow.separator()
for kmi in filtered_items:
draw_kmi(display_keymaps, kc, km, kmi, col, 1)