fix: 修复滑动选择方向错位与边界/圆环外不命中(物理像素换算 + 按方向就近命中)
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
$ErrorActionPreference = 'Continue'
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$screens = [System.Windows.Forms.Screen]::AllScreens
|
||||
foreach ($s in $screens) {
|
||||
Write-Output ("Screen: Bounds={0} Primary={1} WorkingArea={2}" -f $s.Bounds, $s.Primary, $s.WorkingArea)
|
||||
}
|
||||
Write-Output ("PrimaryCenterPx: {0}" -f ([System.Windows.Forms.Screen]::PrimaryScreen.Bounds | ForEach-Object { '{0},{1}' -f ($_.X + $_.Width/2), ($_.Y + $_.Height/2) }))
|
||||
$dpi = Get-ItemProperty 'HKCU:Control PanelDesktopWindowMetrics' -Name AppliedDPI -ErrorAction SilentlyContinue
|
||||
Write-Output ("AppliedDPI(reg): {0} -> {1}%" -f $dpi.AppliedDPI, ($dpi.AppliedDPI / 96 * 100))
|
||||
@@ -0,0 +1,35 @@
|
||||
# 滑动选择探针:对若干物理坐标输出 实际命中 vs 地面真值
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$exe = 'E:\002_Demo\One_click_run_wpf\src\OneClickRun\bin\Debug\net8.0-windows\OneClickRun.exe'
|
||||
$logFile = Join-Path $env:APPDATA ('OneClickRun\logs\app-{0}.log' -f (Get-Date -Format 'yyyyMMdd'))
|
||||
|
||||
# 清理本路径残留实例
|
||||
Get-Process -Name 'OneClickRun' -ErrorAction SilentlyContinue |
|
||||
Where-Object { $_.Path -eq $exe } |
|
||||
ForEach-Object { Stop-Process -Id $_.Id -Force }
|
||||
|
||||
$points = @(
|
||||
'1024,576', # 轮盘中心(枢纽,应无方向)
|
||||
'1174,576', # 右,环内
|
||||
'1024,426', # 上,环内
|
||||
'874,576', # 左,环内
|
||||
'1024,726', # 下,环内
|
||||
'1424,576', # 右,环外
|
||||
'1024,176', # 上,环外
|
||||
'1244,796', # 右下,环外
|
||||
'624,576', # 左,环外
|
||||
'824,776', # 左下,环外
|
||||
'-500,900', # 副屏(左侧显示器,100%)
|
||||
'-960,1153', # 副屏中心
|
||||
'0,613' # 副屏右边缘
|
||||
)
|
||||
|
||||
foreach ($pt in $points) {
|
||||
$p = Start-Process -FilePath $exe -ArgumentList @('--probe', $pt) -PassThru
|
||||
if (-not $p.WaitForExit(15000)) { Stop-Process -Id $p.Id -Force; Write-Output "$pt => 超时"; continue }
|
||||
if (-not (Test-Path $logFile)) { Write-Output "$pt => 无日志文件 $logFile"; continue }
|
||||
$lines = Get-Content $logFile
|
||||
$probeLine = $lines | Where-Object { $_ -like '*Probe: *' } | Select-Object -Last 1
|
||||
if ($probeLine) { Write-Output $probeLine } else { Write-Output "$pt => 无 Probe 行" }
|
||||
Start-Sleep -Milliseconds 300
|
||||
}
|
||||
Reference in New Issue
Block a user