Is there a way to change the clickable area of a swiftui button? I'm adding some buttons over the area of detected text and want to click it. But with this code I get these results
var body: some View {
HStack {
ZStack{
GeometryReader { geometry in
Image(nsImage: self.img!)
.resizable()
.scaledToFit()
.background(self.rectReader())
}
ForEach(self.rects) { rect in
Button(action: {
buttonPressed()
}) {
Rectangle()
.fill(Color.init(.sRGB, red: 1, green: 0, blue: 0, opacity: 0.2))
.frame(width: rect.width, height: rect.height)
}
.offset(x: rect.xAxis, y: rect.yAxis)
}
}
The clickable area is much larger than the rect I create.

.onTapGesturedirectly toRecatangle()?