Skip to content

Commit

Permalink
remove lots of unused code from a different implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuatbrown committed Aug 16, 2024
1 parent 388a6a9 commit 3f6998f
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions Nos/Views/Components/Images/ImageViewer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@ struct ImageViewer: View {
let url: URL

@Environment(\.dismiss) private var dismiss

/// The current zoom scale of the image.
@State private var scale: CGFloat = 1.0

/// The offset of the image. This is updated when the user has zoomed and is panning up, down, left, and right.
@State private var offset: CGSize = .zero

/// The previous offset of the image.
/// - SeeAlso: `offset`
@State private var zoomScale: CGFloat = 1.0

/// The size of the image. Will be set to a non-zero value when the image has loaded.
@State private var imageSize: CGSize = .zero

/// The maximum zoom scale for the image.
private let maxZoomScale: CGFloat = 10.0

/// The minimum zoom scale for the image.
private let minZoomScale: CGFloat = 1.0

var body: some View {
ZStack {
Expand Down Expand Up @@ -54,27 +35,6 @@ struct ImageViewer: View {
}
.ignoresSafeArea()
}

func resetImageState() {
withAnimation(.interactiveSpring()) {
zoomScale = minZoomScale
}
}

func onImageDoubleTapped(value: TapGesture.Value) {
if zoomScale == minZoomScale {
withAnimation(.spring()) {
zoomScale = 4
}
} else {
resetImageState()
}
}

var doubleTapGesture: some Gesture {
TapGesture(count: 2)
.onEnded(onImageDoubleTapped)
}
}

#Preview {
Expand Down

0 comments on commit 3f6998f

Please sign in to comment.