Skip to content

Map view jumps to old fraction when scrolled #44

@stevengharris

Description

@stevengharris

I'm evaluating this library and I found a problem when trying to put a Map (SwiftUI) into the Top view on a VSplit. I've reproduced it by adding a Map to the Demo sample simpleAdjustable Code below. Once I move the map (or zoom) the Split is resized back to an original position instead of retaining where the User left it. Is there a known workaround to resolve this? Video below.

case .simpleAdjustable:
                Split(
                    primary: {
                        Map(coordinateRegion: $region, annotationItems: annotations) {
                            MapPin(coordinate: $0.coordinate)
                        }
                    },
                    secondary: { Color.red }
                )
                .styling(color: .yellow)
                .layout(demo.holders[0].layout)
                .hide(demo.holders[0].hide)

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2024-12-16.at.12.41.17.mp4

Other supporting code:

@State var region: MKCoordinateRegion = MKCoordinateRegion(center: CLLocationCoordinate2D(latitude: 37.09, longitude: -95.71), latitudinalMeters: Measurement(value: 15, unit: UnitLength.miles).converted(to: .meters).value, longitudinalMeters: Measurement(value: 15, unit: UnitLength.miles).converted(to: .meters).value)
let annotations: [City] = [ ]
struct City: Identifiable {
    let id = UUID()
    let name: String
    let coordinate: CLLocationCoordinate2D
}

Originally posted by @kylepinionseb in #43

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions