GithubHelp home page GithubHelp logo

Comments (7)

mcbain avatar mcbain commented on August 16, 2024

Did you code these behavior somewhere?
Because just rendering the new item positions would move all existing item down by the size of the inserted element.

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

When you insert at the top, it typically shouldn't scroll unless there are less items than would fit on the screen (this will cause the scrollview to ensure that no items are accidentally hidden from view).

Actually, now you mention it, I'm seeing sort of a bug with inserting at the top. It always seems to scroll down which isn't correct. When you manually scroll down a couple items, and then press + to insert, it works as expected and it doesn't influence the scroll position.
I'll have a look at this as it used to work, but must have gotten broken along the way,

from famous-flex.

mcbain avatar mcbain commented on August 16, 2024

For my project i tried to implement some kind of function which needs to compensate flickering by changing the scroll position. In the end the code was too complicated to get it production ready, when elements can be inserted at any position and other elements can also change size.
So i'm very keen on understanding your solution :)

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

Ah I see :)

Well, the FlexScrollView is a completely new ScrollView implementation, it bares little resemblance to the stock famo.us ScrollView. I wrote it out of a necessity to support more flexible layouts such as multiple columns and sticky column-headers. The FlexScrollView is based on ScrollController which in turn is based on LayoutController. I also wrote it support better handling for true-size renderables and making bottom alignment possible for scrollviews.

I'm not even sure where to begin explaining how it all works :)
Basically, the FlexScrollView takes care of the scrolling behavior and rendering and the ListLayout takes care of the layouting. The ListLayout tells the scrollview where to place an item, and when the scrollview sees that an item is at a new position, it uses particles & springs to move the renderable to the new position.

from famous-flex.

mcbain avatar mcbain commented on August 16, 2024

"when the scrollview sees that an item is at a new position" where can i find such code?

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

So when flow-mode is enabled, the ListLayout writes the new translate coordinates to a FlowLayoutNode. FlowLayoutNode is derived from LayoutNode and contains properties such as: size, translate, origin, align, opacity, skew, scale & rotate. it basically holds the new intended state for a layout item. FlowLayoutNode contains a particle and a spring for each of these properties. It sets the end-state of the spring (e.g. for the translate coordinates) which causes the particle to move towards that new end-state. The scrollView then asks the FlowLayoutNode (which are managed by LayoutNodeManager) for the current render-spec every render-cycle (getSpec).

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 16, 2024

I fixed the bug I mentioned earlier. When the view was at the top, and you inserted an item at index 0 (before the first item), it would always scroll to the newly inserted item, which is incorrect. It should not scroll at all when inserting. This problem has been fixed.

from famous-flex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.