Keep native merge depth windows by reframing unsafe endpoints

This commit is contained in:
NINI
2026-10-11 01:11:17 +09:00
parent bb32fdae9d
commit 71bf8fab57
2 changed files with 91 additions and 1 deletions
+11 -1
View File
@@ -25,14 +25,19 @@ function Orbit([string]$Name,$CurrentBoard,[switch]$Pitch,[int]$YawPixels=120,[i
throw 'No safe blank orbit start in the actual board view.'
}
function ZoomOut([int]$Stage,$CurrentBoard) {
$before=Save "stage-$Stage-zoom-out-before"
Check "stage-$Stage-current-pinch-projection" (Same $CurrentBoard (Board $before $Stage)) 'The pinch uses the exact current board and manual pose'
$helper=Join-Path $PSScriptRoot 'send-composition-touch.ps1'
foreach($contacts in @(@(30,400,999,1024),@(30,400,999,0),@(900,350,1,1024,1500,350,2,1024),@(1050,350,1,1024,1350,350,2,1024),@(1050,350,1,0,1350,350,2,0))){
& pwsh -NoProfile -Command "& '$helper' -Contacts $($contacts-join',')"
$code=$LASTEXITCODE;$commands.Add(@{command='native sendTouch pinch-out';contacts=$contacts;exitCode=$code;utc=[DateTime]::UtcNow.ToString('o')});if($code-ne0){throw 'Native pinch failed'};Start-Sleep -Milliseconds 120
}
Step "stage-$Stage-zoom-out" @() 300
$after=Board (Save "stage-$Stage-zoom-out-state") $Stage
$state=Save "stage-$Stage-zoom-out-state";$after=Board $state $Stage
Check "stage-$Stage-pinch-preserves-board" ((Same $CurrentBoard.balls $after.balls)-and(Same $CurrentBoard.groups $after.groups)-and(Same $CurrentBoard.countedBallIds $after.countedBallIds)-and$after.camera.distance-gt$CurrentBoard.camera.distance) 'Actual two-finger zoom-out; no ball, membership or count edits'
$expected=$state|ConvertTo-Json -Depth 20|ConvertFrom-Json
(Board $expected $Stage).camera=$CurrentBoard.camera
Check "stage-$Stage-pinch-preserves-whole-save" (Same $before $expected) 'Only this board manual camera may change; every independent record remains exact'
return $after
}
function RevealBall([int]$Stage,[string]$Id,[string]$Name) {
@@ -99,6 +104,11 @@ function MergeReal([int]$Stage,[string]$Name,[int]$SourceCount=0,[int]$TargetCou
$targetPoint=BallPoint $board $candidate.tid
if(WorldSafe @(($targetPoint[0]+$offset),$targetPoint[1])){$pair=$candidate;break}
}
if(!$pair-and$projection-eq0-and$board.camera.distance-lt15){
# Keep a visited contact depth plane when its endpoint is outside the UI-safe view.
$needsFrame=@($pairs|Where-Object {$point=BallPoint $board $_.tid;$_.depth-lt.9-and(BallClear $board $_.sid)-and!(WorldSafe @(($point[0]+$offset),$point[1]))}).Count-gt0
if($needsFrame){$board=ZoomOut $Stage $board;continue}
}
if($pair-or$attempt-ne0-or$projection-ne0){break}
$routed=LiftMergeRoute $Stage "$Name-upward-route" $board $SourceCount $TargetCount
if(!$routed){break}