Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/TinyHand/OverlayController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ final class OverlayController {
let near = f.insetBy(dx: -80, dy: 0).union(f.offsetBy(dx: 0, dy: 90)).insetBy(dx: 0, dy: -10).contains(mouse)
let needsPermission = !inputTap.isInstalled
let drawing = armView.ink.isDrawing
toolbar.setRevealed(!drawing && (near || Date() < revealUntil || needsPermission))
toolbar.setRevealed(needsPermission || (Preferences.showToolbar && !drawing && (near || Date() < revealUntil)))

let menuLikely = !menuRects.isEmpty || ownMenuOpen || Date() < menuOpeningUntil
|| Date().timeIntervalSince(lastButtonEvent) < 2
Expand Down
7 changes: 6 additions & 1 deletion Sources/TinyHand/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ enum Preferences {
set { set(newValue.rawValue, "inkChoice") }
}

static var showToolbar: Bool {
get { defaults.object(forKey: "showToolbar") as? Bool ?? true }
set { set(newValue, "showToolbar") }
}

static var showInkButton: Bool {
get { defaults.object(forKey: "showInkButton") as? Bool ?? true }
set { set(newValue, "showInkButton") }
Expand Down Expand Up @@ -177,7 +182,7 @@ enum Preferences {
static func resetAll() {
for key in ["shortcut.toggle", "shortcut.clear", "pointerSize", "showShadow", "fadeSeconds",
"sound.hands", "sound.laser", "interactKey", "interactKeepsHand", "pinnedStyles", "pointerStyle",
"inkChoice", "showInkButton", "tapSound"] {
"inkChoice", "showInkButton", "showToolbar", "tapSound"] {
defaults.removeObject(forKey: key)
}
NotificationCenter.default.post(name: changed, object: nil)
Expand Down
32 changes: 20 additions & 12 deletions Sources/TinyHand/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -932,20 +932,28 @@ private struct AppearancePage: View {
@ObservedObject var model: SettingsModel

var body: some View {
Card(title: "Pointer") {
Row("Size") {
HStack(spacing: 10) {
Image(systemName: "hand.point.up.left.fill").font(.system(size: 10)).foregroundColor(.secondary)
Slider(value: model.binding({ Double(Preferences.pointerSize) }, { Preferences.pointerSize = CGFloat($0) }),
in: Double(Preferences.pointerSizeRange.lowerBound)...Double(Preferences.pointerSizeRange.upperBound))
.frame(width: 180)
.focusable(false)
Image(systemName: "hand.point.up.left.fill").font(.system(size: 16)).foregroundColor(.secondary)
VStack(alignment: .leading, spacing: 22) {
Card(title: "Pointer") {
Row("Size") {
HStack(spacing: 10) {
Image(systemName: "hand.point.up.left.fill").font(.system(size: 10)).foregroundColor(.secondary)
Slider(value: model.binding({ Double(Preferences.pointerSize) }, { Preferences.pointerSize = CGFloat($0) }),
in: Double(Preferences.pointerSizeRange.lowerBound)...Double(Preferences.pointerSizeRange.upperBound))
.frame(width: 180)
.focusable(false)
Image(systemName: "hand.point.up.left.fill").font(.system(size: 16)).foregroundColor(.secondary)
}
}
Row("Shadow under the pointer") {
Toggle("", isOn: model.binding({ Preferences.showShadow }, { Preferences.showShadow = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
}
}
Row("Shadow under the pointer") {
Toggle("", isOn: model.binding({ Preferences.showShadow }, { Preferences.showShadow = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
Card(title: "Toolbar") {
Row("Show the toolbar", detail: Preferences.showToolbar ? "Appears when the pointer turns on and when you move to the bottom of the screen." : "Hidden while you present. Turn it back on to switch pointers.") {
Toggle("", isOn: model.binding({ Preferences.showToolbar }, { Preferences.showToolbar = $0 }))
.toggleStyle(.switch).labelsHidden().focusable(false)
}
}
}
}
Expand Down