Skip to content

Commit

Permalink
ToWidgetWindowElement : fixed delete animation duration (see issue #51)
Browse files Browse the repository at this point in the history
add #items to ToMenuWindow
  • Loading branch information
plantec committed Jun 22, 2023
1 parent f1b9185 commit 9705bfc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Toplo/ToMenuWindow.class.st
Expand Up @@ -35,6 +35,13 @@ ToMenuWindow >> defaultHook [
ifFalse: [ w widget bounds inSpace bounds bottomLeft ] ]
]

{ #category : #accessing }
ToMenuWindow >> items [

self widget ifNil: [ ^ #() ].
^ self widget items
]

{ #category : #'api - displaying' }
ToMenuWindow >> mouseEnterOnMenuItem: aMenuItem [

Expand Down Expand Up @@ -83,6 +90,6 @@ ToMenuWindow >> openedSubmenuWindow: aWindow [
ToMenuWindow >> popupEvent: anEvent [

self widget ifNil: [ ^ self ].
self widget items ifEmpty: [ ^ self ].
self items ifEmpty: [ ^ self ].
^ super popupEvent: anEvent
]
5 changes: 3 additions & 2 deletions src/Toplo/ToWidgetWindowElement.class.st
Expand Up @@ -113,15 +113,16 @@ ToWidgetWindowElement >> initialize [
self animate: true.
self hook: self defaultHook.

self flag: 'delete animation duration must be very very fast to ensure that sub-menu widows are always opened even if mouse is moving is fast (issue #51). It is so fast that it cannot be perceived at all. '.
deleteAnimationFactory := [
BlOpacityAnimation new
duration: 250 milliSeconds;
duration: 10 milliSeconds;
opacity: 0;
yourself ].
popupAnimationFactory := [
self opacity: 0.0.
BlOpacityAnimation new
duration: 200 milliSeconds;
duration: 400 milliSeconds;
opacity: 1;
yourself ]
]
Expand Down

0 comments on commit 9705bfc

Please sign in to comment.