-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCursorTabView.swift
More file actions
94 lines (81 loc) · 2.92 KB
/
Copy pathCursorTabView.swift
File metadata and controls
94 lines (81 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import SwiftUI
struct CursorTabView: View {
var controller: EditorSettingsController
private var project: Project { controller.project }
var body: some View {
VStack(alignment: .leading, spacing: SB.Space.md) {
// Cursor
SBGlassCard {
cursorSection
}
.accessibilityIdentifier("cursor_section")
// Click Effect
SBGlassCard {
clickEffectSection
}
.accessibilityIdentifier("cursor_click_effect_section")
}
}
// MARK: - Cursor
private var cursorSection: some View {
VStack(alignment: .leading, spacing: SB.Space.md) {
SBSectionLabel(text: "Cursor")
Toggle(isOn: Binding(
get: { project.cursorSettings.isEnabled },
set: { controller.setCursorEnabled($0) }
)) {
Text("Show Cursor")
.font(SB.Typo.body)
.foregroundStyle(SB.Colors.textPrimary)
}
.toggleStyle(.switch)
.tint(SB.Colors.accent)
if project.cursorSettings.isEnabled {
SBGlassTabs(
items: CursorStyle.allCases.map(\.displayName),
selection: project.cursorSettings.style.displayName,
onSelect: { name in
controller.setCursorStyle(CursorStyle.fromDisplayName(name))
}
)
SBSliderRow(
label: "Size",
value: Binding(
get: { project.cursorSettings.size },
set: { controller.setCursorSize($0) }
),
range: 0.5...3.0,
step: 0.1,
format: "%.1fx"
)
}
}
}
// MARK: - Click Effect
private var clickEffectSection: some View {
VStack(alignment: .leading, spacing: SB.Space.md) {
SBSectionLabel(text: "Click Effect")
Toggle(isOn: Binding(
get: { project.cursorSettings.clickEffectEnabled },
set: { controller.setClickEffectEnabled($0) }
)) {
Text("Ripple on Click")
.font(SB.Typo.body)
.foregroundStyle(SB.Colors.textPrimary)
}
.toggleStyle(.switch)
.tint(SB.Colors.accent)
if project.cursorSettings.isEnabled && project.cursorSettings.clickEffectEnabled {
SBSliderRow(
label: "Ring Size",
value: Binding(
get: { project.cursorSettings.clickEffectMaxRadius },
set: { controller.setClickEffectRadius($0) }
),
range: 15...80,
step: 5
)
}
}
}
}