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
Hack for scrolling #156
Hack for scrolling #156
Conversation
I have a branch where I did some of the work, but it has still a few bugs here and there. I agree the gesture recognizer will have to be toggled on/off under this scenario, I was tracking that here (last bullet point at the time of this writing: So I want to have a toggle on/off for the scroll events, so users can control whether they want the gestures to work, or the scrolling to work. How are you using this scrolling if you are setting up the UIView directly? Your approach might be better than what I did. Or how are you testing it? |
I'm basically taking the same approach as on macOS, to manually handling scrollUp/scrollDown based on Pan gestures. Because after some experiments, I think that UIScrollView is just not suitable for a terminal app like this. Due to the nature of UIScrollView, whatever If UIKit has As for the mouse handling on iOS, I haven't really figured it out yet. I used pan gestures for scrolling and it will conflict with the mouse events, as you can see in the code. I feel that mouse support is not as important as scrolling. Without scrolling, the terminal is not usable. Without mouse support the terminal will still be usable to most people. Besides with iOS being able to use trackpad & mouse now, handling mouse events correctly is even more harder. If it's OK I think the mouse support can be left for future work. I'm only a person who is exploring terminals on iOS devices. Feel free to close this PR if you don't feel comfortable about it. |
Hello! I have implemented scrolling support now, and sorted out the conflicts between sending events vs moving around. It is a setup that works, but does not feel very iOS-ish. It does not use the UIScrollView capability, like you point out, and that still makes me sad. I have some comments from some months ago here: #133 The code changed since I had that branch, and I think I have a different idea of how I want to limit the rendering. I will try again that branch, which made more progress than my ill-attempted effort last night (last night I tried a quick and dirty "What if I move the terminal to a separate view", which was too dirty to work; but also found that gestures were not working, despite disabling them). The research from last night was interesting because it did surface that there is a series of methods that UIScrollView can use to interoperate with other gesture handlers. So I will try to learn more about those ("Managing Touches" and the intro text in the documentation here: https://developer.apple.com/documentation/uikit/uiscrollview) |
Mhm, I do like your change for scroll velocity, I will rebase tonight and try it out. Thanks! |
@migueldeicaza happy to help 😃 Btw, thanks for defending the terminal devs (me included or not, doesn’t matter) on Twitter about a week ago. That was very kind of you to take your time and speak out. |
Ok, I have implemented this in the new branch: uiscrollview-2022-07, doing some touchups before I merge |
I'm not sure this is the correct way to do this but here it is.
Currently UIScrollView does not work. And I don't think there is a possible way for it to work. The gestureRecognizers added will conflict with those inside UIScrollView, making UIScrollView totally unusable.
So I just make it plain UIView and put together scrolling logic. This way there'll be no fancy scrollbar or bouncing, but the scrolling will work.