min icon indicating copy to clipboard operation
min copied to clipboard

Swipe gestures indicators

Open sleepyfran opened this issue 9 years ago • 9 comments

It'd be nice to have some indicators when the swipe gestures are triggered just like Safari (transitions between the current page and the next one) or Chrome (shows a back or forward arrow as you swipe) does.

I was looking to implement something like this into the browser, but I really don't know how to begin implementing something like this.

sleepyfran avatar Aug 15 '17 02:08 sleepyfran

Having an animation like Safari does would be difficult, since we'd need to take a screenshot of every page in order to show the previous page in the animation (which would likely be fairly slow). However, an arrow like Chrome does shouldn't be too difficult.

If you want to implement this, this code runs whenever you swipe. Basically, you would need to show an arrow element here (which could just be placed on top of the webview using position:fixed) and then hide it after a timeout.

PalmerAL avatar Aug 15 '17 02:08 PalmerAL

Thanks! I'll try to implement it. However, to achieve the same effect as Chrome does the arrow should be appearing at the same time as the swipe is being performed not at the end, so I guess that it should be in the swipeEvents file?

sleepyfran avatar Aug 15 '17 03:08 sleepyfran

Yes. I think the best solution would be to add something here like this:

if(horizontalMouseMove < -some_number) {
  ipc.sendToHost("showBackArrow");
} else if (horizontalMouseMove > some_number) {
  ipc.sendToHost("showForwardArrow");
}

Then you can add another bindWebviewIPC call in webviews.js:

bindWebviewIPC("showBackArrow", function() {
  //show the back arrow element
});

Chrome has some kind of effect where the arrow appears and then gets bigger as you swipe more, but we can probably just ignore that and have a fixed animation when the arrow appears.

PalmerAL avatar Aug 15 '17 03:08 PalmerAL

Actually, you would need to check if the arrow has already been shown:

if(horizontalMouseMove < -some_number && !hasShownSwipeArrow) {
  ipc.sendToHost("showBackArrow");
  hasShownSwipeArrow = true;
} else if (horizontalMouseMove > some_number && !hasShownSwipeArrow) {
  ipc.sendToHost("showForwardArrow");
  hasShownSwipeArrow = true;
}

PalmerAL avatar Aug 15 '17 03:08 PalmerAL

Great, thank you! I'll try to implement it in my local branch and reach back if I have anything interesting.

Sent from my Xiaomi MI 5C using FastHub

sleepyfran avatar Aug 15 '17 14:08 sleepyfran

Wasn't this fixed by #483?

revolter avatar Sep 14 '18 09:09 revolter

@revolter https://github.com/minbrowser/min/blob/d08e35dc762bf2fb71eb05ff16db00e984aefe86/js/webviewGestures.js#L1-L7

code-hunger avatar Sep 14 '18 10:09 code-hunger

It looks like this was implemented, but I don't see the animation (on OSX Mojave).

Visual feedback would be really useful with the keyboard shortcut too.

Sometimes when my internet connection is slow (or my Command key is a bit faulty), it's hard to tell whether the gesture or keyboard shortcut actually worked. In those cases I often end up swiping, then using the keyboard shortcut, then giving up and clicking the actual button itself anyway (as it's the only way to be sure Min got the message).

Occasionally I'll just daydream and wait for the page to load for several minutes, until realising the gesture/shortcut didn't work.

MarkWahlsten avatar Jun 02 '20 07:06 MarkWahlsten

@MarkWahlsten It stopped working when we switched to BrowserViews a couple years ago; to fix it, we would need to add another view on top that acts as an overlay.

You should get a progress bar after a couple seconds if the new page is loading, but I agree it would be nice to have more immediate feedback; an animation on the back button might work.

PalmerAL avatar Jun 02 '20 21:06 PalmerAL