Closed cpetrov closed 5 years ago
Agreed on the usability... On Android you can get the absolute coordinates of a view on screen. How about iOS @patrykmol?
It is possible but has always been problematic on iOS (lots of calculations).
We plan on an absoluteBounds
property that returns bounds relative to the contentView.
👍 We could also use this in some of our projects.
I think this could be implemented easily in JS only, if the existing bound property is precise enough and we limit it to descendants of contentView. I think it should be method though, relativeBounds(someOtherWidget)
.
Android has the methods https://developer.android.com/reference/android/view/View#getLocationOnScreen(int[]) and https://developer.android.com/reference/android/view/View#getLocationInWindow(int[]) which will be faster than doing it in js.
Any word on this? In my use case, since negative edge offsets are no longer supported, this would really make my life easier.
Negative bounds have never been supported on Android. We added clarified this in the documentation accordingly. The idea to get the view bounds is still valid though. For the moment you could traverse up the view hierarchy in a resize
callback and add up the top/left coordinates.
Implemented in a9c2bb2d874a8ba52e92b4a3c2bfc0460af49eb0
@cookieguru Thanks for the heads up. Closing as resolved.
Currently laid out widget coordinates relative to its parent are exposed by the
bounds
property. Access to absolute position of a widget on the screen may be useful for advanced animations.Use case example: scroll view with complex layout. Goal: pop-up animation, scaling an arbitrary scroll view child widget to fit the screen (e.g. modal image details view with a fluid animation). Implementation suggestion:
false
.Currently (1) is only possible by manually calculating the absolute coordinates of the widget (not easy with complex layouts) respecting the current scroll position.