Skip to content

Commit

Permalink
fix #95: 스크롤뷰 글리칭 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
enebin committed Sep 14, 2023
1 parent 209d291 commit a896dc5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ class PinchZoomView: UIView {
isPinching = false
scale = scale.between(min: 0.5, max: 2.0)
lastScale = scale
// anchor = .center
// offset = .zero
anchor = .center
offset = .zero
default:
break
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public extension View {

struct PinchToZoomViewModifier: ViewModifier {
@State var scale: CGFloat = 1.0
@State var anchor: UnitPoint = .center
@State var anchor: UnitPoint = .zero
@State var offset: CGSize = .zero
@State var isPinching: Bool = false

func body(content: Content) -> some View {
content
// .scaleEffect(scale, anchor: anchor)
.scaleEffect(scale)
.scaleEffect(scale) // Prevent glitching
.offset(offset)
.overlay(
PinchZoomViewRepresentable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,25 +115,27 @@ public struct CirclePackView<DetailView: View>: View {
// 전체 스크롤, 원상복구되는 줌 들어가 있음
ScrollView([.horizontal, .vertical], showsIndicators: false) {
ZStack {
ForEach(circleData) { data in
if data == focusedCircleData {
Circle().fill(.clear)
} else {
SubCircleView(
namespace: namespace,
outboundLength: option.outboundLength,
circleData: data,
onTapGesture: {
guard animationEnded else { return }
option.onCircleTappedHandler(data)
focusedCircleData = data
})
ZStack {
ForEach(circleData) { data in
if data == focusedCircleData {
Circle().fill(.clear)
} else {
SubCircleView(
namespace: namespace,
outboundLength: option.outboundLength,
circleData: data,
onTapGesture: {
guard animationEnded else { return }
option.onCircleTappedHandler(data)
focusedCircleData = data
})
}
}
}
.frame(width: option.outboundLength, height: option.outboundLength)
.padding(option.framePadding)
.scaleEffect(scale)
}
.frame(width: option.outboundLength, height: option.outboundLength)
.scaleEffect(option.scale)
.padding(option.framePadding)
.pinchZooming()
}
.zIndex(1)
Expand Down
1 change: 0 additions & 1 deletion Projects/Features/Sources/MyPage/MyPageView+.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ extension MyPageView {
nickname: viewStore.nickname)
.allowsHitTesting(false)


HStack {
Image(systemName: "arrow.clockwise")
.foregroundColor(.white)
Expand Down

0 comments on commit a896dc5

Please sign in to comment.