GithubHelp home page GithubHelp logo

Comments (10)

roman-rr avatar roman-rr commented on May 27, 2024

@luckashenri not checked yet, just quick assumption that router remove elements from DOM. Maybe just init inside body will fix. I will check in few days.

from panes.

luckashenri avatar luckashenri commented on May 27, 2024

@roman-rr I tried with diff version, but still no luck.

Something interesting is that after calling 'scrollElementInit' it does work to scroll down, but when I scroll up it brings the panel together.

Well keep trying at the meantime and keep u posted.

from panes.

roman-rr avatar roman-rr commented on May 27, 2024

@luckashenri Thank you again, I've checked.
calcFitHeight() method should be used for Auto Height panes with settings.fitHeight = true;
The fitHeight: true option will assign method calcFitHeight() for instance.

In your case, you just want to scroll up on each new page?

from panes.

luckashenri avatar luckashenri commented on May 27, 2024

@roman-rr I found out something interesting..

Not sure if u're familiar with angular, or any other framework like that.. But basically when I put the 'overflow-y' attribute in a upper level, it will render the inner data correctly with scroll.

When I do it inside each inner page, it will work for first one only, and then break.

example 1:
image

In this example, the pages have their own custom header, and custom body. In that case, the scroll breaks cause it needs to recalc everytime I switch page (that's what I think).

example 2:

image

In this second example, I have the page changing INSIDE the overflow-y div.. In that case, even changing the height of inner content, it works nicely..
But in this case, I can't have a custom header like in first example.

from panes.

roman-rr avatar roman-rr commented on May 27, 2024

@luckashenri Would you like to recalculate height of overflow-y element on page changes?

  1. Have you tried setOverflowHeight() method ?
  2. Have you checked this example ? Here overflow element recalculated dynamically.

If nothing works, your example still relevant ? I may try to do this right on this example ? Or you have to adjust this example with headers ?

from panes.

luckashenri avatar luckashenri commented on May 27, 2024

@roman-rr .

I don't want the overflow-y to recalc it necessarely, it's just that I noticed that it loses the height once I move to another page for some reason, I thought recalculating would fix, but it caused the scroll affecting the drawer as well. (like I explain below answering ur second question).

1 - Yes, it didn't have any effect.
2 - Yes, I tried something similar calculating manually the height. It kinda works but then the action of scrolling inner scroll also affects the drawer as a whole. When I scroll it also drags the drawer.

Yeah that project I sent is still valid. In fact now I added 2 modules. One with it working (but with static header). And another with dynamic header (that comes within the page) but with scroll breaking.

Seems like stackblitz doesn't want to run it lol.. I guess u'll need to clone and run it. Lemme know if it works for u.

from panes.

luckashenri avatar luckashenri commented on May 27, 2024

@roman-rr not sure it's relavant, but I noticed it shows 'cancelable: true' once it's being dragged.. The only difference I noticed so far between them.

not working example:
image

working example (I took this screenshot before switching pages, so I could check how was the states before breaking):
image

from panes.

roman-rr avatar roman-rr commented on May 27, 2024

@luckashenri thank you for details, I'll check in couple days

from panes.

roman-rr avatar roman-rr commented on May 27, 2024

@luckashenri Thank you for interesting case!
Actually, angular remove elements from DOM and all events also removed.
Moreover, for new element scroll have to be re-initialized and events re-attached.

Solution

Change your function to:

ngAfterViewInit() {
    this.router.events.pipe(
      filter(event => event instanceof NavigationEnd)
    ).subscribe({
      next: async (value) => {
        await new Promise(resolve => requestAnimationFrame(resolve));
        this.myPane.scrollElementInit();
        this.myPane.checkOverflowAttr(this.myPane.breakpoints.currentBreakpoint);
        this.myPane.events.detachAllEvents();
        this.myPane.events.attachAllEvents();
      },
    });
}

Not a simple case, if there are more such re-renders for overflow-y element in the future, I will make some scoped functions to manage events re-attachments around the scroll element.

from panes.

luckashenri avatar luckashenri commented on May 27, 2024

@roman-rr Yeah just got a chance to test it, it worked!!
I just ran some tests and profilers and seems like that won't have an impact on performance as well. Thanks man!

from panes.

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.