Skip to content

Conversation

@ddkwork
Copy link
Contributor

@ddkwork ddkwork commented Apr 17, 2025

Signed-off-by: ddkwork

This change will improve the event traversal syntax

	for {
		ev, ok := gtx.Event(pointer.Filter{
			Target: r,
			Kinds:  pointer.Press | pointer.Release,
		})
		if !ok {
			break
		}
	  }

//------------------------------->

	for e := range gtx.Events(pointer.Filter{Target: r,Kinds:pointer.Press | pointer.Release}) {
             ....
	}

Using the range iteration will never traverse to the null pointer, and the return value bool will automatically stop traversing, so it is not necessary to judge bool downstream, and it will be automatically processed at the syntax level

@ddkwork ddkwork closed this May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant