mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
widget: remove unused Button.prevClicks
It was left over from a previous approach to enable the program to decide the ordering between calls to Layout vs Clicked. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -15,9 +15,6 @@ type Button struct {
|
|||||||
click gesture.Click
|
click gesture.Click
|
||||||
// clicks tracks the number of unreported clicks.
|
// clicks tracks the number of unreported clicks.
|
||||||
clicks int
|
clicks int
|
||||||
// prevClicks tracks the number of unreported clicks
|
|
||||||
// that belong to the previous frame.
|
|
||||||
prevClicks int
|
|
||||||
history []Click
|
history []Click
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,9 +28,6 @@ func (b *Button) Clicked(gtx *layout.Context) bool {
|
|||||||
b.processEvents(gtx)
|
b.processEvents(gtx)
|
||||||
if b.clicks > 0 {
|
if b.clicks > 0 {
|
||||||
b.clicks--
|
b.clicks--
|
||||||
if b.prevClicks > 0 {
|
|
||||||
b.prevClicks--
|
|
||||||
}
|
|
||||||
if b.clicks > 0 {
|
if b.clicks > 0 {
|
||||||
// Ensure timely delivery of remaining clicks.
|
// Ensure timely delivery of remaining clicks.
|
||||||
op.InvalidateOp{}.Add(gtx.Ops)
|
op.InvalidateOp{}.Add(gtx.Ops)
|
||||||
@@ -49,8 +43,6 @@ func (b *Button) History() []Click {
|
|||||||
|
|
||||||
func (b *Button) Layout(gtx *layout.Context) {
|
func (b *Button) Layout(gtx *layout.Context) {
|
||||||
// Flush clicks from before the previous frame.
|
// Flush clicks from before the previous frame.
|
||||||
b.clicks -= b.prevClicks
|
|
||||||
b.prevClicks = 0
|
|
||||||
b.processEvents(gtx)
|
b.processEvents(gtx)
|
||||||
b.click.Add(gtx.Ops)
|
b.click.Add(gtx.Ops)
|
||||||
for len(b.history) > 0 {
|
for len(b.history) > 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user