Skip to content

Commit

Permalink
BlScrollableElement: allow subclasses to redefine the event handler a…
Browse files Browse the repository at this point in the history
…nd the scroll flinger
  • Loading branch information
plantec committed May 22, 2024
1 parent bb57b49 commit 640d9db
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions src/Bloc-Infinite/BlScrollableElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ BlScrollableElement >> computeVerticalScrollRange [
^ self scrolledElement height + self scrolledElement margin height + self padding height
]

{ #category : #initialization }
BlScrollableElement >> defaultEventHandler [

^ BlScrollableElementEventHandler new
]

{ #category : #initialization }
BlScrollableElement >> defaultHorizontalAlignment [
"By default alignment should not influence on layout process,
Expand All @@ -107,6 +113,13 @@ BlScrollableElement >> defaultLayout [
^ BlFrameLayout new
]

{ #category : #initialization }
BlScrollableElement >> defaultScrollFlinger [

"Return class, actuall instantiation happens in initialize"
^ BlScrollFlinger
]

{ #category : #initialization }
BlScrollableElement >> defaultVerticalAlignment [
"By default alignment should not influence on layout process,
Expand Down Expand Up @@ -143,13 +156,12 @@ BlScrollableElement >> horizontalAlignment: aBlElementAlignment [
BlScrollableElement >> initialize [
super initialize.

scrollFlinger := BlScrollFlinger on: self.
scrollFlinger := self defaultScrollFlinger on: self.
scrollPosition := 0.0@0.0.
scrollState := #idle.
horizontalAlignment := self defaultHorizontalAlignment.
verticalAlignment := self defaultVerticalAlignment.

self addEventHandler: BlScrollableElementEventHandler new
self addEventHandler: self defaultEventHandler
]

{ #category : #layout }
Expand Down

0 comments on commit 640d9db

Please sign in to comment.