mirror of
https://github.com/lantean-code/qbtmud.git
synced 2025-10-23 04:52:22 +00:00
Fix longpress issue
This commit is contained in:
@@ -10,11 +10,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AwesomeAssertions" Version="9.0.0" />
|
<PackageReference Include="AwesomeAssertions" Version="9.2.1" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
|
||||||
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.0">
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
@@ -186,7 +186,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ContextMenu.OpenMenuAsync(eventArgs);
|
var normalizedEventArgs = eventArgs.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
await ContextMenu.OpenMenuAsync(normalizedEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
using Blazored.LocalStorage;
|
using Blazored.LocalStorage;
|
||||||
using Lantean.QBitTorrentClient;
|
using Lantean.QBitTorrentClient;
|
||||||
using Lantean.QBTMud.Components.UI;
|
|
||||||
using Lantean.QBTMud.Helpers;
|
using Lantean.QBTMud.Helpers;
|
||||||
using Lantean.QBTMud.Models;
|
using Lantean.QBTMud.Models;
|
||||||
using Microsoft.AspNetCore.Components;
|
using Microsoft.AspNetCore.Components;
|
||||||
@@ -154,7 +153,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
|
|
||||||
ContextMenuStatus = value;
|
ContextMenuStatus = value;
|
||||||
|
|
||||||
return StatusContextMenu.OpenMenuAsync(args);
|
var normalizedArgs = args.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
return StatusContextMenu.OpenMenuAsync(normalizedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task CategoryValueChanged(string value)
|
protected async Task CategoryValueChanged(string value)
|
||||||
@@ -192,7 +193,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
IsCategoryTarget = value != FilterHelper.CATEGORY_ALL && value != FilterHelper.CATEGORY_UNCATEGORIZED;
|
IsCategoryTarget = value != FilterHelper.CATEGORY_ALL && value != FilterHelper.CATEGORY_UNCATEGORIZED;
|
||||||
ContextMenuCategory = value;
|
ContextMenuCategory = value;
|
||||||
|
|
||||||
return CategoryContextMenu.OpenMenuAsync(args);
|
var normalizedArgs = args.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
return CategoryContextMenu.OpenMenuAsync(normalizedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task TagValueChanged(string value)
|
protected async Task TagValueChanged(string value)
|
||||||
@@ -230,7 +233,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
IsTagTarget = value != FilterHelper.TAG_ALL && value != FilterHelper.TAG_UNTAGGED;
|
IsTagTarget = value != FilterHelper.TAG_ALL && value != FilterHelper.TAG_UNTAGGED;
|
||||||
ContextMenuTag = value;
|
ContextMenuTag = value;
|
||||||
|
|
||||||
return TagContextMenu.OpenMenuAsync(args);
|
var normalizedArgs = args.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
return TagContextMenu.OpenMenuAsync(normalizedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task TrackerValueChanged(string value)
|
protected async Task TrackerValueChanged(string value)
|
||||||
@@ -267,7 +272,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
|
|
||||||
ContextMenuTracker = value;
|
ContextMenuTracker = value;
|
||||||
|
|
||||||
return TrackerContextMenu.OpenMenuAsync(args);
|
var normalizedArgs = args.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
return TrackerContextMenu.OpenMenuAsync(normalizedArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async Task AddCategory()
|
protected async Task AddCategory()
|
||||||
|
@@ -153,7 +153,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ContextMenu.OpenMenuAsync(eventArgs);
|
var normalizedEventArgs = eventArgs.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
await ContextMenu.OpenMenuAsync(normalizedEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SelectedItemChanged(Peer peer)
|
protected void SelectedItemChanged(Peer peer)
|
||||||
|
@@ -148,7 +148,9 @@ namespace Lantean.QBTMud.Components
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ContextMenu.OpenMenuAsync(eventArgs);
|
var normalizedEventArgs = eventArgs.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
await ContextMenu.OpenMenuAsync(normalizedEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SelectedItemChanged(TorrentTracker torrentTracker)
|
protected void SelectedItemChanged(TorrentTracker torrentTracker)
|
||||||
|
47
Lantean.QBTMud/Helpers/EventArgsExtensions.cs
Normal file
47
Lantean.QBTMud/Helpers/EventArgsExtensions.cs
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using Lantean.QBTMud;
|
||||||
|
using Microsoft.AspNetCore.Components.Web;
|
||||||
|
|
||||||
|
namespace Lantean.QBTMud.Helpers
|
||||||
|
{
|
||||||
|
public static class EventArgsExtensions
|
||||||
|
{
|
||||||
|
public static EventArgs NormalizeForContextMenu(this EventArgs eventArgs)
|
||||||
|
{
|
||||||
|
if (eventArgs is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(eventArgs));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eventArgs is LongPressEventArgs longPressEventArgs)
|
||||||
|
{
|
||||||
|
return longPressEventArgs.ToMouseEventArgs();
|
||||||
|
}
|
||||||
|
|
||||||
|
return eventArgs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MouseEventArgs ToMouseEventArgs(this LongPressEventArgs longPressEventArgs)
|
||||||
|
{
|
||||||
|
if (longPressEventArgs is null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(longPressEventArgs));
|
||||||
|
}
|
||||||
|
|
||||||
|
return new MouseEventArgs
|
||||||
|
{
|
||||||
|
Button = 2,
|
||||||
|
Buttons = 2,
|
||||||
|
ClientX = longPressEventArgs.ClientX,
|
||||||
|
ClientY = longPressEventArgs.ClientY,
|
||||||
|
OffsetX = longPressEventArgs.OffsetX,
|
||||||
|
OffsetY = longPressEventArgs.OffsetY,
|
||||||
|
PageX = longPressEventArgs.PageX,
|
||||||
|
PageY = longPressEventArgs.PageY,
|
||||||
|
ScreenX = longPressEventArgs.ScreenX,
|
||||||
|
ScreenY = longPressEventArgs.ScreenY,
|
||||||
|
Type = longPressEventArgs.Type ?? "contextmenu",
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
using Lantean.QBitTorrentClient;
|
using Lantean.QBitTorrentClient;
|
||||||
using Lantean.QBTMud.Components.UI;
|
using Lantean.QBTMud.Components.UI;
|
||||||
using Lantean.QBTMud.Helpers;
|
using Lantean.QBTMud.Helpers;
|
||||||
using Lantean.QBTMud.Models;
|
using Lantean.QBTMud.Models;
|
||||||
@@ -272,7 +272,9 @@ namespace Lantean.QBTMud.Pages
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ContextMenu.OpenMenuAsync(eventArgs);
|
var normalizedEventArgs = eventArgs.NormalizeForContextMenu();
|
||||||
|
|
||||||
|
await ContextMenu.OpenMenuAsync(normalizedEventArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<ColumnDefinition<Torrent>> Columns => ColumnsDefinitions.Where(c => c.Id != "#" || Preferences?.QueueingEnabled == true);
|
protected IEnumerable<ColumnDefinition<Torrent>> Columns => ColumnsDefinitions.Where(c => c.Id != "#" || Preferences?.QueueingEnabled == true);
|
||||||
|
Reference in New Issue
Block a user