3 Commits

Author SHA1 Message Date
Ivan Sapozhnik 994681e321 Access level 2020-04-14 23:26:11 +02:00
Ivan Sapozhnik 44c7d2b415 Configurartion 2020-04-14 23:23:44 +02:00
Ivan Sapozhnik 84579bccce Access level 2020-04-14 23:18:42 +02:00
2 changed files with 17 additions and 1 deletions
+2 -1
View File
@@ -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)
}
}
+15
View File
@@ -16,11 +16,21 @@ public enum Padding {
public struct Horizontal {
let left: CGFloat
let right: CGFloat
public init(left: CGFloat, right: CGFloat) {
self.left = left
self.right = right
}
}
public struct Vertical {
let top: CGFloat
let bottom: CGFloat
public init(top: CGFloat, bottom: CGFloat) {
self.top = top
self.bottom = bottom
}
}
}
@@ -42,6 +52,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 +98,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)
}