Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Horizontal scrollbar not working on list #205

Open
LouisePla opened this issue Sep 19, 2024 · 4 comments
Open

Horizontal scrollbar not working on list #205

LouisePla opened this issue Sep 19, 2024 · 4 comments
Assignees

Comments

@LouisePla
Copy link
Collaborator

I’m trying to add horizontal and vertical scrollbars in a list, but only the vertical scrollbar works. The horizontal scroll bar is visible but does not move with the mouse (example below).

| list hBar vBar   |
list := ToListElement new nodeBuilder: [ :node :dataItem :holder | | e |
		        	e := BlElement new size: 1000@200.
					e background: Color random.
					node addChild: e ].
	
list dataAccessor addAll: { 1.2.3.4.5.6.7.8.9 }.

hBar := BlHorizontalScrollbarElement new
		        constraintsDo: [ :c |
			        c ignoreByLayout.
			        c ignored vertical alignBottom ];
		        yourself.
hBar thumb: (BlElement new
		height: 16;
		geometry: (BlRoundedRectangleGeometry cornerRadius: 10);
		background: Color blue;
		yourself).
hBar track background: Color transparent.
hBar zIndex: 100.
hBar attachTo: list next.

vBar := BlVerticalScrollbarElement new
		        constraintsDo: [ :c |
			        c ignoreByLayout.
			        c ignored horizontal alignRight ];
		        yourself.
vBar thumb: (BlElement new
		width: 16;
		geometry: (BlRoundedRectangleGeometry cornerRadius: 10);
		background: Color blue;
		yourself).
vBar track background: Color transparent.
vBar zIndex: 100.
vBar attachTo: list next.

list addChild: hBar.
list addChild: vBar.
list openInSpace 
@LouisePla
Copy link
Collaborator Author

I found a workaround to get both scroll bars using a ScrollPane.

|pane list vBar scrollableElement hBar scrollPane |

list := ToListElement new nodeBuilder: [ :node :dataItem :holder | | e | e := BlElement new size: 1000@200.
					e background: Color random.
					node addChild: e ].
list dataAccessor addAll: { 1.2.3.4.5.6.7.8.9 }.

scrollableElement := BlScrollableElement new
		                     constraintsDo: [ :c |
			                     c horizontal matchParent.
			                     c vertical matchParent ];
		                     yourself.
		
vBar := BlVerticalScrollbarElement new
		        constraintsDo: [ :c |
			        c ignoreByLayout.
			        c ignored horizontal alignLeft ];
		        yourself.

hBar := BlHorizontalScrollbarElement new
		        constraintsDo: [ :c |
			        c ignoreByLayout.
			        c ignored vertical alignBottom ];
		        yourself.

pane := ToPane vertical fitContent.
pane constraints horizontal fitContent.
pane constraints vertical matchParent.

scrollPane := ToPane vertical matchParent.

hBar attachTo: scrollableElement.
vBar attachTo: list next.
list addChild: vBar.
pane addChild: list.
scrollableElement addChild: pane.
scrollPane addChild: scrollableElement.
scrollPane addChild: hBar.

scrollPane openInSpace 

image

@plantec
Copy link
Collaborator

plantec commented Oct 19, 2024

thanks for your workaround.
Now this is a real issue with Infinite.
The main direction scrolling is made efficient but the secondary direction scrolling is not managed currently

@tinchodias
Copy link
Collaborator

Hello, after some seconds of scrolling like crazy, I got this error while trying the work-around script:
Screenshot 2024-10-21 at 10 02 07

Running on:

  • Build information: Pharo-13.0.0+SNAPSHOT.build.253.sha.d44a93265706570936135ce91e2475ab5876aff4 (64 Bit)
  • Macbook Pro 18

@tinchodias
Copy link
Collaborator

I wonder what is the expected behavior. I'm playing on Mac's Finder (file browser) and notice that when I start scrolling in one of the directions, the other seems to be muted.

I write it in other words, more concrete: I have a window with both bars. I start scrolling down with the trackpad, and in the middle I move finder to the right, and I notice that vertical movement cancels the horizontal movement. But it's not that vertical wins always. If the stronger movement is vertical, then the horizontal is muted.

I may be wrong. What do you think is the expected behavior? I'd like to check how it works typically on Windows now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants