mapbox-maps-ios icon indicating copy to clipboard operation
mapbox-maps-ios copied to clipboard

SwiftUI - Stuttering Zoom Animation

Open thomas-hensel opened this issue 1 year ago • 0 comments

Environment

  • Xcode version: 16.0
  • iOS version: 18.0
  • Devices affected: Simulator
  • Maps SDK Version: v11.7.0

Observed behavior and steps to reproduce

I changed SimpleMapExample like this and observe a strange "stuttering" Zoom Animation when taping on the map

@available(iOS 14.0, *) struct SimpleMapExample: View { @Environment(.colorScheme) var colorScheme @State var isEnlarged: Bool = false

var body: some View {
    let polygon = Polygon(center: .helsinki, radius: 10000, vertices: 30)
    VStack {
        HStack {
            Spacer()
            Map(initialViewport: .overview(geometry: polygon))
                .mapStyle(.standard(lightPreset: colorScheme == .light ? .day : .dusk))
                .frame(width: isEnlarged ? 390 : 100, height: isEnlarged ? 750 : 100)
                .onTapGesture {
                    withAnimation (.linear(duration: 5)) {
                        self.isEnlarged.toggle()
                    }
                }
        }
        Spacer()
    }
}

}

Expected behavior

Smooth linear animation

Notes / preliminary analysis

Additional links and references

https://github.com/user-attachments/assets/a34e365c-37cb-483c-8c2e-039457c32f3d

thomas-hensel avatar Oct 02 '24 11:10 thomas-hensel