From 00ac821ae7f1ecddd8dcc96e9f512add7a5f7a73 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Mon, 23 Jun 2025 15:58:21 +0300 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20fire=20card=20action=20when=20t?= =?UTF-8?q?apping=20inner=20controls?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Card/SUCard.swift | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/Sources/ComponentsKit/Components/Card/SUCard.swift b/Sources/ComponentsKit/Components/Card/SUCard.swift index 0f1934b..13cb8c5 100644 --- a/Sources/ComponentsKit/Components/Card/SUCard.swift +++ b/Sources/ComponentsKit/Components/Card/SUCard.swift @@ -59,22 +59,19 @@ public struct SUCard: View { .shadow(self.model.shadow) .observeSize { self.contentSize = $0 } .contentShape(.rect) - .gesture( + .onTapGesture { + guard self.model.isTappable else { return } + self.onTap() + } + .simultaneousGesture( DragGesture(minimumDistance: 0.0) .onChanged { _ in - guard self.model.isTappable else { return } self.isPressed = true } - .onEnded { value in - guard self.model.isTappable else { return } - - defer { self.isPressed = false } - - if CGRect(origin: .zero, size: self.contentSize) - .contains(value.location) { - self.onTap() - } - } + .onEnded { _ in + self.isPressed = false + }, + isEnabled: self.model.isTappable ) .scaleEffect( self.isPressed ? self.model.animationScale.value : 1,