Skip to content

undocumented bahavior of layers in partitions #4

@shengchl

Description

@shengchl

Hey there,

I am playing with the DragGesture in VPart and encountered in undefined behavior of partition layers. For example, when I drag a rectangle from the top partition to the bottom one using offset, it appears beneath the bottom's partition rectangle. I am looking for the way to implement the opposite behavior but as of now I cannot understand what influences it.

here's the example VPart:
@GestureState var isLongPressed = false
@State private var offset: CGSize = .zero
var body: some View {

  VPart(top: {
       HStack {

            Rectangle()
            .fill(Color.green)
            .cornerRadius(10)
            .frame(minWidth: 20, maxWidth: 200, minHeight: 20, maxHeight: 200)
            .offset(offset)
            .gesture(DragGesture()
            .onChanged { self.offset = $0.translation }
            .onEnded { _ in self.offset = .zero }
            )`
        }
        }, bottom: {
        Rectangle()
            .fill(Color.red)
            .cornerRadius(10)
            .frame(minWidth: 20, maxWidth: 200, minHeight: 20, maxHeight: 200)
        })
}

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