Skip to content

Commit

Permalink
Merge pull request #1092 from cogentcore/slider-long-press
Browse files Browse the repository at this point in the history
send LongPressEnd in cancelLongPress when appropriate
  • Loading branch information
rcoreilly authored Jul 30, 2024
2 parents da2f671 + aaf24ed commit b463cf4
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 b463cf4

Please sign in to comment.