mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
fix: 勾选手动输入关卡名时无法拖动候选关卡
This commit is contained in:
@@ -68,6 +68,11 @@ public class FightSettingsUserControlModel : TaskSettingsViewModel, FightSetting
|
||||
|
||||
public static FightSettingsUserControlModel Instance { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether a stage plan item is being dragged.
|
||||
/// </summary>
|
||||
public bool IsDragging { get => field; set => SetAndNotify(ref field, value); }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or private sets the list of stages.
|
||||
/// </summary>
|
||||
|
||||
@@ -310,6 +310,8 @@
|
||||
<TextBox
|
||||
Height="30"
|
||||
hc:InfoElement.Placeholder="{DynamicResource DefaultStage}"
|
||||
IsEnabled="{c:Binding !IsDragging,
|
||||
Source={x:Static ui_vms:TaskQueueViewModel.FightTask}}"
|
||||
Opacity="{c:Binding 'IsOpen ? 1 : 0.5'}"
|
||||
Text="{Binding Stage, UpdateSourceTrigger=PropertyChanged}"
|
||||
ToolTip="{DynamicResource CustomStageCodeTip}"
|
||||
@@ -348,7 +350,9 @@
|
||||
hc:VisualElement.HighlightBackground="Transparent"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Cursor="Hand" />
|
||||
Cursor="Hand"
|
||||
PreviewMouseLeftButtonDown="DragHandle_PreviewMouseLeftButtonDown"
|
||||
PreviewMouseLeftButtonUp="DragHandle_PreviewMouseLeftButtonUp" />
|
||||
<!-- 删除按钮 -->
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
// but WITHOUT ANY WARRANTY
|
||||
// </copyright>
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using MaaWpfGui.ViewModels.UI;
|
||||
|
||||
namespace MaaWpfGui.Views.UserControl.TaskQueue;
|
||||
|
||||
/// <summary>
|
||||
@@ -25,4 +29,27 @@ public partial class FightSettingsUserControl : System.Windows.Controls.UserCont
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void DragHandle_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TaskQueueViewModel.FightTask.IsDragging = true;
|
||||
|
||||
// 拖拽松开时可能不经过 Button,在 Window 层兜底恢复
|
||||
var window = Window.GetWindow(this);
|
||||
window?.PreviewMouseLeftButtonUp += Window_PreviewMouseLeftButtonUp;
|
||||
}
|
||||
|
||||
private void DragHandle_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TaskQueueViewModel.FightTask.IsDragging = false;
|
||||
}
|
||||
|
||||
private void Window_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
TaskQueueViewModel.FightTask.IsDragging = false;
|
||||
if (sender is Window window)
|
||||
{
|
||||
window.PreviewMouseLeftButtonUp -= Window_PreviewMouseLeftButtonUp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user