Don't resize images if same size

This commit is contained in:
Thomas Ricouard 2024-01-01 11:39:32 +01:00
parent b6317d7324
commit b93df71431

View file

@ -30,7 +30,8 @@ public struct LazyResizableImage<Content: View>: View {
content(state, proxy)
}
.processors([resizeProcessor == nil ? .resize(size: proxy.size) : resizeProcessor!])
.onChange(of: proxy.size, initial: true) { _, newValue in
.onChange(of: proxy.size, initial: true) { oldValue, newValue in
guard oldValue != newValue else { return }
debouncedTask?.cancel()
debouncedTask = Task {
do { try await Task.sleep(for: .milliseconds(200)) } catch { return }