From 525de3e6236c887f9b9c2b6cb7b68708eb3d0ba7 Mon Sep 17 00:00:00 2001 From: Max Goodhart Date: Fri, 4 Jul 2025 19:45:49 -0700 Subject: [PATCH] Fix overlay under content view when existing view repositioned --- packages/streamwall/src/main/viewStateMachine.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/streamwall/src/main/viewStateMachine.ts b/packages/streamwall/src/main/viewStateMachine.ts index 3504ae8..0220db9 100644 --- a/packages/streamwall/src/main/viewStateMachine.ts +++ b/packages/streamwall/src/main/viewStateMachine.ts @@ -100,7 +100,16 @@ const viewStateMachine = setup({ } offscreenWin.contentView.removeChildView(view) - win.contentView.addChildView(view, win.contentView.children.length - 1) // Insert below overlay but above background + + const existingIdx = win.contentView.children.indexOf(view) + win.contentView.addChildView( + view, + existingIdx !== -1 + ? existingIdx + : // Insert below the overlay (end of the current list because once added, the overlay's index will increase by 1) + win.contentView.children.length - 1, + ) + view.setBounds(pos) }, },