"Swipe" and other top-level gestures on iOS and Android


#1

Hello all,

We're developing a cross-platform smartphone app with a dozen or so screens/pages. I've implemented 2-finger pinching in our custom widgets (audio oscilloscopes and spectrograms, all based on CSL widgets), but I'd also like to allow the user to swipe horizontally to change pages and to scroll vertically within pages that are taller than the screen.

Many of our pages contain multiple other widgets (text panes, buttons, tree views, viewports, etc.).

I use mouse drag velocity computation to detect swipes within our custom widgets, and am now wondering how to handle it within a composite component that has multiple JUCE widgets in it.  JUCE buttons and treeViews, for example, handle mouse events themselves, so I can't see how to put my velocity-based logic in there to detect a swipe that begins on a button.

Is there a well-known technique or design pattern that I'm missing?

Does one interpose a transparent component on top of the whole screen to delegate events and catch swipes?

Am I missing something simple? (If yes, please be polite...)

Thanks for any responses.

Stephen in Santa Barbara

 


#2

I've still got a lot of work to do on adding gesture support for things like listboxes, but if you're writing your own swipe behaviours, check out the AnimatedPosition class, which I wrote specifically for that.


#3

Are we any closer to gestures for e.g. swipe to scroll a viewport?

I'm about to start digging into the ListBox code to see if I can find anything. Any pointers would be appreciated. 


#4

Sorry, haven't got that yet, but it'll be something we need at ROLI for our own apps, so is pretty likely to happen!


#5

Great, I knew it was in the pipeline - do you have any kind of timeframe in mind? Thanks


#6

Probably in our next release sometime this year, but sorry, can't be any more specific!


#7

Still in the pipeline or have I missed something ? Do you plan to do it for Label and TextEditor ? Personally I use TextEditor a lot for text boxes as it does all the calculations to determine if I need to scroll or not, as opposed to using ViewPorts (yeah I know I'm a lazy guy...)

This actually is an important feature for mobile platforms as the scrollbar is not natural, nor very handy, and eating space...


#8

Actually just added some drag-to-scroll stuff in Viewport yesterday. Will be adding more as time goes on..


#9

Well I'm still confused on how to use this in TextEditor objects. How can I dragnscroll when the text is too long to fit in the viewport ? The TextEditor's viewport is private, anyway...


#10

...unless the idea is to add another viewport on top of course....

not very elegant, is it ?


#11

TextEditor's a special case, it would need extra gesture support. Will happen, but not there yet. Like I said above, the Viewport stuff is a start, I'm not saying we're finished.