diff --git a/AKPlugin.swift b/AKPlugin.swift index 23ad8f2f..cc08a418 100644 --- a/AKPlugin.swift +++ b/AKPlugin.swift @@ -46,6 +46,10 @@ class AKPlugin: NSObject, Plugin { warpCursor() } + func hideCursorMove() { + NSCursor.setHiddenUntilMouseMoves(true) + } + func warpCursor() { guard let firstScreen = NSScreen.screens.first else {return} let frame = windowFrame diff --git a/PlayTools/Controls/MenuController.swift b/PlayTools/Controls/MenuController.swift index 597bfa5f..1e970a9d 100644 --- a/PlayTools/Controls/MenuController.swift +++ b/PlayTools/Controls/MenuController.swift @@ -71,6 +71,10 @@ extension UIApplication { func toggleDebugOverlay(_ sender: AnyObject) { DebugController.instance.toggleDebugOverlay() } + + @objc func hideCursor(_ sender: AnyObject) { + AKInterface.shared!.hideCursorMove() + } } extension UIViewController { @@ -101,14 +105,17 @@ var keymapping = [ NSLocalizedString("menu.keymapping.rotateDisplay", tableName: "Playtools", value: "Rotate display area", comment: ""), NSLocalizedString("menu.keymapping.toggleDebug", tableName: "Playtools", - value: "Toggle Debug Overlay", comment: "") + value: "Toggle Debug Overlay", comment: ""), + NSLocalizedString("menu.keymapping.hide.pointer", tableName: "Playtools", + value: "Hide Mouse Pointer", comment: "") ] var keymappingSelectors = [#selector(UIApplication.switchEditorMode(_:)), #selector(UIApplication.removeElement(_:)), #selector(UIApplication.upscaleElement(_:)), #selector(UIApplication.downscaleElement(_:)), #selector(UIApplication.rotateView(_:)), - #selector(UIApplication.toggleDebugOverlay(_:)) + #selector(UIApplication.toggleDebugOverlay(_:)), + #selector(UIApplication.hideCursor(_:)) ] class MenuController { @@ -150,7 +157,7 @@ class MenuController { class func keymappingMenu() -> UIMenu { let keyCommands = [ "K", UIKeyCommand.inputDelete, - UIKeyCommand.inputUpArrow, UIKeyCommand.inputDownArrow, "R", "D"] + UIKeyCommand.inputUpArrow, UIKeyCommand.inputDownArrow, "R", "D", "."] let arrowKeyChildrenCommands = zip(keyCommands, keymapping).map { (command, btn) in UIKeyCommand(title: btn, image: nil, diff --git a/Plugin.swift b/Plugin.swift index 0949bd2d..6520c2eb 100644 --- a/Plugin.swift +++ b/Plugin.swift @@ -20,6 +20,7 @@ public protocol Plugin: NSObjectProtocol { var cmdPressed: Bool { get } func hideCursor() + func hideCursorMove() func warpCursor() func unhideCursor() func terminateApplication()