honeynet / ochi

https://ochi.mushmush.org
GNU General Public License v3.0
25 stars 15 forks source link

Updated Stop auto-follow on scroll #21

Closed aditygrg2 closed 1 year ago

aditygrg2 commented 1 year ago

Added support for stopping events when scrolled, and re-starting on clicking on an button.

Issue : https://github.com/glaslos/ochi/issues/20

aditygrg2 commented 1 year ago

Hello @glaslos, please check this PR, and let me know if I understood the requirement correctly

aditygrg2 commented 1 year ago

Understood. I will update this PR accordingly

aditygrg2 commented 1 year ago

Hi @glaslos,

I have tried these things while solving this problem -

  1. I tried to control the scroll events through javascript, by analyzing that if the user is at the bottom (scrolled max), then I am updating the scroll values by maximum (scrollHeight - clientHeight), else the scroll value does not change and thus position remains intact. But this didn't work, as Svelte is updating changes but it is not considering and saving the scrolls, it is showing the element into view always.

  2. In other frameworks like react, we can pass keys so that the re-rendering effect does not change or modify other properties of DOM, but I think in svelte passing keys is only limited to adding/removing elements and rendering them only from DOM and not modifying other properties

  3. I tried modifying scroll-anchor property but still no success, as svelte was still scrolling as soon as the new event appears.

Can you please help me with any ideas or suggestions using which we can implement this?

glaslos commented 1 year ago

@aditygrg2 I will give it a try after work. Sounds odd that this is a problem with Svelte 🤔

glaslos commented 1 year ago

Have a look how it can be solve in #22

aditygrg2 commented 1 year ago

Yes, got it, it was simple, I was going the tough way. Closing this as the PR related to this issue #22 is there already.