[FIX]Re: [BUG]mouseEnter registres outside of worldBounds
Karl Ramberg
karl.ramberg at chello.se
Tue Jul 11 14:02:01 UTC 2000
Karl Ramberg wrote:
>
> Playing around with the ProjectNavigationMorph and it's current retracting behavior
> I found that morphs registres mouseEnter: evt outside of the world bounds (outside the Squeak
> window in MacOs)
> When the morph is outside of the world bounds it should not react to
> mouseEnter, or any mouseEvent for that sake.
>
> Karl
This should fix it.
Karl
-------------- next part --------------
'From Squeak2.9alpha of 13 June 2000 [latest update: #2447] on 11 July 2000 at 3:59:51 pm'!
!HandMorph methodsFor: 'event handling' stamp: 'kfr 7/11/2000 15:57'!
handleMouseOver: evt
| mList allMouseOvers leftMorphs enteredMorphs now t oldHalo balloonHelpEnabled localEvt |
self worldUnderCursor ifNil: [^ self].
(self worldBounds containsPoint: evt cursorPoint) ifFalse: [^self].
balloonHelpEnabled _ Preferences balloonHelpEnabled.
"Start with a list consisting of the topmost unlocked morph in the
innermost frame (pasteUp), and all of its containers in that frame."
mList _ self mouseOverList: evt.
now _ Time millisecondClockValue.
"Make a list of all potential mouse-overs..."
allMouseOvers _ mList select:
[:m | m wantsHalo or: [(balloonHelpEnabled and: [m wantsBalloon]) "To start a timer"
or: [m handlesMouseOver: (evt transformedBy: (m transformFrom: self))] "To send mouseEnter:"]].
leftMorphs _ mouseOverMorphs select: [:m | (allMouseOvers includes: m) not].
enteredMorphs _ allMouseOvers select: [:m | (mouseOverMorphs includes: m) not].
"Notify and remove any mouse-overs that have just been left..."
leftMorphs do: [:m |
mouseOverMorphs remove: m.
m wantsBalloon ifTrue: [m deleteBalloon].
m mouseLeave: (evt transformedBy: (m transformFrom: self)).
mouseOverTimes removeKey: m ifAbsent: [] ].
"Add any new mouse-overs and send mouseEnter: and/or start timers..."
enteredMorphs do: [:m |
localEvt _ evt transformedBy: (m transformFrom: self).
mouseOverMorphs add: m.
dragOverMorphs remove: m ifAbsent: []. "Cant be in two places at once"
(m handlesMouseOver: localEvt) ifTrue:
[m mouseEnter: localEvt].
(m wantsHalo or: [m wantsBalloon]) ifTrue:
[mouseOverTimes at: m put: now]].
mouseOverTimes keys do:
[:m | "Check pending timers for lingering"
t _ mouseOverTimes at: m.
(now < t "rollover" or: [now > (t+800)]) ifTrue:
["Yes we have lingered for 0.8 seconds..."
mouseOverTimes removeKey: m.
m owner ifNotNil: "Not deleted during linger (--it happens ;--)"
[m wantsHalo
ifTrue: [oldHalo _ m world haloMorphOrNil.
(oldHalo == nil or: [oldHalo target ~~ m])
ifTrue: ["Put up halo for m"
self popUpHaloFor: m event: evt.
(balloonHelpEnabled and: [m wantsBalloon]) ifTrue:
["...and reschedule balloon after longer linger"
mouseOverTimes at: m put: now]]
ifFalse: ["Halo for m is already up, so show balloon"
(balloonHelpEnabled and: [m wantsBalloon])
ifTrue: [m showBalloon: m balloonText]]]
ifFalse:
[(balloonHelpEnabled and: [m wantsBalloon])
ifTrue: [m showBalloon: m balloonText]]]]]! !
More information about the Squeak-dev
mailing list
|