Repository navigation
Improve ViewBox and support of pointers for transformed views - #2392
Conversation
|
Note: This PR currently includes the changes of #2249 which is expected to be merged before merging this one! [EDIT] ==> Now ready to review :) |
d3c53bf to
841b734
Compare
|
/app run |
jeromelaban
left a comment
There was a problem hiding this comment.
A unit/runtime test for the transform may be interesting.
| // (For instance on a HOVER_MOVE, if the pointer goes out of the current "cached target" we still make sure to | ||
| // send it to this "cached target" the event in order to raise the HOVER_EXIT) | ||
| private View _cachedTarget; | ||
| final View getCachedTarget() { return _cachedTarget; } |
There was a problem hiding this comment.
Kind of, as this "current" is relative to a given sequence (down / move / up or hover enter / move / exit) and it might be cleared depending of various factor (for instance when moving pointer over a sibling). I preferred the name "cached" as it really just to avoid re-calculation in that case ... but meh 🤷♂️ ...
There was a problem hiding this comment.
I will rename it in my next PR (multi touch) as I also change this file.
|
/azp run |
| { | ||
| private readonly double _epsilon; | ||
|
|
||
| public static RectCloseComparer Default { get; } = new RectCloseComparer(double.Epsilon); |
There was a problem hiding this comment.
I guess you're probably not using this one, but be aware that double.Epsilon is not a good epsilon ;) (It's much smaller than 'machine epsilon')
There was a problem hiding this comment.
Yeah ... I learned it the hard way since a while ;)
|
|
||
| final boolean isDown = event.getAction() == MotionEvent.ACTION_DOWN; | ||
| if (isDown) { | ||
| final boolean isBeginOfSequence = isDown || event.getAction() == MotionEvent.ACTION_HOVER_ENTER; |
There was a problem hiding this comment.
| final boolean isBeginOfSequence = isDown || event.getAction() == MotionEvent.ACTION_HOVER_ENTER; | |
| final boolean isBeginningOfSequence = isDown || event.getAction() == MotionEvent.ACTION_HOVER_ENTER; |
There was a problem hiding this comment.
Yes makes sense!
But like the comment from Jérôme, I'll fix it in my next PR as I already did some changes in that file (and especially I changed this variable usage).
| final boolean isDown = event.getAction() == MotionEvent.ACTION_DOWN; | ||
| if (isDown) { | ||
| final boolean isBeginOfSequence = isDown || event.getAction() == MotionEvent.ACTION_HOVER_ENTER; | ||
| if (isBeginOfSequence) { |
There was a problem hiding this comment.
| if (isBeginOfSequence) { | |
| if (isBeginningOfSequence) { |
| } | ||
|
|
||
| if (isDown && !isMotionInView(event, view)) { | ||
| if (isBeginOfSequence && !isMotionInView(event, view)) { |
There was a problem hiding this comment.
| if (isBeginOfSequence && !isMotionInView(event, view)) { | |
| if (isBeginningOfSequence && !isMotionInView(event, view)) { |
| // to other controls. | ||
| // Note: We do this check only when starting a new manipulation (isDown), so the whole down->move->up sequence is ignored; | ||
| // Warning: We should also do this check for events that does not have strong sequence concept (e.g. Hover) | ||
| // Note: We do this check only when starting a new manipulation (isBeginOfSequence), so the whole down->move->up sequence is ignored; |
There was a problem hiding this comment.
| // Note: We do this check only when starting a new manipulation (isBeginOfSequence), so the whole down->move->up sequence is ignored; | |
| // Note: We do this check only when starting a new manipulation (isBeginningOfSequence), so the whole down->move->up sequence is ignored; |
…re to follow the "sequence" concept of events (Especially, raise the pointer over exit)
… get the real transform between elements)
…the real position when in a ViewBox
…NaN in desired size.
|
/azp run |
|
The build 11315 found UI Test snapshots differences.
|
|
The build 11332 found UI Test snapshots differences.
|
|
This is also expected to fix https://stackoverflow.com/questions/59027861/content-not-centered-in-viewbox-and-incorect-mouse-coord-in-viewbox/59180616
|
GitHub Issue:
fixes #2257
fixes #2256
fixes #2135
#2266
Bugfix / Feature
Improve the ViewBox to better support new pointer events
What is the current behavior?
RenderTransform)ViewBoxalters theRenderTransformof itsChildViewBoxare not the same as UWP (centered / centered)UIElement.TransformToVisual. On iOS and Android the implementation are only applying a translate of the bounds, but does not apply the full transformation.What is the new behavior?
UIElement.TransformToVisualhas been multi-targeted and pointer events are now using it on each platform to compute theLocationof the pointer relative to another control.PR Checklist
Screenshots Compare Test Runresults.