Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 44c7d2b415 | |||
| 84579bccce |
@@ -112,8 +112,9 @@ public final class Menu {
|
||||
|
||||
let presentationFrame = presentationWindow.convertToScreen(view.frame)
|
||||
let presentationPoint = presentationFrame.origin
|
||||
let additionalYOffset = configuration.appearsBelowSender ? 0 : NSHeight(view.frame)
|
||||
|
||||
let newFrame = NSRect(x: presentationPoint.x, y: presentationPoint.y - NSHeight(window.frame), width: NSWidth(view.frame), height: NSHeight(window.frame))
|
||||
let newFrame = NSRect(x: presentationPoint.x, y: presentationPoint.y - NSHeight(window.frame) + additionalYOffset, width: NSWidth(view.frame), height: NSHeight(window.frame))
|
||||
window.setFrame(newFrame, display: true, animate: false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ public enum Alignment {
|
||||
|
||||
public enum Padding {
|
||||
public struct Horizontal {
|
||||
let left: CGFloat
|
||||
let right: CGFloat
|
||||
public let left: CGFloat
|
||||
public let right: CGFloat
|
||||
}
|
||||
|
||||
public struct Vertical {
|
||||
let top: CGFloat
|
||||
let bottom: CGFloat
|
||||
public let top: CGFloat
|
||||
public let bottom: CGFloat
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ public protocol Configuration {
|
||||
var backgroundColor: NSColor { get }
|
||||
var cornerRadius: CGFloat { get }
|
||||
var hasShadow: Bool { get }
|
||||
var appearsBelowSender: Bool { get }
|
||||
var contentEdgeInsets: NSEdgeInsets { get }
|
||||
var separatorColor: NSColor { get }
|
||||
var separatorThickness: CGFloat { get }
|
||||
@@ -87,6 +88,10 @@ open class MenuConfiguration: Configuration {
|
||||
return true
|
||||
}
|
||||
|
||||
open var appearsBelowSender: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
open var contentEdgeInsets: NSEdgeInsets {
|
||||
return NSEdgeInsets(top: .grid2, left: .grid2, bottom: .grid2, right: .grid2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user