Skip to content

Commit 1994670

Browse files
authored
fix: align divina zoom and waifu2x settings behavior (#513)
- Hide `Double Tap Zoom Scale` when `Double Tap to Zoom` is set to `Disabled` in the reader settings sheet. - Keep waifu2x settings in switch-based branches (`disabled/auto/always`) without extra outer condition wrappers. - Remove explicit transition modifiers and rely on default state-driven form animations for both reader sheet and global Divina settings.
1 parent c3c3315 commit 1994670

2 files changed

Lines changed: 20 additions & 21 deletions

File tree

KMReader/Features/Reader/Views/Sheets/ReaderSettingsSheet.swift

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,20 @@ struct ReaderSettingsSheet: View {
101101
}
102102
}
103103
.pickerStyle(.menu)
104-
VStack(alignment: .leading, spacing: 8) {
105-
HStack {
106-
Text("Double Tap Zoom Scale")
107-
Spacer()
108-
Text(String(format: "%.1fx", doubleTapZoomScale))
109-
.foregroundColor(.secondary)
104+
if doubleTapZoomMode != .disabled {
105+
VStack(alignment: .leading, spacing: 8) {
106+
HStack {
107+
Text("Double Tap Zoom Scale")
108+
Spacer()
109+
Text(String(format: "%.1fx", doubleTapZoomScale))
110+
.foregroundColor(.secondary)
111+
}
112+
Slider(
113+
value: $doubleTapZoomScale,
114+
in: 1.0...8.0,
115+
step: 0.5
116+
)
110117
}
111-
Slider(
112-
value: $doubleTapZoomScale,
113-
in: 1.0...8.0,
114-
step: 0.5
115-
)
116118
}
117119
}
118120
#endif
@@ -134,8 +136,6 @@ struct ReaderSettingsSheet: View {
134136

135137
Group {
136138
switch imageUpscalingMode {
137-
case .disabled:
138-
EmptyView()
139139
case .auto:
140140
VStack(alignment: .leading, spacing: 8) {
141141
HStack {
@@ -153,7 +153,6 @@ struct ReaderSettingsSheet: View {
153153
.font(.caption)
154154
.foregroundColor(.secondary)
155155
}
156-
.transition(.opacity)
157156
case .always:
158157
VStack(alignment: .leading, spacing: 8) {
159158
HStack {
@@ -171,10 +170,10 @@ struct ReaderSettingsSheet: View {
171170
.font(.caption)
172171
.foregroundColor(.secondary)
173172
}
174-
.transition(.opacity)
173+
case .disabled:
174+
EmptyView()
175175
}
176176
}
177-
.animation(.easeInOut(duration: 0.2), value: imageUpscalingMode)
178177
}
179178
#endif
180179

@@ -319,6 +318,8 @@ struct ReaderSettingsSheet: View {
319318
}
320319
}
321320
.animation(.default, value: tapZoneMode)
321+
.animation(.default, value: doubleTapZoomMode)
322+
.animation(.default, value: imageUpscalingMode)
322323
.presentationDragIndicator(.visible)
323324
}
324325
}

KMReader/Features/Settings/DivinaPreferencesView.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,6 @@ struct DivinaPreferencesView: View {
160160

161161
Group {
162162
switch imageUpscalingMode {
163-
case .disabled:
164-
EmptyView()
165163
case .auto:
166164
VStack(alignment: .leading, spacing: 8) {
167165
HStack {
@@ -179,7 +177,6 @@ struct DivinaPreferencesView: View {
179177
.font(.caption)
180178
.foregroundColor(.secondary)
181179
}
182-
.transition(.opacity)
183180
case .always:
184181
VStack(alignment: .leading, spacing: 8) {
185182
HStack {
@@ -197,10 +194,10 @@ struct DivinaPreferencesView: View {
197194
.font(.caption)
198195
.foregroundColor(.secondary)
199196
}
200-
.transition(.opacity)
197+
case .disabled:
198+
EmptyView()
201199
}
202200
}
203-
.animation(.easeInOut(duration: 0.2), value: imageUpscalingMode)
204201
}
205202
#endif
206203

@@ -427,6 +424,7 @@ struct DivinaPreferencesView: View {
427424
}
428425
.animation(.default, value: tapZoneMode)
429426
.animation(.default, value: doubleTapZoomMode)
427+
.animation(.default, value: imageUpscalingMode)
430428
.formStyle(.grouped)
431429
.inlineNavigationBarTitle(SettingsSection.divinaReader.title)
432430
}

0 commit comments

Comments
 (0)