-
Notifications
You must be signed in to change notification settings - Fork 62
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
Fix drag vs align #585
Fix drag vs align #585
Conversation
val positionInside = motionPropertyRenderValue<Value, PositionInside>() | ||
val positionOutside = motionPropertyRenderValue<PositionOutside.Value, PositionOutside>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about importing PositionInside.Value
and PositionOutside.Value
using aliases to make this code more orthogonal? Something like this:
import com.bumble.appyx.interactions.core.ui.property.impl.position.PositionInside.Value as PositionInsideValue
import com.bumble.appyx.interactions.core.ui.property.impl.position.PositionOutside.Value as PositionOutsideValue
// ...
val positionInside = motionPropertyRenderValue<PositionInsideValue, PositionInside>()
val positionOutside = motionPropertyRenderValue<PositionOutsideValue, PositionOutside>()
val positionInside = motionPropertyRenderValue<Value, PositionInside>() | ||
val positionOutside = motionPropertyRenderValue<PositionOutside.Value, PositionOutside>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same could be applied here.
} | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
private fun elementOffset( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about moving this elementOffset
composable somewhere common but internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As part of #534 we can keep only one rather than moving out.
Description
Related to #539
Issue that arose in that PR's context
boundsInParent()
gives an offset relative to 0,0 in parent – this offset is what we use to setup the gesture detection area.align()
, if present in theelementUiModel
modifiers will also affect the gesture detection area's alignment though, and we can't turn it off, because:.align()
can only be set once in compose (or more precisely, the first one takes priority, any subsequent invocations are ignored), which means we couldn't do the same trick as with offset (+offset, gesture, -offset) to temporarily disable alignmentboundsInParent()
offset is always relative to 0,0 whereas it should be relative to the alignment point, resulting in a wrong target area being calculatedApproach that was implemented instead:
Box
was extracted fromChild
to apply the gesture detection on – this way it can remain unaffected by alignment changeThe problem with the approach
Child
has any gesture-related code (e.g. click), pointer input handling can't properly reach theBox
by bubbling up, since it's not a parent toChild
but a sibling in the hierarchyAppyxComponent
would break in this case and no longer do anythingNew solution
PositionInside
/PositionOutside
MotionProperty
are presentResult
...
Check list
CHANGELOG.md
if required.