Thiago
03/24/2020, 6:26 PMdata class LayoutFractional(val dx: Float, val dy: Float) : LayoutModifier {
override fun ModifierScope.modifyPosition(
childSize: IntPxSize,
containerSize: IntPxSize
): IntPxPosition = IntPxPosition(
x = childSize.width * dx.coerceIn(MIN_FRACTION, MAX_FRACTION) *
if (layoutDirection == LayoutDirection.Ltr) MAX_FRACTION else MIN_FRACTION,
y = childSize.height * dy.coerceIn(MIN_FRACTION, MAX_FRACTION)
)
companion object {
private const val MAX_FRACTION = 1f
private const val MIN_FRACTION = -1f
val Origin = LayoutFractional(0f, 0f)
}
}
Adam Powell
03/24/2020, 7:45 PMThiago
03/24/2020, 7:57 PMAdam Powell
03/24/2020, 8:07 PMThiago
03/24/2020, 8:12 PMAdam Powell
03/24/2020, 9:09 PMMihai Popa
03/26/2020, 3:27 PMcontainerSize - childSize
? In this case I agree it would make sense to have itThiago
03/26/2020, 11:24 PM