mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-03 21:02:06 +01:00
Close the vehicle catalogue on release, not on the double-click press
Closing from DoubleTapped left the pointer captured by a dead window, and on Windows the main window stopped taking clicks.
This commit is contained in:
@@ -50,6 +50,7 @@ public partial class TextureBaseWindow : Window
|
|||||||
modelList.SelectionChanged += (_, _) => Refresh();
|
modelList.SelectionChanged += (_, _) => Refresh();
|
||||||
|
|
||||||
textureList.ContextRequested += TextureList_OnContextRequested;
|
textureList.ContextRequested += TextureList_OnContextRequested;
|
||||||
|
textureList.AddHandler(PointerReleasedEvent, TextureList_OnPointerReleased, handledEventsToo: true);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,7 +134,16 @@ public partial class TextureBaseWindow : Window
|
|||||||
{
|
{
|
||||||
if (textureList.SelectedItem is not TextureRow row) return;
|
if (textureList.SelectedItem is not TextureRow row) return;
|
||||||
Picked = row.Texture;
|
Picked = row.Texture;
|
||||||
Close();
|
}
|
||||||
|
|
||||||
|
// DoubleTapped is raised from the second press, while the list still holds the
|
||||||
|
// pointer. Closing there leaves the capture on a dead window and on Windows the
|
||||||
|
// owner stops taking clicks. The release ends the gesture and drops the capture,
|
||||||
|
// so that is where the window goes.
|
||||||
|
private void TextureList_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
|
||||||
|
{
|
||||||
|
if (Picked != null)
|
||||||
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TextureList_OnContextRequested(object? sender, ContextRequestedEventArgs e)
|
private void TextureList_OnContextRequested(object? sender, ContextRequestedEventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user