Implements zoom in/out keyboard shortcuts
This commit is contained in:
@@ -144,6 +144,10 @@ extension BrowserViewController: ShortcutResponder
|
|||||||
webView.reload()
|
webView.reload()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func stop(_ sender: Any?) {
|
||||||
|
webView.stopLoading()
|
||||||
|
}
|
||||||
|
|
||||||
override func increaseSize(_ sender: Any?) {
|
override func increaseSize(_ sender: Any?) {
|
||||||
currentTab.webView._viewScale += 0.10
|
currentTab.webView._viewScale += 0.10
|
||||||
}
|
}
|
||||||
@@ -151,6 +155,10 @@ extension BrowserViewController: ShortcutResponder
|
|||||||
override func decreaseSize(_ sender: Any?) {
|
override func decreaseSize(_ sender: Any?) {
|
||||||
currentTab.webView._viewScale -= 0.10
|
currentTab.webView._viewScale -= 0.10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func zoomToActualSize(_ sender: Any?) {
|
||||||
|
currentTab.webView._viewScale = 1.0
|
||||||
|
}
|
||||||
|
|
||||||
func showPreferences(_ sender: Any?) {
|
func showPreferences(_ sender: Any?) {
|
||||||
showSettingsWindow()
|
showSettingsWindow()
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ protocol ShortcutResponder: AnyObject {
|
|||||||
|
|
||||||
@objc
|
@objc
|
||||||
optional func raiseScriptPolicyRestriction(_ sender: Any?)
|
optional func raiseScriptPolicyRestriction(_ sender: Any?)
|
||||||
|
|
||||||
|
@objc
|
||||||
|
optional func zoomToActualSize(_ sender: Any?)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OpenURLEvent: UIEvent {
|
public class OpenURLEvent: UIEvent {
|
||||||
@@ -224,6 +227,30 @@ public class KeyboardShortcuts {
|
|||||||
|
|
||||||
case .view:
|
case .view:
|
||||||
return [
|
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
|
// Toggle Dark Mode
|
||||||
UIKeyCommand(
|
UIKeyCommand(
|
||||||
modifiers: [.command], input: "M",
|
modifiers: [.command], input: "M",
|
||||||
|
|||||||
Reference in New Issue
Block a user