Implements zoom in/out keyboard shortcuts
This commit is contained in:
@@ -144,6 +144,10 @@ extension BrowserViewController: ShortcutResponder
|
||||
webView.reload()
|
||||
}
|
||||
|
||||
func stop(_ sender: Any?) {
|
||||
webView.stopLoading()
|
||||
}
|
||||
|
||||
override func increaseSize(_ sender: Any?) {
|
||||
currentTab.webView._viewScale += 0.10
|
||||
}
|
||||
@@ -151,6 +155,10 @@ extension BrowserViewController: ShortcutResponder
|
||||
override func decreaseSize(_ sender: Any?) {
|
||||
currentTab.webView._viewScale -= 0.10
|
||||
}
|
||||
|
||||
func zoomToActualSize(_ sender: Any?) {
|
||||
currentTab.webView._viewScale = 1.0
|
||||
}
|
||||
|
||||
func showPreferences(_ sender: Any?) {
|
||||
showSettingsWindow()
|
||||
|
||||
@@ -63,6 +63,9 @@ protocol ShortcutResponder: AnyObject {
|
||||
|
||||
@objc
|
||||
optional func raiseScriptPolicyRestriction(_ sender: Any?)
|
||||
|
||||
@objc
|
||||
optional func zoomToActualSize(_ sender: Any?)
|
||||
}
|
||||
|
||||
public class OpenURLEvent: UIEvent {
|
||||
@@ -224,6 +227,30 @@ public class KeyboardShortcuts {
|
||||
|
||||
case .view:
|
||||
return [
|
||||
// Zoom
|
||||
UIMenu(options: .displayInline, children: [
|
||||
// Actual Size
|
||||
UIKeyCommand(
|
||||
modifiers: .command, input: "0",
|
||||
title: "Actual Size",
|
||||
action: #selector(ShortcutResponder.zoomToActualSize)
|
||||
),
|
||||
|
||||
// Increase Zoom
|
||||
UIKeyCommand(
|
||||
modifiers: .command, input: "=",
|
||||
title: "Zoom In",
|
||||
action: #selector(UIResponder.increaseSize)
|
||||
),
|
||||
|
||||
// Go Forward
|
||||
UIKeyCommand(
|
||||
modifiers: .command, input: "-",
|
||||
title: "Zoom Out",
|
||||
action: #selector(UIResponder.decreaseSize)
|
||||
),
|
||||
]),
|
||||
|
||||
// Toggle Dark Mode
|
||||
UIKeyCommand(
|
||||
modifiers: [.command], input: "M",
|
||||
|
||||
Reference in New Issue
Block a user