New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

native scroll does not update getScrollPosition() unless scroll event is issued #6506

Closed
vance opened this Issue May 12, 2016 · 8 comments

Comments

Projects
None yet
5 participants
@vance
Copy link

vance commented May 12, 2016

Note: If you are having problems formatting your issue please refer to this article on using markdown in Github:

https://guides.github.com/features/mastering-markdown/

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

I have a timer check the position of an ion-scroll. I trace this to the screen. I need the realtime top/left values to compute other actions. This works fine in the browser using trackpad, however, on iOS, the value is only updated intermittently, which causes jumping and inconsistent behavior for my other maths. It seems to only update when the user is actively dragging, that is, it does not take into account the deceleration.

What behavior are you expecting?

I would expect it to be a continuous value when called from a setInterval(). I'd suggest having this function return both the target value and the current value as their own properties.

the getScrollPosition() should be continuously updated.

Steps to reproduce:

  1. print the value of left coordinate from a scrollDelegate to a fixed div so you can watch it's value in realtime
  2. scroll fast so there's deceleration
  3. note that the value does not update until you touch it again
insert any relevant code between the above and below backticks

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Which Ionic Version? 1.2.4

Plunker that shows an example of your issue

can't plunker, it's iOS only.

@vance

This comment has been minimized.

Copy link
Author

vance commented May 12, 2016

I see that getValues: function() does not call this.update() first like some of the other getters. Just a suggestion. I'll try it. update: nope, that did not work...

I may have a hacky workaround which is to simply measure the window-relative position of an element at [0,0] in the scroll area with the js api, divContainer.getBoundingClientRect().left but, of course values will be negative/inverse since they are relative to the window and not the content.

@vance

This comment has been minimized.

Copy link
Author

vance commented May 12, 2016

Even calling DOM API functions like divContainer.getBoundingClientRect().left; from a timer only works in the browser. On iOS, values don't update until the deceleration stops or you touch the pane. Is this a limitation of native scroll? how could one properly measure the position? This needs to be accurate as this is basically a map application.

@FlavorScape

This comment has been minimized.

Copy link

FlavorScape commented May 13, 2016

I would be satisfied if we could simply bubble this iOS UIScrollView property to ionic. How might I do that myself?

UIScrollView --> targetContentOffset

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScrollViewDelegate_Protocol/index.html#//apple_ref/doc/uid/TP40006923-CH3-SW15

@danielcrk-cn

This comment has been minimized.

Copy link

danielcrk-cn commented May 16, 2016

It would be amazing to be able to get native scroll events of the WebView, as it would probably support overscroll as well. Then we could be able to create alot more native-like "pull to refresh", create elastic headers etc.

@vance

This comment has been minimized.

Copy link
Author

vance commented May 25, 2016

Alas, native scroll crashes if you zoom out too far, so i'd like to adjust zoom while scrolling.... but i can't get continuous scroll events from native scroll :(

@vance

This comment has been minimized.

Copy link
Author

vance commented Oct 27, 2016

Anything? I'm still having this issue with Ionic.

@jgw96

This comment has been minimized.

Copy link
Contributor

jgw96 commented Apr 14, 2017

This issue was moved to ionic-team/ionic-v1#243

@jgw96 jgw96 closed this Apr 14, 2017

@ionitron-bot

This comment has been minimized.

Copy link

ionitron-bot bot commented Sep 3, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.