Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Prevent two-finger swipe forard/back when scrolling on viewport #2553

Merged
merged 1 commit into from
Jul 19, 2016

Conversation

darkdh
Copy link
Member

@darkdh darkdh commented Jul 18, 2016

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Ran git rebase -i to squash commits if needed.

fix #2577

@darkdh
Copy link
Member Author

darkdh commented Jul 18, 2016

This commit can only prevent conflicts on non-inner scrollable element like

screen shot 2016-07-18 at 18 23 31

I'm still working on the other cases like example in MDN
screen shot 2016-07-18 at 18 26 08

@bbondy
Copy link
Member

bbondy commented Jul 18, 2016

does Chrome work any better?

@darkdh
Copy link
Member Author

darkdh commented Jul 18, 2016

Chrome perform swipe forward/back based on reaching the edge of viewport.
I think we can try it this way.

ipc.on('scroll-touch-begin', function () {
trackingFingers = true
startTime = (new Date()).getTime()
})
ipc.on('scroll-touch-end', function () {
if (trackingFingers && Math.abs(yVelocity) < 1) {
if (!isScroll && trackingFingers && Math.abs(yVelocity) < 1) {
if (xVelocity > 1.5) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can change the xVelocity threshold to 1 or 0.5 to make it easier to go back/forward now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks yan!

@diracdeltas
Copy link
Member

good idea

@darkdh
Copy link
Member Author

darkdh commented Jul 19, 2016

about 656d56d:

  1. We may need another way to pass the result back other than console.log
  2. The reason not use velocity is some chrome users may swipe back/forward like drawing a bow with visual effect indicator which we can add in the future

screen shot 2016-07-19 at 15 02 38

3. This commit still can not prevent conflict with inner scrollable element

@bbondy
Copy link
Member

bbondy commented Jul 19, 2016

Is IPC possible here? Just wondering why the console.log hack. Is it more efficient for some reason?

@darkdh
Copy link
Member Author

darkdh commented Jul 19, 2016

@bbondy , your are right. I should use IPC. I just came up with console.log from nowhere.

@darkdh darkdh changed the title Prevent two-finger swipe forard/back when scrolling Prevent two-finger swipe forard/back when scrolling on viewport Jul 19, 2016
@bbondy
Copy link
Member

bbondy commented Jul 19, 2016

looks great, thanks!

@bbondy bbondy merged commit 31c826f into brave:master Jul 19, 2016
@darkdh darkdh deleted the 2548 branch July 19, 2016 14:42
@luixxiul luixxiul added this to the 0.11.1dev milestone Jul 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Horizontal scroll with two-finger conflicts with swipe back/forward on viewport
4 participants