PartitionKit
PartitionKit copied to clipboard
undocumented bahavior of layers in partitions
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)
})
}