@@ -15,7 +15,7 @@ public extension EnvironmentValues {
1515 get { self [ OverlayFrameEnvironmentKey . self] }
1616 set { self [ OverlayFrameEnvironmentKey . self] = newValue }
1717 }
18-
18+
1919 var overlayDebug : Bool {
2020 get { self [ OverlayDebugEnvironmentKey . self] }
2121 set { self [ OverlayDebugEnvironmentKey . self] = newValue }
@@ -104,32 +104,31 @@ final class OverlayPanel: NSPanel {
104104 struct ContentWrapper < Content: View > : View {
105105 let panelState : PanelState
106106 @ViewBuilder let content : ( ) -> Content
107- @State var showOverlayArea : Bool = false
107+ @State var showOverlayArea : Bool = true
108108
109109 var body : some View {
110110 WithPerceptionTracking {
111- content ( )
112- . environment ( \. overlayFrame, panelState. windowFrame)
113- . environment ( \. overlayDebug, showOverlayArea)
114- #if DEBUG
115- . background {
116- if showOverlayArea {
117- Rectangle ( ) . fill ( . green. opacity ( 0.1 ) ) . allowsHitTesting ( false )
118- }
119- }
120- . overlay ( alignment: . topTrailing) {
121- HStack {
122- Button ( action: {
123- showOverlayArea. toggle ( )
124- } ) {
125- Image ( systemName: " eye " )
126- . foregroundColor ( showOverlayArea ? . green : . red)
127- . padding ( )
111+ ZStack {
112+ #if DEBUG
113+ Rectangle ( ) . fill ( . green. opacity ( showOverlayArea ? 0.1 : 0 ) )
114+ . allowsHitTesting ( false )
115+ . overlay ( alignment: . topTrailing) {
116+ HStack {
117+ Button ( action: {
118+ showOverlayArea. toggle ( )
119+ } ) {
120+ Image ( systemName: " eye " )
121+ . foregroundColor ( showOverlayArea ? . green : . red)
122+ . padding ( )
123+ }
124+ . buttonStyle ( . plain)
128125 }
129- . buttonStyle ( . plain)
130126 }
131- }
132- #endif
127+ #endif
128+ content ( )
129+ . environment ( \. overlayFrame, panelState. windowFrame)
130+ . environment ( \. overlayDebug, showOverlayArea)
131+ }
133132 }
134133 }
135134 }
0 commit comments