fix bugs in support and docs for the snip flag HANDLES-BETWEEN-EVENTS
(the previous commit was pushed too soon; it is completely broken. Apologies)
This commit is contained in:
parent
759d89443f
commit
3af5db35be
|
@ -312,11 +312,11 @@ following symbols:
|
||||||
not have the keyboard focus (see also
|
not have the keyboard focus (see also
|
||||||
@method[snip% on-goodbye-event])}
|
@method[snip% on-goodbye-event])}
|
||||||
|
|
||||||
@item{@indexed-racket['handles-between-events] --- this snip wishes
|
@item{@indexed-racket['handles-between-events] --- this snip handles
|
||||||
to handle mouse events that are between items in the snip
|
mouse events that are between items in the snip
|
||||||
(instead of defaulting to treating mouse clicks as
|
(instead of defaulting to treating mouse clicks as
|
||||||
setting the position or other event handling that happens
|
setting the position or other event handling that happens
|
||||||
at the @racket[text%] or @racket[pasteboard%] level}
|
at the @racket[text%] or @racket[pasteboard%] level)}
|
||||||
|
|
||||||
@item{@indexed-racket['width-depends-on-x] --- this snip's display
|
@item{@indexed-racket['width-depends-on-x] --- this snip's display
|
||||||
width depends on the snip's x-@techlink{location} within the
|
width depends on the snip's x-@techlink{location} within the
|
||||||
|
|
|
@ -464,19 +464,16 @@
|
||||||
;; FIXME: old code returned if !dc
|
;; FIXME: old code returned if !dc
|
||||||
(values dc (+ x scrollx) (+ y scrolly) scrollx scrolly)))])
|
(values dc (+ x scrollx) (+ y scrolly) scrollx scrolly)))])
|
||||||
(let ([snip
|
(let ([snip
|
||||||
(let-boxes ([onit? #f]
|
(let-boxes ([how-close 0.0]
|
||||||
[how-close 0.0]
|
|
||||||
[now 0])
|
[now 0])
|
||||||
(set-box! now (find-position x y #f onit? how-close))
|
(set-box! now (find-position x y #f #f how-close))
|
||||||
;; FIXME: the following refinement of `onit?' seems pointless
|
(let* ([snip (do-find-snip now 'after)]
|
||||||
(let ([onit? (and onit?
|
[onit? (or (and (not (zero? how-close))
|
||||||
(or (and (not (zero? how-close))
|
((abs how-close) . > . between-threshold))
|
||||||
((abs how-close) . > . between-threshold))
|
(has-flag? (snip->flags snip)
|
||||||
(has-flag? (snip->flags s-caret-snip)
|
HANDLES-BETWEEN-EVENTS))])
|
||||||
HANDLES-BETWEEN-EVENTS)))])
|
(if onit?
|
||||||
(if onit?
|
;; we're in the snip's horizontal region...
|
||||||
;; we're in the snip's horizontal region...
|
|
||||||
(let ([snip (do-find-snip now 'after)])
|
|
||||||
;; ... but maybe the mouse is above or below it.
|
;; ... but maybe the mouse is above or below it.
|
||||||
(let-boxes ([top 0.0]
|
(let-boxes ([top 0.0]
|
||||||
[bottom 0.0]
|
[bottom 0.0]
|
||||||
|
@ -486,8 +483,8 @@
|
||||||
(get-snip-location snip dummy bottom #t))
|
(get-snip-location snip dummy bottom #t))
|
||||||
(if (or (top . > . y) (y . > . bottom))
|
(if (or (top . > . y) (y . > . bottom))
|
||||||
#f
|
#f
|
||||||
snip)))
|
snip))
|
||||||
#f)))])
|
#f)))])
|
||||||
(when (send event button-down?)
|
(when (send event button-down?)
|
||||||
(set-caret-owner snip))
|
(set-caret-owner snip))
|
||||||
(when (and prev-mouse-snip
|
(when (and prev-mouse-snip
|
||||||
|
|
Loading…
Reference in New Issue
Block a user