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

Embedded scrollview always fires both vertical & horizontal scrollstart #52

Open
peacechen opened this issue Feb 2, 2015 · 4 comments

Comments

@peacechen
Copy link

I implemented the Embedded scrollview scrolling restrictions that you decribed at
https://github.com/IjzerenHein/famous-flex/blob/master/tutorials/FlexScrollView.md#embedded-scrollview-scrolling-restrictions

Unexpectedly, it always fires both vertical & horizontal scrollstart events. I had to make a small change to work around that during vertical-only scrolling by setting a flag in the vertical scrollstart to prevent the horizontal scrollstart from coming in behind it and disabling the vertical. Logically it seems that setOptions({ enabled: false }) would disable the horizontal scrollstart firing, but there must be a race condition with the callbacks.

While the list is scrolling one way, it can't be scrolled the other way since it's waiting for the scrollend event to re-enable. This is problematic as the list decelerates and looks like it has stopped but not quite. Is there an option to increase the dampening effect?

Also is there an option to limit how far the list can be pulled away from the edge at the ends of the list? That inertia draws out how long the list continues moving and prevents swiping in the perpendicular direction. It would be great if that could be disabled because in my case, the horizontal scrollview shouldn't pull away from the edge.

@IjzerenHein
Copy link
Owner

Thanks for reporting this Peace.
I will have to have a closer look at the scrollstart events both firing, this doesn't seem right.

The scrolling damping effect is controlled by a physics particle, a spring and two drag-forces. You will have to look in the famo.us source-code on what other options you can pass to these physics objects. The damping-ratio and period for the scrollSpring will be the most relevant to you:

var scrollView = new FlexScrollView({
        scrollParticle: {
            // use defaults
        },
        scrollDrag: {
            forceFunction: Drag.FORCE_FUNCTIONS.QUADRATIC,
            strength: 0.001,
            disabled: true
        },
        scrollFriction: {
            forceFunction: Drag.FORCE_FUNCTIONS.LINEAR,
            strength: 0.0025,
            disabled: false
        },
        scrollSpring: {
            dampingRatio: 1.0,
            period: 350
        },
});

It's currently not possible to configure how far the the list can be pulled from the edge. If you think this would be useful for other developers as well, please make a explanatory feature request for it so others can vote for it as well.

@IjzerenHein
Copy link
Owner

Hi, I am unable to reproduce this problem. Can you share the code or a live example so I can have a look?

Are you sure that you have set touchMoveDirectionThresshold: 0.5 for both scrollviews?

@IjzerenHein
Copy link
Owner

ping @peacechen

1 similar comment
@IjzerenHein
Copy link
Owner

ping @peacechen

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants