fix: wrap thumbnail buttons when needed
This commit is contained in:
1 parent
d207f86daa
commit
ea05c0327b
1 file changed
+9
-4
@@ -74,16 +74,21 @@ class ThumbnailView: NSStackView {
|
|||||||
isShowingWindowControls = shouldShow
|
isShowingWindowControls = shouldShow
|
||||||
let target = (window_?.isWindowlessApp ?? true) ? windowlessIcon : thumbnail
|
let target = (window_?.isWindowlessApp ?? true) ? windowlessIcon : thumbnail
|
||||||
target.addSubview(quitIcon, positioned: .above, relativeTo: nil)
|
target.addSubview(quitIcon, positioned: .above, relativeTo: nil)
|
||||||
var offset = CGFloat(0)
|
var xOffset = CGFloat(3)
|
||||||
|
var yOffset = CGFloat(2 + ThumbnailView.windowsControlSize)
|
||||||
[quitIcon, closeIcon, minimizeIcon, maximizeIcon].forEach { icon in
|
[quitIcon, closeIcon, minimizeIcon, maximizeIcon].forEach { icon in
|
||||||
icon.isHidden = !shouldShow ||
|
icon.isHidden = !shouldShow ||
|
||||||
((window_?.isWindowlessApp ?? true) && icon.type != .quit) ||
|
((window_?.isWindowlessApp ?? true) && icon.type != .quit) ||
|
||||||
(icon.type == .quit && window_?.application.runningApplication.bundleIdentifier == "com.apple.finder" && !Preferences.finderShowsQuitMenuItem)
|
(icon.type == .quit && window_?.application.runningApplication.bundleIdentifier == "com.apple.finder" && !Preferences.finderShowsQuitMenuItem)
|
||||||
if !icon.isHidden {
|
if !icon.isHidden {
|
||||||
icon.setFrameOrigin(NSPoint(
|
icon.setFrameOrigin(NSPoint(
|
||||||
x: 3 + (ThumbnailView.windowsControlSpacing + ThumbnailView.windowsControlSize) * offset,
|
x: xOffset,
|
||||||
y: target.frame.height - ThumbnailView.windowsControlSize - 2))
|
y: target.frame.height - yOffset))
|
||||||
offset += 1
|
xOffset += ThumbnailView.windowsControlSize + ThumbnailView.windowsControlSpacing
|
||||||
|
if xOffset + ThumbnailView.windowsControlSize > target.frame.width {
|
||||||
|
xOffset = 3
|
||||||
|
yOffset += ThumbnailView.windowsControlSize + ThumbnailView.windowsControlSpacing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user