-
Notifications
You must be signed in to change notification settings - Fork 563
Closed
Milestone
Description
Hi,
I am trying to use and understand Macaw but onTap event did not work for me.
In the below code, only if I remove linearGradient is onTap closure triggered. Could you please help me to resolve?
class GroupView2: MacawView {
required init?(coder aDecoder: NSCoder) {
let linearGradient = LinearGradient(
degree: 90,
from: Color(val: 0xfcc07c),
to: Color(val: 0xfc7600))
let shape = Shape(
form: Rect(x: -100, y: -15, w: 200, h: 30).round(r: 5),
fill: linearGradient)
let text = Text(
text: "Show",
font: Font(name: "Serif", size: 21),
fill: Color.white,
align: .mid,
baseline: .mid,
opaque: false)
let image = Image(
src: "black_setting.png",
w: 30, h: 30,
place: .move(dx: -15 - 50, dy: -15),
opaque: false)
shape.onTap { event in
text.fill = Color.maroon
}
let group = Group(contents: [shape, text, image], place: .move(dx: 375 / 2, dy: 75))
super.init(node: group, coder: aDecoder)
}
}