-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Close context menus when deselecting items in editor #29279
Close context menus when deselecting items in editor #29279
Conversation
OsuContextMenu
close when deselected the items.OsuContextMenu
close when deselecting items in editor
protected void DeselectAll() | ||
{ | ||
SelectedItems.Clear(); | ||
ContextMenuContainer?.CloseMenu(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One situation I'm not sure about is that pasting doesn't close the menu even though it selects the newly-pasted hitobjects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One situation I'm not sure about is that pasting doesn't close the menu even though it selects the newly-pasted hitobjects.
close the menu whatever the selected object changed
internal virtual void HandleSelected(SelectionBlueprint<T> blueprint)
{
// there are potentially multiple SelectionHandlers active, but we only want to add items to the selected list once.
if (!SelectedItems.Contains(blueprint.Item))
SelectedItems.Add(blueprint.Item);
selectedBlueprints.Add(blueprint);
+ ContextMenuContainer?.CloseMenu();
}
Just cleaned things up a bit for review. Lgtm. Requesting another reviewer. I noticed one problem with context menus in general - if a mouse down is handled inside them then the menu isn't closed. It's an issue here because BlueprintContainer handles it, but it can't be fixed in this PR (and is likely an o!f issue): osu/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs Lines 114 to 131 in d637bbf
|
OsuContextMenu
close when deselecting items in editor@@ -1007,7 +1009,7 @@ private void onModeChanged(ValueChangedEvent<EditorScreenMode> e) | |||
throw new InvalidOperationException("Editor menu bar switched to an unsupported mode"); | |||
} | |||
|
|||
LoadComponentAsync(currentScreen, newScreen => | |||
screenContainer.LoadComponentAsync(currentScreen, newScreen => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this change doing? @smoogipoo looks like one of yours?
I'm not sure it's a big deal but I'm weirded out by it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the context menu container was stored as a local and cached in this class. Now, the context menu container caches itself via [Cached]
on the type itself.
But this moves the dependencies one level lower from Editor
itself, and previously this line would load the screen with the dependencies of the Editor
rather than the expected lower level.
Closed #29132
Implementation:
CloseMenu
method inOsuContextMenuContainer
OsuContextMenuContainer
At theSkinEditor
andEditor
OsuContextMenuContainer
inSelectionHandler
OsuContextMenuContainer.CloseMenu
method whenSelectionHandler.DeselectAll
was calledVideo
Beatmap editor:
2024-08-04.20-00-52.mp4
Skin editor:
2024-08-04.20-01-40.mp4