Skip to content

Commit

Permalink
✨ (NewGEK): Add action in DnDOneToOne view
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Dec 17, 2024
1 parent e5f628a commit e5651b5
Showing 1 changed file with 37 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,44 @@ public struct DnDOneToOneView: View {
// MARK: Public

public var body: some View {
GeometryReader { proxy in
SpriteView(scene: self.makeScene(size: proxy.size), options: [.allowsTransparency])
.frame(width: proxy.size.width, height: proxy.size.height)
.onAppear {
self.scene = DnDOneToOneBaseScene(viewModel: self.viewModel)
HStack(spacing: 0) {
if let action = self.viewModel.action {
Button {
// nothing to do
}
label: {
ActionButtonView(action: action)
.padding(20)
}
.simultaneousGesture(
TapGesture()
.onEnded { _ in
withAnimation {
self.viewModel.isActionTriggered = true
}
}
)

Divider()
.opacity(0.4)
.frame(maxHeight: 500)
.padding(.vertical, 20)
}

Spacer()

GeometryReader { proxy in
SpriteView(scene: self.makeScene(size: proxy.size), options: [.allowsTransparency])
.frame(width: proxy.size.width, height: proxy.size.height)
.onAppear {
self.scene = DnDOneToOneBaseScene(viewModel: self.viewModel)
}
}
.colorMultiply(self.viewModel.isActionTriggered ? .white : .gray.opacity(0.4))
.animation(.easeOut(duration: 0.3), value: self.viewModel.isActionTriggered)
.allowsHitTesting(self.viewModel.isActionTriggered)

Spacer()
}
}

Expand Down

0 comments on commit e5651b5

Please sign in to comment.