@@ -8,7 +8,12 @@ enum UpdateLocationStrategy {
8
8
mainScreen: NSScreen ,
9
9
activeScreen: NSScreen ,
10
10
editor: AXUIElement
11
- ) -> ( widgetFrame: CGRect , panelFrame: CGRect , alignPanelTopToAnchor: Bool ) {
11
+ ) -> (
12
+ widgetFrame: CGRect ,
13
+ panelFrame: CGRect ,
14
+ tabFrame: CGRect ,
15
+ alignPanelTopToAnchor: Bool
16
+ ) {
12
17
guard let selectedRange: AXValue = try ? editor
13
18
. copyValue ( key: kAXSelectedTextRangeAttribute) ,
14
19
let rect: AXValue = try ? editor. copyParameterizedValue (
@@ -46,7 +51,12 @@ enum UpdateLocationStrategy {
46
51
editorFrame: CGRect ,
47
52
mainScreen: NSScreen ,
48
53
activeScreen: NSScreen
49
- ) -> ( widgetFrame: CGRect , panelFrame: CGRect , alignPanelTopToAnchor: Bool ) {
54
+ ) -> (
55
+ widgetFrame: CGRect ,
56
+ panelFrame: CGRect ,
57
+ tabFrame: CGRect ,
58
+ alignPanelTopToAnchor: Bool
59
+ ) {
50
60
return HorizontalMovable ( ) . framesForWindows (
51
61
y: activeScreen. frame. height - editorFrame. maxY + Style. widgetPadding,
52
62
alignPanelTopToAnchor: false ,
@@ -64,7 +74,12 @@ enum UpdateLocationStrategy {
64
74
editorFrame: CGRect ,
65
75
mainScreen: NSScreen ,
66
76
activeScreen: NSScreen
67
- ) -> ( widgetFrame: CGRect , panelFrame: CGRect , alignPanelTopToAnchor: Bool ) {
77
+ ) -> (
78
+ widgetFrame: CGRect ,
79
+ panelFrame: CGRect ,
80
+ tabFrame: CGRect ,
81
+ alignPanelTopToAnchor: Bool
82
+ ) {
68
83
let maxY = max (
69
84
y,
70
85
activeScreen. frame. height - editorFrame. maxY + Style. widgetPadding,
@@ -98,7 +113,16 @@ enum UpdateLocationStrategy {
98
113
width: Style . panelWidth,
99
114
height: Style . panelHeight
100
115
)
101
- return ( anchorFrame, panelFrame, alignPanelTopToAnchor)
116
+ let tabFrame = CGRect (
117
+ x: anchorFrame. origin. x,
118
+ y: alignPanelTopToAnchor
119
+ ? anchorFrame. minY - Style. widgetHeight - Style. widgetPadding
120
+ : anchorFrame. maxY + Style. widgetPadding,
121
+ width: Style . widgetWidth,
122
+ height: Style . widgetHeight
123
+ )
124
+
125
+ return ( anchorFrame, panelFrame, tabFrame, alignPanelTopToAnchor)
102
126
} else {
103
127
let proposedAnchorFrameOnTheLeftSide = CGRect (
104
128
x: editorFrame. minX + Style. widgetPadding,
@@ -120,7 +144,15 @@ enum UpdateLocationStrategy {
120
144
width: Style . panelWidth,
121
145
height: Style . panelHeight
122
146
)
123
- return ( anchorFrame, panelFrame, alignPanelTopToAnchor)
147
+ let tabFrame = CGRect (
148
+ x: anchorFrame. origin. x,
149
+ y: alignPanelTopToAnchor
150
+ ? anchorFrame. minY - Style. widgetHeight - Style. widgetPadding
151
+ : anchorFrame. maxY + Style. widgetPadding,
152
+ width: Style . widgetWidth,
153
+ height: Style . widgetHeight
154
+ )
155
+ return ( anchorFrame, panelFrame, tabFrame, alignPanelTopToAnchor)
124
156
} else {
125
157
let anchorFrame = proposedAnchorFrameOnTheRightSide
126
158
let panelFrame = CGRect (
@@ -131,7 +163,15 @@ enum UpdateLocationStrategy {
131
163
width: Style . panelWidth,
132
164
height: Style . panelHeight
133
165
)
134
- return ( anchorFrame, panelFrame, alignPanelTopToAnchor)
166
+ let tabFrame = CGRect (
167
+ x: anchorFrame. origin. x,
168
+ y: alignPanelTopToAnchor
169
+ ? anchorFrame. minY - Style. widgetHeight - Style. widgetPadding
170
+ : anchorFrame. maxY + Style. widgetPadding,
171
+ width: Style . widgetWidth,
172
+ height: Style . widgetHeight
173
+ )
174
+ return ( anchorFrame, panelFrame, tabFrame, alignPanelTopToAnchor)
135
175
}
136
176
}
137
177
}
0 commit comments