Skip to content

Conversation

@jhepp
Copy link

@jhepp jhepp commented Apr 13, 2019

Slide your finger on a touch device up will trigger the "arrow down"-key and slide down will trigger the "arrow up"-key.

An example how to use it:
data-goto-key-list="ArrowUp ArrowDown ArrowLeft ArrowRight"
data-goto-next-list="myup mydown myleft myright"

@henrikingo
Copy link
Member

Thanks Jochen!

Code looks ok.

What was your motivation for adding this? Is it to be used together with goto-key-list, like in https://impress.js.org/examples/2D-navigation/#/step-1 ?

The only thing I'm wondering about is that now left-right swipes call next() and prev() explicitly, but up-down is translated to arrow keys. Maybe it would be more useful, and consistent, if you changed also left-right to send arrow keys? What do you think?

@jhepp
Copy link
Author

jhepp commented Apr 30, 2019

The motivation for adding this code was to be able on a touch only device with no accessible keyboard to use a goto-key-list and goto-next-list navigation like in the example you mentioned.

Swiping up and down offers a second navigation dimension to touch only devices.

The translation of up-down swipes to arrow keys is a detour because i found no solution to call "up()" and "down()" directly.

next() and prev() are part of the ImpressAPI whereas "up()" and "down()" are handled by the navigation plugin. So I decided not to not change this.

@henrikingo
Copy link
Member

Thanks - and sorry for my absence due to the traditional spring flu!

Could you make the change so that also left and right swipes map to arrow keys? For example, if you try the examples/2D-navigation in your branch now, it doesn't navigate in a meaningful way, because "next" in the presentation flow is actually down. So I believe the right solution is to map all swipe directions to arrow keys. This will allow presentation authors to override all of them with goto, and by default the arrows will trigger next/prev just like they do from a keyboard. (So both right and down are next.)

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

Successfully merging this pull request may close these issues.

2 participants