Closed jecisc closed 5 years ago
Reply: Author: CyrilFerlicot Date: 28 November 2018 2:50:42 pm
Message:
Here is the fix that should be integrated in Pharo 8:
handleMouseEnter: anEvent "System level event handling."
anEvent isDraggingEvent
ifTrue: [ (self handlesMouseOverDragging: anEvent)
ifTrue: [ anEvent wasHandled: true.
self mouseEnterDragging: anEvent ].
^ self eventHandler ifNotNil: [ :handler | handler mouseEnterDragging: anEvent fromMorph: self ] ].
self wantsBalloon
ifTrue: [ anEvent hand triggerBalloonFor: self after: self balloonHelpDelayTime ].
^ (self handlesMouseOver: anEvent)
ifTrue: [ anEvent wasHandled: true.
self mouseEnter: anEvent ]
ifFalse: [ self eventHandler ifNotNil: [ :handler | handler mouseEnter: anEvent fromMorph: self ] ]
===================
handleMouseLeave: anEvent "System level event handling."
anEvent hand removePendingBalloonFor: self.
anEvent isDraggingEvent
ifTrue: [ (self handlesMouseOverDragging: anEvent)
ifTrue: [ anEvent wasHandled: true.
self mouseLeaveDragging: anEvent ].
^ self eventHandler ifNotNil: [ :handler | handler mouseLeave: anEvent fromMorph: self ] ].
^ (self handlesMouseOver: anEvent)
ifTrue: [ anEvent wasHandled: true.
self mouseLeave: anEvent ]
ifFalse: [ self eventHandler ifNotNil: [ :handler | handler mouseLeave: anEvent fromMorph: self ] ]
Migrated case from Manuscript.
Original case: https://pharo.fogbugz.com/f/cases/22705 Status: Work Needed Project: Morphic Original Author: CyrilFerlicot Date: 28 November 2018 2:19:44 pm
Description:
StringMorph new contents: 'test; on: #mouseEnter send: #mouseEnter:from: to: self; on: #mouseLeave send: #mouseLeave:from: to: self; on: #click send: #mouseClick:from: to: self; yourself.
With this piece of code, if you add the methods to the class and log each time an event happens, you will see that we have two enter and leave event each time.
The problem comes from Morph>>handleMouseEnter/Leave: