mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget: [API] move Clickable state update from Layout to Clicks
Before this change, Clickable state updates would happen in Layout. However, that is too late in cases where clicks affects layout that contiains the Clickable. This change removes state changes from Layout and moves them to Clicks, to allow users pre-layout access. Note that Layout itself processes events, which means users can no longer access clicks after Layout. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -57,13 +57,11 @@ func ExampleClickable_passthrough() {
|
||||
Position: f32.Pt(50, 50),
|
||||
},
|
||||
)
|
||||
// The second layout ensures that the click event is registered by the buttons.
|
||||
widget()
|
||||
|
||||
if button1.Clicked() {
|
||||
if button1.Clicked(gtx) {
|
||||
fmt.Println("button1 clicked!")
|
||||
}
|
||||
if button2.Clicked() {
|
||||
if button2.Clicked(gtx) {
|
||||
fmt.Println("button2 clicked!")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user