Skip to content

Commit

Permalink
send LongPressEnd in cancelLongPress when appropriate to fix #1086
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoreilly committed Jul 30, 2024
1 parent cc342c6 commit aaf24ed
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,6 @@ func (em *Events) handlePosEvent(e events.Event) {
}
em.press = nil

// if we have sent a long press start event, we send an end
// event (non-nil widget plus nil timer means we already sent)
if em.longPressWidget != nil && em.longPressTimer == nil {
em.longPressWidget.AsWidget().Send(events.LongPressEnd, e)
}
em.cancelLongPress()
// a mouse up event acts also acts as a mouse leave
// event on mobile, as that is needed to clear any
Expand Down Expand Up @@ -708,6 +703,11 @@ func (em *Events) getMouseInBBox(w Widget, pos image.Point) {
}

func (em *Events) cancelLongPress() {
// if we have sent a long press start event, we send an end
// event (non-nil widget plus nil timer means we already sent)
if em.longPressWidget != nil && em.longPressTimer == nil {
em.longPressWidget.AsWidget().Send(events.LongPressEnd)
}
em.longPressWidget = nil
em.longPressPos = image.Point{}
if em.longPressTimer != nil {
Expand Down

0 comments on commit aaf24ed

Please sign in to comment.