Coder Social home page Coder Social logo

Comments (7)

toostn avatar toostn commented on August 22, 2024

I think this fixes the scroll event, but I haven't had the time to examine it thoroughly enough to make a pull request.

ScrollController.js:1663

// When scroll-offset has changed, emit scroll-start event
if (this._scrollOffsetCache !== scrollOffset) {
    if (!this._scroll.isScrolling) {
        this._scroll.isScrolling = true;
        this._eventOutput.emit('scrollstart', eventData);
    } else {
        this._eventOutput.emit('scroll', eventData);
    }
}

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 22, 2024

Hello Torsten, glad to hear you like the component!
Your suggestion sounds like a great idea!
I think the code you suggest would work, but I think it would be better if the scroll event is emitted after the layout has been recalculated (at the same time, scrollend is emitted`. If you can make a pull request out of it, I'll add it to the codebase.
Cheers,
Hein

from famous-flex.

toostn avatar toostn commented on August 22, 2024

Sure, I'll give it a try and also move it to the end of the commit method!

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 22, 2024

Awesome!

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 22, 2024

Awesome Torsten!

I'm just reviewing the code and I'm going to make some changes it. I think it would be useful to always emit the 'pagechange' event, even when the pagination is not enabled. Also, I'm moving the call to getFirstVisibleItem to after the layout function (it may have changed after the layout has been executed.

I noticed that pagechange is only executed when an actual visibleItem exists. In my interpretation of such an event, it should also emit the event when a change from page A to no page is detected. In that case someone can write an event-handler and for instance clear the detail view when no current page exists.

from famous-flex.

IjzerenHein avatar IjzerenHein commented on August 22, 2024

I've pushed the changes. The pagechange event is now fired whenever the visible content has changed. So also, when you for instance swap the first item. Basically, whenever the renderable has changed, pagechange is emitted. Also, on startup an event is emitted, when transitioning from no page to page A.

Let me know what you're thoughts are on this.

from famous-flex.

toostn avatar toostn commented on August 22, 2024

I agree with you regarding triggering the event when page changes from or to undefined. The idea to only check for page changes when the scrollview was paginated was mostly to avoid unnecessary checks, but it makes sense to not limit the event to paging views.

Thanks for implementing these events!

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.