Compare commits

...

6 Commits

Author SHA1 Message Date
Duraid Abdul c004ca0c2c Update LCManager.swift 2021-05-12 00:59:52 -07:00
Duraid Abdul da55c724e4 Update LCManager.swift 2021-05-12 00:35:34 -07:00
Duraid Abdul 9487460c56 Update LCManager.swift 2021-05-12 00:32:41 -07:00
Duraid Abdul 3b0d66211e Update LCManager.swift 2021-05-12 00:17:28 -07:00
Duraid Abdul b6e987d1d5 Merge branch 'main' of https://github.com/duraidabdul/LocalConsole into main 2021-05-11 23:54:14 -07:00
Duraid Abdul 95297acf18 Update LCManager.swift 2021-05-11 23:54:10 -07:00
+30 -17
View File
@@ -56,7 +56,7 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
if let windowScene = windowScene as? UIWindowScene {
consoleWindow = ConsoleWindow(windowScene: windowScene)
consoleWindow?.frame = UIScreen.main.bounds
consoleWindow?.windowLevel = UIWindow.Level.normal
consoleWindow?.windowLevel = UIWindow.Level.statusBar
consoleWindow?.isHidden = false
consoleWindow?.addSubview(consoleView)
@@ -73,12 +73,19 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
consoleView.center = possibleEndpoints.first!
consoleView.alpha = 0
consoleView.layer.borderWidth = 1
consoleView.layer.borderColor = UIColor(white: 1, alpha: 0.08).cgColor
consoleView.layer.cornerRadius = 19
consoleView.layer.cornerRadius = 20
consoleView.layer.cornerCurve = .continuous
let borderLayer = CALayer()
borderLayer.frame = CGRect(x: -1, y: -1,
width: consoleSize.width + 2,
height: consoleSize.height + 2)
borderLayer.borderWidth = 1
borderLayer.borderColor = UIColor(white: 1, alpha: 0.08).cgColor
borderLayer.cornerRadius = consoleView.layer.cornerRadius + 1
borderLayer.cornerCurve = .continuous
consoleView.layer.addSublayer(borderLayer)
// Configure text view.
consoleTextView.frame = CGRect(x: 0, y: 2, width: consoleSize.width, height: consoleSize.height - 4)
consoleTextView.isEditable = false
@@ -106,18 +113,28 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
consoleView.addGestureRecognizer(longPressRecognizer)
// Prepare menu button.
let diameter = CGFloat(25)
let diameter = CGFloat(26)
menuButton = UIButton(frame: CGRect(x: consoleView.bounds.width - diameter - (consoleView.layer.cornerRadius - diameter / 2),
y: consoleView.bounds.height - diameter - (consoleView.layer.cornerRadius - diameter / 2),
width: diameter, height: diameter))
menuButton.layer.cornerRadius = diameter / 2
menuButton.backgroundColor = UIColor(white: 1, alpha: 0.20)
// This tuned button frame is used to adjust where the menu appears.
menuButton = UIButton(frame: CGRect(x: consoleView.bounds.width - 44,
y: consoleView.bounds.height - 36,
width: 44,
height: 36 + 4 /*Offests the context menu by the desired amount*/))
let circleFrame = CGRect(
x: menuButton.bounds.width - diameter - (consoleView.layer.cornerRadius - diameter / 2),
y: menuButton.bounds.height - diameter - (consoleView.layer.cornerRadius - diameter / 2) - 4,
width: diameter, height: diameter)
let circle = UIView(frame: circleFrame)
circle.backgroundColor = UIColor(white: 0.2, alpha: 0.95)
circle.layer.cornerRadius = diameter / 2
menuButton.addSubview(circle)
let ellipsisImage = UIImageView(image: UIImage(systemName: "ellipsis", withConfiguration: UIImage.SymbolConfiguration(pointSize: 16)))
ellipsisImage.frame.size = menuButton!.bounds.size
ellipsisImage.frame.size = circle.bounds.size
ellipsisImage.contentMode = .center
menuButton.addSubview(ellipsisImage)
circle.addSubview(ellipsisImage)
menuButton.tintColor = UIColor(white: 1, alpha: 0.75)
menuButton.menu = makeMenu()
@@ -125,10 +142,6 @@ public class LCManager: NSObject, UIGestureRecognizerDelegate {
consoleView.addSubview(menuButton!)
UIView.swizzleDebugBehaviour
print(consoleView)
print(menuButton)
print("Hello, world!")
}
public var isVisible = false {