Replace PxPosition with Offset
Relnote: "In order to consolidate the
number of classes used to represent
positioning information, standardize
on usage of the Offset class instead
of PxPosition. This provides the benefits
of an inline class to leverage a long
to pack 2 float values to represent x
and y offsets represented as floats."
Bug: 157948366
Test: re-ran compose tests
Change-Id: I3ad983207bc37af20afac03e2cd09b4240777687
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
index a7a38fb..9b3fb3e 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/text/ParagraphMethodBenchmark.kt
@@ -20,7 +20,7 @@
import androidx.benchmark.junit4.measureRepeated
import androidx.test.filters.LargeTest
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.sp
import androidx.ui.integration.test.RandomTextGenerator
import androidx.ui.integration.test.TextBenchmarkTestRule
@@ -164,7 +164,7 @@
fun getOffsetForPosition() {
textBenchmarkRule.generator { generator ->
val paragraph = paragraph(generator)
- val centerPosition = PxPosition(paragraph.width / 2, paragraph.height / 2)
+ val centerPosition = Offset(paragraph.width / 2, paragraph.height / 2)
benchmarkRule.measureRepeated {
paragraph.getOffsetForPosition(centerPosition)
}
diff --git a/ui/ui-android-view/integration-tests/android-view-demos/src/main/java/androidx/ui/androidview/demos/PointerInputInteropAndroidInCompose.kt b/ui/ui-android-view/integration-tests/android-view-demos/src/main/java/androidx/ui/androidview/demos/PointerInputInteropAndroidInCompose.kt
index 4229802..cdaae2a 100644
--- a/ui/ui-android-view/integration-tests/android-view-demos/src/main/java/androidx/ui/androidview/demos/PointerInputInteropAndroidInCompose.kt
+++ b/ui/ui-android-view/integration-tests/android-view-demos/src/main/java/androidx/ui/androidview/demos/PointerInputInteropAndroidInCompose.kt
@@ -37,7 +37,7 @@
import androidx.ui.layout.preferredHeight
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.viewinterop.AndroidView
@@ -90,7 +90,7 @@
private fun AndroidTapInComposeTap() {
var theView: View? = null
- val onTap: (PxPosition) -> Unit = {
+ val onTap: (Offset) -> Unit = {
theView?.setBackgroundColor(Color.BLUE)
}
diff --git a/ui/ui-animation/api/0.1.0-dev14.txt b/ui/ui-animation/api/0.1.0-dev14.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/0.1.0-dev14.txt
+++ b/ui/ui-animation/api/0.1.0-dev14.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/current.txt b/ui/ui-animation/api/current.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/current.txt
+++ b/ui/ui-animation/api/current.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev14.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_current.txt b/ui/ui-animation/api/public_plus_experimental_current.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/public_plus_experimental_current.txt
+++ b/ui/ui-animation/api/public_plus_experimental_current.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/restricted_0.1.0-dev14.txt b/ui/ui-animation/api/restricted_0.1.0-dev14.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-animation/api/restricted_0.1.0-dev14.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/api/restricted_current.txt b/ui/ui-animation/api/restricted_current.txt
index 2eaf1a9..cca0e95 100644
--- a/ui/ui-animation/api/restricted_current.txt
+++ b/ui/ui-animation/api/restricted_current.txt
@@ -64,19 +64,19 @@
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.IntPx,androidx.animation.AnimationVector1D> getIntPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.Position,androidx.animation.AnimationVector2D> getPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxBounds,androidx.animation.AnimationVector4D> getPxBoundsToVectorConverter();
- method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
+ method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getPxPositionToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.unit.PxSize,androidx.animation.AnimationVector2D> getPxSizeToVectorConverter();
method public static androidx.animation.TwoWayConverter<java.lang.Float,androidx.animation.AnimationVector1D> getPxToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Rect,androidx.animation.AnimationVector4D> getRectToVectorConverter();
method public static androidx.animation.TwoWayConverter<androidx.ui.geometry.Size,androidx.animation.AnimationVector2D> getSizeToVectorConverter();
}
- public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> {
+ public final class PxPositionPropKey implements androidx.animation.PropKey<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> {
ctor public PxPositionPropKey(String label);
ctor public PxPositionPropKey();
method public String getLabel();
- method public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> getTypeConverter();
- property public androidx.animation.TwoWayConverter<androidx.ui.unit.PxPosition,androidx.animation.AnimationVector2D> typeConverter;
+ method public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> getTypeConverter();
+ property public androidx.animation.TwoWayConverter<androidx.ui.geometry.Offset,androidx.animation.AnimationVector2D> typeConverter;
}
public final class PxPropKey implements androidx.animation.PropKey<java.lang.Float,androidx.animation.AnimationVector1D> {
@@ -108,9 +108,9 @@
method @androidx.compose.Composable public static androidx.ui.unit.PxSize animate(androidx.ui.unit.PxSize target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxSize> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxSize,kotlin.Unit>? endListener = null);
- method @androidx.compose.Composable public static androidx.ui.unit.PxPosition animate(androidx.ui.unit.PxPosition target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxPosition> animBuilder = remember({
+ method @androidx.compose.Composable public static androidx.ui.geometry.Offset animate(androidx.ui.geometry.Offset target, androidx.animation.AnimationBuilder<androidx.ui.geometry.Offset> animBuilder = remember({
return <init>()
-}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? endListener = null);
+}), kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? endListener = null);
method @androidx.compose.Composable public static androidx.ui.unit.PxBounds animate(androidx.ui.unit.PxBounds target, androidx.animation.AnimationBuilder<androidx.ui.unit.PxBounds> animBuilder = remember({
return <init>()
}), kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxBounds,kotlin.Unit>? endListener = null);
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
index 3adf558..38879ec 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/AnimatableSeekBarDemo.kt
@@ -42,7 +42,6 @@
import androidx.ui.layout.padding
import androidx.ui.layout.preferredHeight
import androidx.ui.layout.preferredSize
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.sp
@@ -98,13 +97,13 @@
val animValue = animatedFloat(0f)
val dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
animValue.snapTo(animValue.targetValue + dragDistance.x)
return dragDistance
}
}
- val onPress: (PxPosition) -> Unit = { position ->
+ val onPress: (Offset) -> Unit = { position ->
animValue.animateTo(position.x,
TweenBuilder<Float>().apply {
duration = 400
@@ -127,7 +126,7 @@
clock.clockTimeMillis = (400 * (x / size.width)).toLong().coerceIn(0, 399)
// draw bar
val barHeight = 10.0f
- val offset = Offset(0.0f, center.dy - 5)
+ val offset = Offset(0.0f, center.y - 5)
drawRect(
Color.Gray,
topLeft = offset,
@@ -142,7 +141,7 @@
// draw ticker
drawCircle(
Color.Magenta,
- center = Offset(xConstraint, center.dy),
+ center = Offset(xConstraint, center.y),
radius = 40f
)
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
index 5d4356d..aba57ba 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/FancyScrollingDemo.kt
@@ -37,7 +37,6 @@
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
import androidx.ui.layout.preferredHeight
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.sp
import kotlin.math.roundToInt
@@ -53,13 +52,13 @@
val animScroll = animatedFloat(0f)
val itemWidth = state { 0f }
val gesture = Modifier.rawDragGestureFilter(dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
// Snap to new drag position
animScroll.snapTo(animScroll.value + dragDistance.x)
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
// Uses default decay animation to calculate where the fling will settle,
// and adjust that position as needed. The target animation will be used for
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
index 17872f7..9926cfb 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/GestureBasedAnimationDemo.kt
@@ -75,7 +75,7 @@
Canvas(modifier.fillMaxSize()) {
drawRect(
color,
- topLeft = Offset(center.dx - halfSize * scale, center.dy - halfSize * scale),
+ topLeft = Offset(center.x - halfSize * scale, center.y - halfSize * scale),
size = Size(halfSize * 2 * scale, halfSize * 2 * scale)
)
}
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
index 128778a..f5cd62d 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SpringBackScrollingDemo.kt
@@ -37,7 +37,6 @@
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
import androidx.ui.layout.preferredHeight
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.sp
import kotlin.math.roundToInt
@@ -54,12 +53,12 @@
val itemWidth = state { 0f }
val isFlinging = state { false }
val gesture = Modifier.rawDragGestureFilter(dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
animScroll.snapTo(animScroll.targetValue + dragDistance.x)
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
isFlinging.value = true
animScroll.fling(velocity.x, _, _, _ ->
isFlinging.value = false
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
index 800f557..e0c3b41 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/StateBasedRippleDemo.kt
@@ -34,7 +34,6 @@
import androidx.ui.geometry.Offset
import androidx.ui.graphics.Color
import androidx.ui.layout.fillMaxSize
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
@Composable
@@ -49,7 +48,7 @@
val radius = with(DensityAmbient.current) { TargetRadius.toPx() }
val toState = state { ButtonStatus.Initial }
val rippleTransDef = remember { createTransDef(radius) }
- val onPress: (PxPosition) -> Unit = { position ->
+ val onPress: (Offset) -> Unit = { position ->
down.x = position.x
down.y = position.y
toState.value = ButtonStatus.Pressed
diff --git a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
index 91df541..ac5cb2ff 100644
--- a/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
+++ b/ui/ui-animation/integration-tests/animation-demos/src/main/java/androidx/ui/animation/demos/SwipeToDismissDemo.kt
@@ -40,7 +40,6 @@
import androidx.ui.layout.fillMaxWidth
import androidx.ui.layout.padding
import androidx.ui.layout.preferredHeight
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.sp
import kotlin.math.sign
@@ -68,7 +67,7 @@
val itemWidth = state { 0f }
val isFlinging = state { false }
val modifier = Modifier.rawDragGestureFilter(dragObserver = object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
itemBottom.setBounds(0f, height)
if (isFlinging.value && itemBottom.targetValue < 100f) {
reset()
@@ -83,7 +82,7 @@
}
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
itemBottom.snapTo(itemBottom.targetValue + dragDistance.y)
return dragDistance
}
@@ -105,7 +104,7 @@
}
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
isFlinging.value = true
itemBottom.fling(velocity.y,
ExponentialDecay(3.0f),
@@ -143,11 +142,11 @@
height: Float,
index: Int
) {
- val offset = Offset(center.dx - width * 1.5f + horizontalOffset + padding, size.height - height)
+ val offset = Offset(center.x - width * 1.5f + horizontalOffset + padding, size.height - height)
val rectSize = Size(width - (2 * padding), height)
drawRect(colors[index % colors.size], offset, rectSize)
- if (offset.dx >= 0) {
+ if (offset.x >= 0) {
// draw another item
drawRect(
colors[(index - 1 + colors.size) % colors.size],
@@ -165,7 +164,7 @@
alpha: Float
) = drawRect(
colors[index % colors.size],
- topLeft = Offset(center.dx - width / 2 + padding, bottom - height),
+ topLeft = Offset(center.x - width / 2 + padding, bottom - height),
size = Size(width - (2 * padding), height),
alpha = alpha
)
diff --git a/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt b/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
index 43a1252..a5b20e0 100644
--- a/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
+++ b/ui/ui-animation/src/androidTest/java/androidx/ui/animation/SingleValueAnimationTest.kt
@@ -40,7 +40,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.Position
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.util.lerp
@@ -148,7 +148,7 @@
PxPositionToVectorConverter.convertFromVector(endVal)
else
PxPositionToVectorConverter.convertFromVector(startVal),
- TweenBuilder<PxPosition>().apply(animConfig)
+ TweenBuilder<Offset>().apply(animConfig)
)
pxSizeValue = animate(
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
index 9d88296..d0da9e3 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/PropertyKeys.kt
@@ -34,7 +34,7 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Position
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -59,13 +59,13 @@
}
/**
- * Built-in property key for [PxPosition] properties.
+ * Built-in property key for [Offset] properties.
*
* @param label Label for distinguishing different prop keys in Android Studio.
*/
class PxPositionPropKey(
override val label: String = "PxPositionPropKey"
-) : PropKey<PxPosition, AnimationVector2D> {
+) : PropKey<Offset, AnimationVector2D> {
override val typeConverter = PxPositionToVectorConverter
}
@@ -177,12 +177,12 @@
)
/**
- * A type converter that converts a [PxPosition] to a [AnimationVector2D], and vice versa.
+ * A type converter that converts a [Offset] to a [AnimationVector2D], and vice versa.
*/
-val PxPositionToVectorConverter: TwoWayConverter<PxPosition, AnimationVector2D> =
+val PxPositionToVectorConverter: TwoWayConverter<Offset, AnimationVector2D> =
TwoWayConverter(
convertToVector = { AnimationVector2D(it.x, it.y) },
- convertFromVector = { PxPosition(it.v1, it.v2) }
+ convertFromVector = { Offset(it.v1, it.v2) }
)
/**
diff --git a/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt b/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
index daece9f..3667491 100644
--- a/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
+++ b/ui/ui-animation/src/main/java/androidx/ui/animation/SingleValueAnimation.kt
@@ -38,7 +38,7 @@
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.Position
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
private const val DpVisibilityThreshold = 0.1f
@@ -294,15 +294,15 @@
}
/**
- * Fire-and-forget animation [Composable] for [PxPosition]. Once such an animation is created, it
+ * Fire-and-forget animation [Composable] for [Offset]. Once such an animation is created, it
* will be positionally memoized, like other @[Composable]s. To trigger the animation, or alter the
* course of the animation, simply supply a different [target] to the [Composable].
*
* Note, [animate] is for simple animations that cannot be canceled. For cancellable animations
* see [animatedValue].
*
- * val position : PxPosition = animate(
- * if (selected) PxPosition(0.px, 0.px) else PxPosition(20.px, 20.px))
+ * val position : Offset = animate(
+ * if (selected) Offset(0.px, 0.px) else Offset(20.px, 20.px))
*
* @param target Target value of the animation
* @param animBuilder The animation that will be used to change the value through time. Physics
@@ -311,10 +311,10 @@
*/
@Composable
fun animate(
- target: PxPosition,
- animBuilder: AnimationBuilder<PxPosition> = remember { PhysicsBuilder() },
- endListener: ((PxPosition) -> Unit)? = null
-): PxPosition {
+ target: Offset,
+ animBuilder: AnimationBuilder<Offset> = remember { PhysicsBuilder() },
+ endListener: ((Offset) -> Unit)? = null
+): Offset {
return animate(
target, PxPositionToVectorConverter, animBuilder, PxVisibilityThreshold2D, endListener)
}
diff --git a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
index 4853a3a..05e03eb 100644
--- a/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
+++ b/ui/ui-animation/src/test/java/androidx/ui/animation/ConverterTest.kt
@@ -22,7 +22,7 @@
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Color
import androidx.ui.graphics.colorspace.ColorSpaces
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import junit.framework.TestCase.assertEquals
import org.junit.Test
@@ -72,9 +72,9 @@
fun testPxPositionConverter() {
val x = Random.nextFloat()
val y = Random.nextFloat()
- assertEquals(PxPosition(x, y),
+ assertEquals(Offset(x, y),
PxPositionToVectorConverter.convertFromVector(AnimationVector2D(x, y)))
assertEquals(AnimationVector2D(x, y),
- PxPositionToVectorConverter.convertToVector(PxPosition(x, y)))
+ PxPositionToVectorConverter.convertToVector(Offset(x, y)))
}
}
\ No newline at end of file
diff --git a/ui/ui-core/api/0.1.0-dev14.txt b/ui/ui-core/api/0.1.0-dev14.txt
index 043fb0f..c2a8a79 100644
--- a/ui/ui-core/api/0.1.0-dev14.txt
+++ b/ui/ui-core/api/0.1.0-dev14.txt
@@ -227,13 +227,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -371,15 +371,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -390,9 +390,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -441,7 +441,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -714,9 +714,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -754,14 +754,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -775,8 +775,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -937,7 +937,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -946,9 +946,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -965,18 +965,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -984,7 +984,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1017,7 +1017,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1053,7 +1053,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1739,9 +1739,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1843,7 +1843,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1855,7 +1855,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/api/current.txt b/ui/ui-core/api/current.txt
index 043fb0f..c2a8a79 100644
--- a/ui/ui-core/api/current.txt
+++ b/ui/ui-core/api/current.txt
@@ -227,13 +227,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -371,15 +371,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -390,9 +390,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -441,7 +441,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -714,9 +714,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -754,14 +754,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -775,8 +775,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -937,7 +937,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -946,9 +946,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -965,18 +965,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -984,7 +984,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1017,7 +1017,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1053,7 +1053,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1739,9 +1739,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1843,7 +1843,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1855,7 +1855,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
index 1a3e628..5beaff1 100644
--- a/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-core/api/public_plus_experimental_0.1.0-dev14.txt
@@ -227,13 +227,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -372,15 +372,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -391,9 +391,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -442,7 +442,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -716,9 +716,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -756,14 +756,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -777,8 +777,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -939,7 +939,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -948,9 +948,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -967,18 +967,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -986,7 +986,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1019,7 +1019,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1055,7 +1055,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1741,9 +1741,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1845,7 +1845,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1857,7 +1857,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/api/public_plus_experimental_current.txt b/ui/ui-core/api/public_plus_experimental_current.txt
index 1a3e628..5beaff1 100644
--- a/ui/ui-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-core/api/public_plus_experimental_current.txt
@@ -227,13 +227,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -372,15 +372,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -391,9 +391,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -442,7 +442,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -716,9 +716,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -756,14 +756,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -777,8 +777,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -939,7 +939,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -948,9 +948,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -967,18 +967,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -986,7 +986,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1019,7 +1019,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1055,7 +1055,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1741,9 +1741,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1845,7 +1845,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1857,7 +1857,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/api/restricted_0.1.0-dev14.txt b/ui/ui-core/api/restricted_0.1.0-dev14.txt
index 7080fac..5247534 100644
--- a/ui/ui-core/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-core/api/restricted_0.1.0-dev14.txt
@@ -233,13 +233,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -422,15 +422,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -441,9 +441,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -492,7 +492,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -768,9 +768,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -808,14 +808,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -829,8 +829,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -991,7 +991,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -1000,9 +1000,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -1019,18 +1019,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -1038,7 +1038,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1071,7 +1071,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1107,7 +1107,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1793,9 +1793,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1897,7 +1897,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1909,7 +1909,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/api/restricted_current.txt b/ui/ui-core/api/restricted_current.txt
index 7080fac..5247534 100644
--- a/ui/ui-core/api/restricted_current.txt
+++ b/ui/ui-core/api/restricted_current.txt
@@ -233,13 +233,13 @@
}
@androidx.compose.Immutable public final class ConsumedData {
- ctor public ConsumedData(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ ctor public ConsumedData(androidx.ui.geometry.Offset positionChange, boolean downChange);
ctor public ConsumedData();
- method public androidx.ui.unit.PxPosition component1();
+ method public androidx.ui.geometry.Offset component1();
method public boolean component2();
- method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.unit.PxPosition positionChange, boolean downChange);
+ method @androidx.compose.Immutable public androidx.ui.core.ConsumedData copy(androidx.ui.geometry.Offset positionChange, boolean downChange);
method public boolean getDownChange();
- method public androidx.ui.unit.PxPosition getPositionChange();
+ method public androidx.ui.geometry.Offset getPositionChange();
}
public abstract class ContentDrawScope extends androidx.ui.graphics.drawscope.DrawScope {
@@ -422,15 +422,15 @@
public interface LayoutCoordinates {
method public androidx.ui.unit.PxBounds childBoundingBox(androidx.ui.core.LayoutCoordinates child);
- method public androidx.ui.unit.PxPosition childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.unit.PxPosition childLocal);
+ method public androidx.ui.geometry.Offset childToLocal(androidx.ui.core.LayoutCoordinates child, androidx.ui.geometry.Offset childLocal);
method public operator androidx.ui.unit.IntPx? get(androidx.ui.core.AlignmentLine line);
method public androidx.ui.core.LayoutCoordinates? getParentCoordinates();
method public java.util.Set<androidx.ui.core.AlignmentLine> getProvidedAlignmentLines();
method public androidx.ui.unit.IntPxSize getSize();
- method public androidx.ui.unit.PxPosition globalToLocal(androidx.ui.unit.PxPosition global);
+ method public androidx.ui.geometry.Offset globalToLocal(androidx.ui.geometry.Offset global);
method public boolean isAttached();
- method public androidx.ui.unit.PxPosition localToGlobal(androidx.ui.unit.PxPosition local);
- method public androidx.ui.unit.PxPosition localToRoot(androidx.ui.unit.PxPosition local);
+ method public androidx.ui.geometry.Offset localToGlobal(androidx.ui.geometry.Offset local);
+ method public androidx.ui.geometry.Offset localToRoot(androidx.ui.geometry.Offset local);
property public abstract boolean isAttached;
property public abstract androidx.ui.core.LayoutCoordinates? parentCoordinates;
property public abstract java.util.Set<androidx.ui.core.AlignmentLine> providedAlignmentLines;
@@ -441,9 +441,9 @@
method public static androidx.ui.unit.PxBounds getBoundsInParent(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getBoundsInRoot(androidx.ui.core.LayoutCoordinates);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getGlobalPosition(androidx.ui.core.LayoutCoordinates);
- method public static androidx.ui.unit.PxPosition getPositionInParent(androidx.ui.core.LayoutCoordinates);
- method public static inline androidx.ui.unit.PxPosition getPositionInRoot(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getGlobalPosition(androidx.ui.core.LayoutCoordinates);
+ method public static androidx.ui.geometry.Offset getPositionInParent(androidx.ui.core.LayoutCoordinates);
+ method public static inline androidx.ui.geometry.Offset getPositionInRoot(androidx.ui.core.LayoutCoordinates);
}
public final class LayoutKt {
@@ -492,7 +492,7 @@
method public boolean getPositionedDuringMeasurePass();
method public androidx.ui.core.Ref<androidx.ui.core.LayoutNode>? getRef();
method public int getWidth();
- method public boolean hitTest(androidx.ui.unit.PxPosition pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
+ method public boolean hitTest(androidx.ui.geometry.Offset pointerPositionRelativeToScreen, java.util.List<androidx.ui.core.pointerinput.PointerInputFilter> hitPointerInputFilters);
method public void ignoreModelReads(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void insertAt(int index, androidx.ui.core.LayoutNode instance);
method public boolean isLayingOut();
@@ -768,9 +768,9 @@
method public abstract androidx.ui.core.LayoutDirection getParentLayoutDirection();
method public abstract int getParentWidth();
method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
- method public final void place(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void place(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void place-sXe7h04(androidx.ui.core.Placeable, int x, int y);
- method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.PxPosition position);
+ method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.geometry.Offset position);
method public final void placeAbsolute(androidx.ui.core.Placeable, androidx.ui.unit.IntPxPosition position);
method public final void placeAbsolute-sXe7h04(androidx.ui.core.Placeable, int x, int y);
property public abstract androidx.ui.core.LayoutDirection parentLayoutDirection;
@@ -808,14 +808,14 @@
}
@androidx.compose.Immutable public final class PointerInputData {
- ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ ctor public PointerInputData(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
ctor public PointerInputData();
method public androidx.ui.unit.Uptime? component1();
- method public androidx.ui.unit.PxPosition? component2();
+ method public androidx.ui.geometry.Offset? component2();
method public boolean component3();
- method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.unit.PxPosition? position, boolean down);
+ method @androidx.compose.Immutable public androidx.ui.core.PointerInputData copy(androidx.ui.unit.Uptime? uptime, androidx.ui.geometry.Offset? position, boolean down);
method public boolean getDown();
- method public androidx.ui.unit.PxPosition? getPosition();
+ method public androidx.ui.geometry.Offset? getPosition();
method public androidx.ui.unit.Uptime? getUptime();
}
@@ -829,8 +829,8 @@
method public static androidx.ui.core.PointerInputChange consumeAllChanges(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumeDownChange(androidx.ui.core.PointerInputChange);
method public static androidx.ui.core.PointerInputChange consumePositionChange(androidx.ui.core.PointerInputChange, float consumedDx, float consumedDy);
- method public static androidx.ui.unit.PxPosition positionChange(androidx.ui.core.PointerInputChange);
- method public static androidx.ui.unit.PxPosition positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChange(androidx.ui.core.PointerInputChange);
+ method public static androidx.ui.geometry.Offset positionChangeIgnoreConsumed(androidx.ui.core.PointerInputChange);
method public static boolean positionChanged(androidx.ui.core.PointerInputChange);
method public static boolean positionChangedIgnoreConsumed(androidx.ui.core.PointerInputChange);
}
@@ -991,7 +991,7 @@
}
public final class DoubleTapGestureFilterKt {
- method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onDoubleTap);
+ method public static androidx.ui.core.Modifier doubleTapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onDoubleTap);
}
public final class DragGestureFilterKt {
@@ -1000,9 +1000,9 @@
public interface DragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
- method public default void onStart(androidx.ui.unit.PxPosition downPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
+ method public default void onStart(androidx.ui.geometry.Offset downPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class DragSlopExceededGestureFilterKt {
@@ -1019,18 +1019,18 @@
public interface LongPressDragObserver {
method public default void onCancel();
- method public default androidx.ui.unit.PxPosition onDrag(androidx.ui.unit.PxPosition dragDistance);
+ method public default androidx.ui.geometry.Offset onDrag(androidx.ui.geometry.Offset dragDistance);
method public default void onDragStart();
- method public default void onLongPress(androidx.ui.unit.PxPosition pxPosition);
- method public default void onStop(androidx.ui.unit.PxPosition velocity);
+ method public default void onLongPress(androidx.ui.geometry.Offset pxPosition);
+ method public default void onStop(androidx.ui.geometry.Offset velocity);
}
public final class LongPressGestureFilterKt {
- method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onLongPress);
+ method public static androidx.ui.core.Modifier longPressGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onLongPress);
}
public final class PressIndicatorGestureFilterKt {
- method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
+ method public static androidx.ui.core.Modifier pressIndicatorGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? kotlin.jvm.functions.Function0<kotlin.Unit>? boolean enabled = true);
}
public final class RawDragGestureFilterKt {
@@ -1038,7 +1038,7 @@
}
public final class RawPressStartGestureFilterKt {
- method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
+ method public static androidx.ui.core.Modifier rawPressStartGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onPressStart, boolean enabled = false, androidx.ui.core.PointerEventPass executionPass = androidx.ui.core.PointerEventPass.PostUp);
}
public final class RawScaleGestureFilterKt {
@@ -1071,7 +1071,7 @@
}
public final class TapGestureFilterKt {
- method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> onTap);
+ method public static androidx.ui.core.Modifier tapGestureFilter(androidx.ui.core.Modifier, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> onTap);
}
}
@@ -1107,7 +1107,7 @@
public final class VelocityTracker {
ctor public VelocityTracker();
- method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.unit.PxPosition position);
+ method public void addPosition(androidx.ui.unit.Uptime uptime, androidx.ui.geometry.Offset position);
method public androidx.ui.unit.Velocity calculateVelocity();
method public void resetTracking();
}
@@ -1793,9 +1793,9 @@
public interface Selectable {
method public androidx.ui.geometry.Rect getBoundingBox(int offset);
- method public androidx.ui.unit.PxPosition getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
+ method public androidx.ui.geometry.Offset getHandlePosition(androidx.ui.core.selection.Selection selection, boolean isStartHandle);
method public androidx.ui.core.LayoutCoordinates? getLayoutCoordinates();
- method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.unit.PxPosition startPosition, androidx.ui.unit.PxPosition endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
+ method public androidx.ui.core.selection.Selection? getSelection(androidx.ui.geometry.Offset startPosition, androidx.ui.geometry.Offset endPosition, androidx.ui.core.LayoutCoordinates containerLayoutCoordinates, boolean longPress, androidx.ui.core.selection.Selection? previousSelection = null, boolean isStartHandle = true);
method public androidx.ui.text.AnnotatedString getText();
}
@@ -1897,7 +1897,7 @@
method public androidx.ui.core.LayoutNode getComponentNode();
method public androidx.ui.core.semantics.SemanticsConfiguration getConfig();
method public androidx.ui.unit.PxBounds getGlobalBounds();
- method public androidx.ui.unit.PxPosition getGlobalPosition();
+ method public androidx.ui.geometry.Offset getGlobalPosition();
method public boolean getHasChildren();
method public int getId();
method public androidx.ui.core.semantics.SemanticsNode? getParent();
@@ -1909,7 +1909,7 @@
property public final java.util.List<androidx.ui.core.semantics.SemanticsNode> children;
property public final androidx.ui.core.semantics.SemanticsConfiguration config;
property public final androidx.ui.unit.PxBounds globalBounds;
- property public final androidx.ui.unit.PxPosition globalPosition;
+ property public final androidx.ui.geometry.Offset globalPosition;
property public final boolean hasChildren;
property public final boolean isRoot;
property public final androidx.ui.core.semantics.SemanticsNode? parent;
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
index bba3ab4..10556e1 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/autofill/ExplicitAutofillTypesDemo.kt
@@ -36,7 +36,7 @@
import androidx.ui.layout.preferredHeight
import androidx.ui.material.MaterialTheme
import androidx.ui.foundation.TextFieldValue
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
@Composable
@@ -111,7 +111,7 @@
}
}
-private fun LayoutCoordinates.boundingBox() = localToGlobal(PxPosition.Origin).run {
+private fun LayoutCoordinates.boundingBox() = localToGlobal(Offset.Zero).run {
Rect(
x.toInt(),
y.toInt(),
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapGestureDetectorDemo.kt
index 4fd73d9..623fd08 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapGestureDetectorDemo.kt
@@ -28,7 +28,7 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -38,7 +38,7 @@
fun DoubleTapGestureFilterDemo() {
val color = state { Colors.random() }
- val onDoubleTap: (PxPosition) -> Unit = {
+ val onDoubleTap: (Offset) -> Unit = {
color.value = color.value.anotherRandomColor()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapInTapDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapInTapDemo.kt
index e6186c3..df425fac 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapInTapDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DoubleTapInTapDemo.kt
@@ -29,7 +29,7 @@
import androidx.ui.layout.Column
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.padding
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
@Composable
@@ -39,11 +39,11 @@
val innerColor = state { defaultColor }
val outerColor = state { defaultColor }
- val onTap: (PxPosition) -> Unit = {
+ val onTap: (Offset) -> Unit = {
outerColor.value = outerColor.value.next()
}
- val onDoubleTap: (PxPosition) -> Unit = { _ ->
+ val onDoubleTap: (Offset) -> Unit = { _ ->
innerColor.value = innerColor.value.prev()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DragScaleGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DragScaleGestureDetectorDemo.kt
index 64abcb8..6294fe0 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DragScaleGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/DragScaleGestureDetectorDemo.kt
@@ -33,7 +33,7 @@
import androidx.ui.layout.offset
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -43,7 +43,7 @@
@Composable
fun DragAndScaleGestureDetectorDemo() {
val size = state { 200.dp }
- val offset = state { PxPosition.Origin }
+ val offset = state { Offset.Zero }
val dragInScale = state { false }
val scaleObserver = object : ScaleObserver {
@@ -53,13 +53,13 @@
}
val dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value += dragDistance
return dragDistance
}
}
- val onRelease: (PxPosition) -> Unit = {
+ val onRelease: (Offset) -> Unit = {
dragInScale.value = !dragInScale.value
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressDragGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressDragGestureDetectorDemo.kt
index 8789973..7f2da76 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressDragGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressDragGestureDetectorDemo.kt
@@ -30,7 +30,7 @@
import androidx.ui.layout.offset
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -39,13 +39,13 @@
@Composable
fun LongPressDragGestureFilterDemo() {
- val offset = state { PxPosition.Origin }
+ val offset = state { Offset.Zero }
val color = state { Grey }
val longPressDragObserver =
object : LongPressDragObserver {
- override fun onLongPress(pxPosition: PxPosition) {
+ override fun onLongPress(pxPosition: Offset) {
color.value = Red
}
@@ -54,12 +54,12 @@
color.value = Blue
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value += dragDistance
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
color.value = Grey
}
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressGestureDetectorDemo.kt
index d3b7e88..eaefe9b 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/LongPressGestureDetectorDemo.kt
@@ -28,7 +28,7 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -38,7 +38,7 @@
fun LongPressGestureDetectorDemo() {
val color = state { Colors.random() }
- val _: PxPosition ->
+ val _: Offset ->
color.value = color.value.anotherRandomColor()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedLongPressDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedLongPressDemo.kt
index 18b8835..1f42daf 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedLongPressDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedLongPressDemo.kt
@@ -28,7 +28,7 @@
import androidx.ui.layout.Column
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.padding
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -65,7 +65,7 @@
val currentColor = state { defaultColor }
val pressed = state { false }
- val onLongPress: (PxPosition) -> Unit = {
+ val onLongPress: (Offset) -> Unit = {
currentColor.value = currentColor.value.next()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedPressDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedPressDemo.kt
index 4bf548f..25cb457 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedPressDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedPressDemo.kt
@@ -30,7 +30,7 @@
import androidx.ui.layout.Column
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.padding
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -76,16 +76,16 @@
pressed.value = false
}
- val _: PxPosition ->
+ val _: Offset ->
pressed.value = false
currentColor.value = defaultColor
}
- val onTap: (PxPosition) -> Unit = {
+ val onTap: (Offset) -> Unit = {
currentColor.value = currentColor.value.next()
}
- val _: PxPosition ->
+ val _: Offset ->
currentColor.value = currentColor.value.prev()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
index 5408a9a..ceb124b 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/NestedScrollingDemo.kt
@@ -41,7 +41,7 @@
import androidx.ui.layout.preferredHeight
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import kotlin.math.roundToInt
@@ -82,7 +82,7 @@
val maxOffset = state { 0f }
val dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
val resultingOffset = offset.value + dragDistance.y
val dyToConsume =
if (resultingOffset > 0f) {
@@ -93,7 +93,7 @@
dragDistance.y
}
offset.value = offset.value + dyToConsume
- return PxPosition(0f, dyToConsume)
+ return Offset(0f, dyToConsume)
}
}
@@ -143,7 +143,7 @@
val color = state { defaultColor }
val showPressed = state { false }
- val onPress: (PxPosition) -> Unit = {
+ val onPress: (Offset) -> Unit = {
showPressed.value = true
}
@@ -151,15 +151,15 @@
showPressed.value = false
}
- val onTap: (PxPosition) -> Unit = {
+ val onTap: (Offset) -> Unit = {
color.value = color.value.next()
}
- val onDoubleTap: (PxPosition) -> Unit = {
+ val onDoubleTap: (Offset) -> Unit = {
color.value = color.value.prev().prev()
}
- val _: PxPosition ->
+ val _: Offset ->
color.value = defaultColor
showPressed.value = false
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PopupDragDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PopupDragDemo.kt
index 7dd368a..c206424 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PopupDragDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PopupDragDemo.kt
@@ -33,7 +33,7 @@
import androidx.ui.layout.Stack
import androidx.ui.layout.preferredSize
import androidx.ui.text.style.TextAlign
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.round
@@ -41,12 +41,12 @@
fun PopupDragDemo() {
// TODO fix this demo in RTL (check when draggable handles RTL)
val offset = state {
- PxPosition.Origin
+ Offset.Zero
}
val observer = remember {
object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value = offset.value + dragDistance
return dragDistance
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PressIndicatorGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PressIndicatorGestureDetectorDemo.kt
index 1f952ed..554a62a 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PressIndicatorGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/PressIndicatorGestureDetectorDemo.kt
@@ -29,7 +29,7 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -39,7 +39,7 @@
fun PressIndicatorGestureFilterDemo() {
val pressed = state { false }
- val onStart: (PxPosition) -> Unit = {
+ val onStart: (Offset) -> Unit = {
pressed.value = true
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/RawDragGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/RawDragGestureDetectorDemo.kt
index 830b176..be9b685 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/RawDragGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/RawDragGestureDetectorDemo.kt
@@ -30,7 +30,7 @@
import androidx.ui.layout.offset
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -38,10 +38,10 @@
*/
@Composable
fun RawDragGestureFilterDemo() {
- val offset = state { PxPosition.Origin }
+ val offset = state { Offset.Zero }
val dragObserver = object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value += dragDistance
return dragDistance
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TapGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TapGestureDetectorDemo.kt
index 508a5cb..0cbe702 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TapGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TapGestureDetectorDemo.kt
@@ -28,7 +28,7 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -38,7 +38,7 @@
fun TapGestureFilterDemo() {
val color = state { Colors.random() }
- val onTap: (PxPosition) -> Unit = {
+ val onTap: (Offset) -> Unit = {
color.value = color.value.anotherRandomColor()
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TouchSlopDragGestureDetectorDemo.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
index 06868fe..6b7a6f7 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/gestures/TouchSlopDragGestureDetectorDemo.kt
@@ -32,7 +32,7 @@
import androidx.ui.layout.offset
import androidx.ui.layout.preferredSize
import androidx.ui.layout.wrapContentSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
/**
@@ -44,32 +44,32 @@
val verticalColor = Color(0xfff44336)
val horizontalColor = Color(0xff2196f3)
- val offset = state { PxPosition.Origin }
+ val offset = state { Offset.Zero }
val canStartVertically = state { true }
val dragObserver =
if (canStartVertically.value) {
object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value =
- PxPosition(x = offset.value.x, y = offset.value.y + dragDistance.y)
+ Offset(x = offset.value.x, y = offset.value.y + dragDistance.y)
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
canStartVertically.value = !canStartVertically.value
super.onStop(velocity)
}
}
} else {
object : DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
offset.value =
- PxPosition(x = offset.value.x + dragDistance.x, y = offset.value.y)
+ Offset(x = offset.value.x + dragDistance.x, y = offset.value.y)
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
canStartVertically.value = !canStartVertically.value
super.onStop(velocity)
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
index ac5ba57..3cb88f2 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/AndroidPointerInputTest.kt
@@ -33,7 +33,7 @@
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.pointerinput.PointerInputModifier
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
@@ -168,7 +168,7 @@
fun dispatchTouchEvent_notMeasuredLayoutsAreMeasuredFirst() {
val size = mutableStateOf(10)
val latch = CountDownLatch(1)
- var consumedDownPosition: PxPosition? = null
+ var consumedDownPosition: Offset? = null
rule.runOnUiThread {
container.setContent(Recomposer.current()) {
Layout(
@@ -210,7 +210,7 @@
// we expect it to first remeasure and only then process
androidComposeView.dispatchTouchEvent(motionEvent)
- assertThat(consumedDownPosition).isEqualTo(PxPosition(15f, 15f))
+ assertThat(consumedDownPosition).isEqualTo(Offset(15f, 15f))
}
}
@@ -277,7 +277,7 @@
PointerInputModifierImpl(filter)
}
-fun Modifier.consumeDownGestureFilter(onDown: (PxPosition) -> Unit): Modifier = composed {
+fun Modifier.consumeDownGestureFilter(onDown: (Offset) -> Unit): Modifier = composed {
val filter = remember { ConsumeDownChangeFilter() }
filter.>
this + PointerInputModifierImpl(filter)
@@ -305,7 +305,7 @@
}
private class ConsumeDownChangeFilter : PointerInputFilter() {
- var onDown by mutableStateOf<(PxPosition) -> Unit>({})
+ var onDown by mutableStateOf<(Offset) -> Unit>({})
override fun onPointerInput(
changes: List<PointerInputChange>,
pass: PointerEventPass,
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureFilterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureFilterTest.kt
index 2f232b7..7245ed5 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureFilterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/LongPressDragGestureFilterTest.kt
@@ -26,7 +26,7 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.layout.Stack
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
@@ -371,15 +371,15 @@
@Suppress("RedundantOverride")
open class MyLongPressDragObserver(val onLongPress: () -> Unit) : LongPressDragObserver {
- override fun onLongPress(pxPosition: PxPosition) {
+ override fun onLongPress(pxPosition: Offset) {
onLongPress()
}
override fun onDragStart() {}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
return super.onDrag(dragDistance)
}
- override fun onStop(velocity: PxPosition) {}
+ override fun onStop(velocity: Offset) {}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
index f26061c1..f872dee 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/gesture/TouchSlopDragGestureFilterTest.kt
@@ -26,7 +26,7 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.layout.Stack
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.inOrder
@@ -130,7 +130,7 @@
}
dragObserver.inOrder {
- verify().onStart(PxPosition(50.ipx, 50.ipx))
+ verify().onStart(Offset(50f, 50f))
// Twice because RawDragGestureDetector calls the callback on both postUp and postDown
// and nothing consumes the drag distance.
verify(dragObserver, times(2)).onDrag(any())
@@ -177,7 +177,7 @@
}
dragObserver.inOrder {
- verify().onStart(PxPosition(50.ipx, 50.ipx))
+ verify().onStart(Offset(50f, 50f))
// Twice because RawDragGestureDetector calls the callback on both postUp and postDown
// and nothing consumes the drag distance.
verify(dragObserver, times(2)).onDrag(any())
@@ -204,7 +204,7 @@
}
dragObserver.inOrder {
- verify().onStart(PxPosition(50.ipx, 50.ipx))
+ verify().onStart(Offset(50f, 50f))
}
verifyNoMoreInteractions(dragObserver)
}
@@ -238,7 +238,7 @@
view.dispatchTouchEvent(move)
}
- verify(dragObserver, times(2)).onDrag(PxPosition(movement.toFloat(), 0.0f))
+ verify(dragObserver, times(2)).onDrag(Offset(movement.toFloat(), 0.0f))
}
private fun setup(startDragImmediately: Boolean) {
@@ -275,15 +275,15 @@
@Suppress("RedundantOverride")
open class MyDragObserver : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
super.onStart(downPosition)
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
return super.onDrag(dragDistance)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
super.onStop(velocity)
}
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
index a5a6d81..9943ff6 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/DrawLayerTest.kt
@@ -30,7 +30,7 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.height
import androidx.ui.unit.ipx
import androidx.ui.unit.width
@@ -79,7 +79,7 @@
assertTrue(positionLatch.await(1, TimeUnit.SECONDS))
activity.runOnUiThread {
- assertEquals(PxPosition(10f, 10f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(10f, 10f), layoutCoordinates.positionInRoot)
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(10f, 10f, 40f, 40f), bounds)
val global = layoutCoordinates.globalBounds
@@ -109,7 +109,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(5f, 0f, 25f, 30f), bounds)
- assertEquals(PxPosition(5f, 0f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(5f, 0f), layoutCoordinates.positionInRoot)
}
}
@@ -131,7 +131,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(0f, 10f, 30f, 20f), bounds)
- assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -154,7 +154,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(20f, 10f, 30f, 20f), bounds)
- assertEquals(PxPosition(30f, 10f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(30f, 10f), layoutCoordinates.positionInRoot)
}
}
@@ -177,7 +177,7 @@
activity.runOnUiThread {
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(15f, 18f, 25f, 28f), bounds)
- assertEquals(PxPosition(15f, 18f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(15f, 18f), layoutCoordinates.positionInRoot)
}
}
@@ -202,7 +202,7 @@
val bounds = layoutCoordinates.boundsInRoot
assertEquals(PxBounds(10f, 10f, 20f, 20f), bounds)
// Positions aren't clipped
- assertEquals(PxPosition(5f, 10f), layoutCoordinates.positionInRoot)
+ assertEquals(Offset(5f, 10f), layoutCoordinates.positionInRoot)
}
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
index b222ede..e8c3afc 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/LayerTouchTransformTest.kt
@@ -41,7 +41,7 @@
import androidx.ui.test.doPartialGesture
import androidx.ui.test.findByTag
import androidx.ui.test.sendDown
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.max
@@ -67,7 +67,7 @@
var latch: CountDownLatch? = null
rule.setContent {
val pressed = state { false }
- val onStart: (PxPosition) -> Unit = {
+ val onStart: (Offset) -> Unit = {
pressed.value = true
}
@@ -122,7 +122,7 @@
// however, after transformations, this point will be within
// its bounds
- val mappedPosition = PxPosition(342.0f, 168.0f)
+ val mappedPosition = Offset(342.0f, 168.0f)
val node = findByTag(testTag).doPartialGesture { sendDown(mappedPosition) }
latch = CountDownLatch(1).apply {
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
index a391eb4..3ec88b2 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/OnPositionedTest.kt
@@ -32,7 +32,7 @@
import androidx.ui.core.setContent
import androidx.ui.framework.test.TestActivity
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
@@ -146,7 +146,7 @@
@Test
fun callbackCalledForChildWhenParentMoved() {
var position by mutableStateOf(0.ipx)
- var childGlobalPosition = PxPosition(0f, 0f)
+ var childGlobalPosition = Offset(0f, 0f)
var latch = CountDownLatch(1)
rule.runOnUiThreadIR {
activity.setContent {
@@ -183,7 +183,7 @@
}
assertTrue(latch.await(1, TimeUnit.SECONDS))
- assertEquals(PxPosition(10f, 0f), childGlobalPosition)
+ assertEquals(Offset(10f, 0f), childGlobalPosition)
}
@Test
@@ -257,14 +257,14 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
rule.runOnUiThread {
- assertEquals(PxPosition(5f, 5f), coordinates!!.positionInParent)
+ assertEquals(Offset(5f, 5f), coordinates!!.positionInParent)
var root = coordinates!!
while (root.parentCoordinates != null) {
root = root.parentCoordinates!!
}
- assertEquals(PxPosition.Origin, root.positionInParent)
+ assertEquals(Offset.Zero, root.positionInParent)
}
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
index 4acf3dd..6e5abdf 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/RtlLayoutTest.kt
@@ -44,7 +44,7 @@
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert
@@ -68,7 +68,7 @@
private lateinit var activity: androidx.ui.framework.test.TestActivity
internal lateinit var density: Density
internal lateinit var countDownLatch: CountDownLatch
- internal lateinit var position: Array<Ref<PxPosition>>
+ internal lateinit var position: Array<Ref<Offset>>
private val size = 100.ipx
@Before
@@ -76,7 +76,7 @@
activity = activityTestRule.activity
density = Density(activity)
activity.hasFocusLatch.await(5, TimeUnit.SECONDS)
- position = Array(3) { Ref<PxPosition>() }
+ position = Array(3) { Ref<Offset>() }
countDownLatch = CountDownLatch(3)
}
@@ -89,10 +89,13 @@
}
countDownLatch.await(1, TimeUnit.SECONDS)
- Assert.assertEquals(PxPosition(0.ipx, 0.ipx), position[0].value)
- Assert.assertEquals(PxPosition(size, size), position[1].value)
+ Assert.assertEquals(Offset(0f, 0f), position[0].value)
+ Assert.assertEquals(Offset(size.value.toFloat(), size.value.toFloat()), position[1].value)
Assert.assertEquals(
- PxPosition(size * 2, size * 2),
+ Offset(
+ (size * 2).value.toFloat(),
+ (size * 2).value.toFloat()
+ ),
position[2].value
)
}
@@ -106,10 +109,22 @@
}
countDownLatch.await(1, TimeUnit.SECONDS)
- Assert.assertEquals(PxPosition(0.ipx, 0.ipx), position[0].value)
- Assert.assertEquals(PxPosition(size, size), position[1].value)
Assert.assertEquals(
- PxPosition(size * 2, size * 2),
+ Offset(0f, 0f),
+ position[0].value
+ )
+ Assert.assertEquals(
+ Offset(
+ size.value.toFloat(),
+ size.value.toFloat()
+ ),
+ position[1].value
+ )
+ Assert.assertEquals(
+ Offset(
+ (size * 2).value.toFloat(),
+ (size * 2).value.toFloat()
+ ),
position[2].value
)
}
@@ -123,10 +138,13 @@
}
countDownLatch.await(1, TimeUnit.SECONDS)
- Assert.assertEquals(PxPosition(0.ipx, 0.ipx), position[0].value)
- Assert.assertEquals(PxPosition(size, size), position[1].value)
+ Assert.assertEquals(Offset(0f, 0f), position[0].value)
+ Assert.assertEquals(Offset(size.value.toFloat(), size.value.toFloat()), position[1].value)
Assert.assertEquals(
- PxPosition(size * 2, size * 2),
+ Offset(
+ (size * 2).value.toFloat(),
+ (size * 2).value.toFloat()
+ ),
position[2].value
)
}
@@ -142,9 +160,18 @@
countDownLatch.await(1, TimeUnit.SECONDS)
countDownLatch.await(1, TimeUnit.SECONDS)
- Assert.assertEquals(PxPosition(size * 2, 0.ipx), position[0].value)
- Assert.assertEquals(PxPosition(size, size), position[1].value)
- Assert.assertEquals(PxPosition(0.ipx, size * 2), position[2].value)
+ Assert.assertEquals(
+ Offset(
+ (size * 2).value.toFloat(),
+ 0f
+ ),
+ position[0].value
+ )
+ Assert.assertEquals(
+ Offset(size.value.toFloat(), size.value.toFloat()),
+ position[1].value
+ )
+ Assert.assertEquals(Offset(0f, (size * 2).value.toFloat()), position[2].value)
}
@Test
@@ -332,16 +359,16 @@
val width = placeables.fold(0.ipx) { sum, p -> sum + p.width }
val height = placeables.fold(0.ipx) { sum, p -> sum + p.height }
layout(width, height) {
- var x = 0.ipx
- var y = 0.ipx
+ var x = 0f
+ var y = 0f
for (placeable in placeables) {
if (absolutePositioning) {
- placeable.placeAbsolute(PxPosition(x, y))
+ placeable.placeAbsolute(Offset(x, y))
} else {
- placeable.place(PxPosition(x, y))
+ placeable.place(Offset(x, y))
}
- x += placeable.width
- y += placeable.height
+ x += placeable.width.value.toFloat()
+ y += placeable.height.value.toFloat()
}
}
}
@@ -403,10 +430,10 @@
@Composable
private fun saveLayoutInfo(
- position: Ref<PxPosition>,
+ position: Ref<Offset>,
countDownLatch: CountDownLatch
): Modifier = Modifier.onPositioned {
- position.value = it.localToGlobal(PxPosition(0.ipx, 0.ipx))
+ position.value = it.localToGlobal(Offset(0f, 0f))
countDownLatch.countDown()
}
}
diff --git a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
index 8598aeb..ac29360 100644
--- a/ui/ui-core/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
+++ b/ui/ui-core/src/androidTest/java/androidx/ui/core/test/WithConstraintsTest.kt
@@ -58,7 +58,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -648,7 +648,7 @@
) { m, c, _ ->
val p = m.first().measure(c)
layout(0.ipx, 0.ipx) {
- p.place(PxPosition.Origin)
+ p.place(Offset.Zero)
latch.countDown()
}
}
@@ -678,7 +678,7 @@
) { m, c, _ ->
val p = m.first().measure(c)
layout(0.ipx, 0.ipx) {
- p.place(PxPosition.Origin)
+ p.place(Offset.Zero)
latch.countDown()
}
}
@@ -776,7 +776,7 @@
}
) { m, _, _ ->
layout(0.ipx, 0.ipx) {
- m.first().measure(Constraints(dpConstraints)).place(PxPosition.Origin)
+ m.first().measure(Constraints(dpConstraints)).place(Offset.Zero)
}
}
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/DelegatingLayoutNodeWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/DelegatingLayoutNodeWrapper.kt
index 2831c0a..fa83554 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/DelegatingLayoutNodeWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/DelegatingLayoutNodeWrapper.kt
@@ -22,7 +22,7 @@
import androidx.ui.graphics.Canvas
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
/**
@@ -52,7 +52,7 @@
}
override fun hitTest(
- pointerPositionRelativeToScreen: PxPosition,
+ pointerPositionRelativeToScreen: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean {
if (isGlobalPointerInBounds(pointerPositionRelativeToScreen)) {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/InnerPlaceable.kt b/ui/ui-core/src/main/java/androidx/ui/core/InnerPlaceable.kt
index f796cfa..a4225c0 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/InnerPlaceable.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/InnerPlaceable.kt
@@ -26,7 +26,7 @@
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
import androidx.ui.util.fastFirstOrNull
import androidx.ui.util.fastForEach
@@ -149,7 +149,7 @@
}
override fun hitTest(
- pointerPositionRelativeToScreen: PxPosition,
+ pointerPositionRelativeToScreen: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean {
if (isGlobalPointerInBounds(pointerPositionRelativeToScreen)) {
@@ -181,7 +181,7 @@
private fun callHitTest(
node: LayoutNode,
- globalPoint: PxPosition,
+ globalPoint: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean {
return node.hitTest(globalPoint, hitPointerInputFilters)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
index 1ec5dcc9..395c4ee4 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayerWrapper.kt
@@ -20,7 +20,7 @@
import android.graphics.RectF
import androidx.ui.graphics.Canvas
import androidx.ui.unit.IntPxPosition
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
internal class LayerWrapper(
wrapped: LayoutNodeWrapper,
@@ -80,7 +80,7 @@
return layer
}
- override fun fromParentPosition(position: PxPosition): PxPosition {
+ override fun fromParentPosition(position: Offset): Offset {
val matrix = layer.getMatrix()
val targetPosition =
if (!matrix.isIdentity) {
@@ -93,7 +93,7 @@
return super.fromParentPosition(targetPosition)
}
- override fun toParentPosition(position: PxPosition): PxPosition {
+ override fun toParentPosition(position: Offset): Offset {
val matrix = layer.getMatrix()
val targetPosition =
if (!matrix.isIdentity) {
@@ -105,10 +105,10 @@
}
/**
- * Return a transformed [PxPosition] based off of the provided matrix transformation
+ * Return a transformed [Offset] based off of the provided matrix transformation
* and untransformed position.
*/
- private fun mapPointsFromMatrix(matrix: Matrix, position: PxPosition): PxPosition {
+ private fun mapPointsFromMatrix(matrix: Matrix, position: Offset): Offset {
val x = position.x
val y = position.y
val cache = positionCache
@@ -120,7 +120,7 @@
floatArrayOf(x, y).also { positionCache = it }
}
matrix.mapPoints(point)
- return PxPosition(point[0], point[1])
+ return Offset(point[0], point[1])
}
override fun rectInParent(bounds: RectF) {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
index 1a44ca0..e760bc0 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutCoordinates.kt
@@ -18,8 +18,8 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
/**
* A holder of the measured bounds for the layout (MeasureBox).
@@ -49,22 +49,22 @@
/**
* Converts a global position into a local position within this layout.
*/
- fun globalToLocal(global: PxPosition): PxPosition
+ fun globalToLocal(global: Offset): Offset
/**
* Converts a local position within this layout into a global one.
*/
- fun localToGlobal(local: PxPosition): PxPosition
+ fun localToGlobal(local: Offset): Offset
/**
* Converts a local position within this layout into an offset from the root composable.
*/
- fun localToRoot(local: PxPosition): PxPosition
+ fun localToRoot(local: Offset): Offset
/**
* Converts a child layout position into a local position within this layout.
*/
- fun childToLocal(child: LayoutCoordinates, childLocal: PxPosition): PxPosition
+ fun childToLocal(child: LayoutCoordinates, childLocal: Offset): Offset
/**
* Returns the child bounding box, discarding clipped rectangles, in local coordinates.
@@ -81,12 +81,12 @@
/**
* The global position of this layout.
*/
-inline val LayoutCoordinates.globalPosition: PxPosition get() = localToGlobal(PxPosition.Origin)
+inline val LayoutCoordinates.globalPosition: Offset get() = localToGlobal(Offset.Zero)
/**
* The position of this layout inside the root composable.
*/
-inline val LayoutCoordinates.positionInRoot: PxPosition get() = localToRoot(PxPosition.Origin)
+inline val LayoutCoordinates.positionInRoot: Offset get() = localToRoot(Offset.Zero)
/**
* The boundaries of this layout inside the root composable.
@@ -100,8 +100,8 @@
* Returns the position of the top-left in the parent's content area or (0, 0)
* for the root.
*/
-val LayoutCoordinates.positionInParent: PxPosition
- get() = parentCoordinates?.childToLocal(this, PxPosition.Origin) ?: PxPosition.Origin
+val LayoutCoordinates.positionInParent: Offset
+ get() = parentCoordinates?.childToLocal(this, Offset.Zero) ?: Offset.Zero
/**
* Returns the bounding box of the child in the parent's content area, including any clipping
@@ -118,7 +118,7 @@
val LayoutCoordinates.globalBounds: PxBounds
get() {
val root = findRoot(this)
- val rootPosition = root.localToGlobal(PxPosition.Origin)
+ val rootPosition = root.localToGlobal(Offset.Zero)
val bounds = root.childBoundingBox(this)
return PxBounds(
left = bounds.left + rootPosition.x,
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
index a27120a..2e4fddf 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNode.kt
@@ -31,7 +31,7 @@
import androidx.ui.graphics.drawscope.drawCanvas
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.util.fastForEach
import kotlin.math.roundToInt
@@ -722,7 +722,7 @@
* [hitPointerInputFilters].
*/
fun hitTest(
- pointerPositionRelativeToScreen: PxPosition,
+ pointerPositionRelativeToScreen: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean {
return layoutNodeWrapper.hitTest(pointerPositionRelativeToScreen, hitPointerInputFilters)
@@ -734,7 +734,7 @@
*/
fun getAlignmentLine(line: AlignmentLine): IntPx? {
val linePos = alignmentLines[line] ?: return null
- var pos = PxPosition(linePos, linePos)
+ var pos = Offset(linePos.value.toFloat(), linePos.value.toFloat())
var wrapper = innerLayoutNodeWrapper
while (wrapper != layoutNodeWrapper) {
pos = wrapper.toParentPosition(pos)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
index f866b6a..a9e9aa8 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/LayoutNodeWrapper.kt
@@ -27,9 +27,11 @@
import androidx.ui.graphics.Paint
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
+import androidx.ui.geometry.Offset
+import androidx.ui.unit.plus
+import androidx.ui.unit.minus
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
-import androidx.ui.unit.toPxPosition
+import androidx.ui.unit.toOffset
/**
* Measurable and Placeable type that has a position.
@@ -90,7 +92,7 @@
* Whether a pointer that is relative to the device screen is in the bounds of this
* LayoutNodeWrapper.
*/
- fun isGlobalPointerInBounds(globalPointerPosition: PxPosition): Boolean {
+ fun isGlobalPointerInBounds(globalPointerPosition: Offset): Boolean {
// TODO(shepshapard): Right now globalToLocal has to traverse the tree all the way back up
// so calling this is expensive. Would be nice to cache data such that this is cheap.
val localPointerPosition = globalToLocal(globalPointerPosition)
@@ -144,11 +146,11 @@
* [hitPointerInputFilters].
*/
abstract fun hitTest(
- pointerPositionRelativeToScreen: PxPosition,
+ pointerPositionRelativeToScreen: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean
- override fun childToLocal(child: LayoutCoordinates, childLocal: PxPosition): PxPosition {
+ override fun childToLocal(child: LayoutCoordinates, childLocal: Offset): Offset {
check(isAttached) { ExpectAttachedLayoutCoordinates }
check(child.isAttached) { "Child $child is not attached!" }
var wrapper = child as LayoutNodeWrapper
@@ -165,19 +167,19 @@
return position
}
- override fun globalToLocal(global: PxPosition): PxPosition {
+ override fun globalToLocal(global: Offset): Offset {
check(isAttached) { ExpectAttachedLayoutCoordinates }
val wrapper = wrappedBy ?: return fromParentPosition(
- global - layoutNode.requireOwner().calculatePosition().toPxPosition()
+ global - layoutNode.requireOwner().calculatePosition().toOffset()
)
return fromParentPosition(wrapper.globalToLocal(global))
}
- override fun localToGlobal(local: PxPosition): PxPosition {
+ override fun localToGlobal(local: Offset): Offset {
return localToRoot(local) + layoutNode.requireOwner().calculatePosition()
}
- override fun localToRoot(local: PxPosition): PxPosition {
+ override fun localToRoot(local: Offset): Offset {
check(isAttached) { ExpectAttachedLayoutCoordinates }
var wrapper: LayoutNodeWrapper? = this
var position = local
@@ -197,16 +199,16 @@
}
/**
- * Converts [position] in the local coordinate system to a [PxPosition] in the
+ * Converts [position] in the local coordinate system to a [Offset] in the
* [parentCoordinates] coordinate system.
*/
- open fun toParentPosition(position: PxPosition): PxPosition = position + this.position
+ open fun toParentPosition(position: Offset): Offset = position + this.position
/**
- * Converts [position] in the [parentCoordinates] coordinate system to a [PxPosition] in the
+ * Converts [position] in the [parentCoordinates] coordinate system to a [Offset] in the
* local coordinate system.
*/
- open fun fromParentPosition(position: PxPosition): PxPosition = position - this.position
+ open fun fromParentPosition(position: Offset): Offset = position - this.position
protected fun drawBorder(canvas: Canvas, paint: Paint) {
val rect = Rect(
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/Placeable.kt b/ui/ui-core/src/main/java/androidx/ui/core/Placeable.kt
index 82e77c8..c732795 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/Placeable.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/Placeable.kt
@@ -19,7 +19,7 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.coerceIn
import androidx.ui.unit.ipx
import androidx.ui.unit.round
@@ -141,7 +141,7 @@
* automatic position mirroring will not happen and the [Placeable] will be placed at the
* given [position], similar to the [placeAbsolute] method.
*/
- fun Placeable.place(position: PxPosition) = placeAutoMirrored(position.round())
+ fun Placeable.place(position: Offset) = placeAutoMirrored(position.round())
/**
* Place a [Placeable] at [x], [y] in its parent's coordinate system.
@@ -159,7 +159,7 @@
* Unlike [place], the given [position] will not implicitly react in RTL layout direction
* contexts.
*/
- fun Placeable.placeAbsolute(position: PxPosition) = placeAbsolute(position.round())
+ fun Placeable.placeAbsolute(position: Offset) = placeAbsolute(position.round())
/**
* Place a [Placeable] at [x], [y] in its parent's coordinate system.
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt b/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
index cbf43de..5c2994062 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/PointerInput.kt
@@ -19,7 +19,7 @@
import androidx.compose.Immutable
import androidx.compose.Stable
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
/**
@@ -74,7 +74,7 @@
@Stable
val uptime: Uptime? = null,
@Stable
- val position: PxPosition? = null,
+ val position: Offset? = null,
@Stable
val down: Boolean = false
)
@@ -87,7 +87,7 @@
*/
@Immutable
data class ConsumedData(
- val positionChange: PxPosition = PxPosition.Origin,
+ val positionChange: Offset = Offset.Zero,
val downChange: Boolean = false
)
@@ -185,14 +185,14 @@
* True if this [PointerInputChange] represents a pointer moving on the screen and some of that
* movement has not been consumed.
*/
-fun PointerInputChange.positionChanged() = this.positionChangeInternal(false) != PxPosition.Origin
+fun PointerInputChange.positionChanged() = this.positionChangeInternal(false) != Offset.Zero
/**
* True if this [PointerInputChange] represents a pointer moving on the screen ignoring how much
* of that movement may have been consumed.
*/
fun PointerInputChange.positionChangedIgnoreConsumed() =
- this.positionChangeInternal(true) != PxPosition.Origin
+ this.positionChangeInternal(true) != Offset.Zero
/**
* The distance that the pointer has moved on the screen minus any distance that has been consumed.
@@ -205,13 +205,13 @@
*/
fun PointerInputChange.positionChangeIgnoreConsumed() = this.positionChangeInternal(true)
-private fun PointerInputChange.positionChangeInternal(ignoreConsumed: Boolean = false): PxPosition {
+private fun PointerInputChange.positionChangeInternal(ignoreConsumed: Boolean = false): Offset {
val previousPosition = previous.position
val currentPosition = current.position
val offset =
if (previousPosition == null || currentPosition == null) {
- PxPosition(0.0f, 0.0f)
+ Offset(0.0f, 0.0f)
} else {
currentPosition - previousPosition
}
@@ -269,7 +269,7 @@
// less than the total change.
return copy(
consumed = this.consumed.copy(
- positionChange = PxPosition(
+ positionChange = Offset(
newConsumedDx,
newConsumedDy
)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/PointerInputDelegatingWrapper.kt b/ui/ui-core/src/main/java/androidx/ui/core/PointerInputDelegatingWrapper.kt
index fcf84f8..ecea5cc 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/PointerInputDelegatingWrapper.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/PointerInputDelegatingWrapper.kt
@@ -18,7 +18,7 @@
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.pointerinput.PointerInputModifier
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
internal class PointerInputDelegatingWrapper(
wrapped: LayoutNodeWrapper,
@@ -30,7 +30,7 @@
}
override fun hitTest(
- pointerPositionRelativeToScreen: PxPosition,
+ pointerPositionRelativeToScreen: Offset,
hitPointerInputFilters: MutableList<PointerInputFilter>
): Boolean {
if (isGlobalPointerInBounds(pointerPositionRelativeToScreen)) {
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/Popup.kt b/ui/ui-core/src/main/java/androidx/ui/core/Popup.kt
index b46f0f9..cfc2401 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/Popup.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/Popup.kt
@@ -41,7 +41,7 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.round
@@ -186,7 +186,7 @@
Layout(children = emptyContent(), modifier = Modifier.onPositioned { childCoordinates ->
val coordinates = childCoordinates.parentCoordinates!!
// Get the global position of the parent
- val layoutPosition = coordinates.localToGlobal(PxPosition.Origin).round()
+ val layoutPosition = coordinates.localToGlobal(Offset.Zero).round()
val layoutSize = coordinates.size
popupLayout.popupPositionProperties.parentPosition = layoutPosition
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DoubleTapGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DoubleTapGestureFilter.kt
index 7762d71..30e1b88 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DoubleTapGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DoubleTapGestureFilter.kt
@@ -33,7 +33,7 @@
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.temputils.delay
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
import kotlinx.coroutines.Job
import kotlin.coroutines.CoroutineContext
@@ -54,7 +54,7 @@
* Also, given that this gesture detector is so temporary, opting to not write substantial tests.
*/
fun Modifier.doubleTapGestureFilter(
- onDoubleTap: (PxPosition) -> Unit
+ onDoubleTap: (Offset) -> Unit
): Modifier = composed {
@Suppress("DEPRECATION")
val coroutineContext = CoroutineContextAmbient.current
@@ -68,7 +68,7 @@
val coroutineContext: CoroutineContext
) : PointerInputFilter() {
- lateinit var onDoubleTap: (PxPosition) -> Unit
+ lateinit var onDoubleTap: (Offset) -> Unit
private enum class State {
Idle, Down, Up, SecondDown
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragGestureFilter.kt
index c178e08..895ff60 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragGestureFilter.kt
@@ -21,7 +21,7 @@
import androidx.ui.core.Modifier
import androidx.ui.core.PointerEventPass
import androidx.ui.core.composed
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
// TODO(b/146133703): Likely rename to PanGestureDetector as per b/146133703
/**
@@ -91,24 +91,24 @@
enabled = true
}
- fun startDrag(downPosition: PxPosition) {
+ fun startDrag(downPosition: Offset) {
started = true
touchSlopDragObserver.onStart(downPosition)
}
val rawDragObserver: DragObserver =
object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
if (!started) {
touchSlopDragObserver.onStart(downPosition)
}
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
return touchSlopDragObserver.onDrag(dragDistance)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
started = false
enabled = false
touchSlopDragObserver.onStop(velocity)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
index c75d811..cd4433d 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/DragSlopExceededGestureFilter.kt
@@ -26,9 +26,8 @@
import androidx.ui.core.composed
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.positionChange
-import androidx.ui.geometry.Offset
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* This gesture filter detects when the average distance change of all pointers surpasses touch
@@ -76,8 +75,8 @@
) {
// Get current average change.
val averagePositionChange = getAveragePositionChange(changes)
- val dx = averagePositionChange.dx
- val dy = averagePositionChange.dy
+ val dx = averagePositionChange.x
+ val dy = averagePositionChange.y
// Track changes during postUp and during postDown. This allows for fancy dragging
// due to a parent being dragged and will likely be removed.
@@ -149,7 +148,7 @@
* Get's the average distance change of all pointers as an Offset.
*/
private fun getAveragePositionChange(changes: List<PointerInputChange>): Offset {
- val sum = changes.fold(PxPosition.Origin) { sum, change ->
+ val sum = changes.fold(Offset.Zero) { sum, change ->
sum + change.positionChange()
}
val sizeAsFloat = changes.size.toFloat()
@@ -163,8 +162,8 @@
*/
private fun Offset.horizontalDirection() =
when {
- this.dx < 0f -> Direction.LEFT
- this.dx > 0f -> Direction.RIGHT
+ this.x < 0f -> Direction.LEFT
+ this.x > 0f -> Direction.RIGHT
else -> null
}
@@ -173,7 +172,7 @@
*/
private fun Offset.verticalDirection() =
when {
- this.dy < 0f -> Direction.UP
- this.dy > 0f -> Direction.DOWN
+ this.y < 0f -> Direction.UP
+ this.y > 0f -> Direction.DOWN
else -> null
}
\ No newline at end of file
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressDragGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressDragGestureFilter.kt
index 74441b8..93de110 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressDragGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressDragGestureFilter.kt
@@ -25,7 +25,7 @@
import androidx.ui.core.composed
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
interface LongPressDragObserver {
@@ -42,7 +42,7 @@
* @see onDrag
* @see onStop
*/
- fun onLongPress(pxPosition: PxPosition) {}
+ fun onLongPress(pxPosition: Offset) {}
/**
* Override to be notified when dragging has actually begun.
@@ -76,7 +76,7 @@
* @param dragDistance The distance that has been dragged. Reflects the average drag distance
* of all pointers.
*/
- fun onDrag(dragDistance: PxPosition) = PxPosition.Origin
+ fun onDrag(dragDistance: Offset) = Offset.Zero
/**
* Override to be notified when a drag has stopped.
@@ -84,7 +84,7 @@
* This is called once all pointers have stopped interacting with this DragGestureDetector and
* [onLongPress] was previously called.
*/
- fun onStop(velocity: PxPosition) {}
+ fun onStop(velocity: Offset) {}
/**
* Override to be notified when the drag has been cancelled.
@@ -141,16 +141,16 @@
object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
longPressDragObserver.onDragStart()
dragStarted = true
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
return longPressDragObserver.onDrag(dragDistance)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
dragEnabled = false
dragStarted = false
longPressDragObserver.onStop(velocity)
@@ -177,7 +177,7 @@
changes.all { it.changedToUpIgnoreConsumed() }
) {
dragEnabled = false
- longPressDragObserver.onStop(PxPosition.Origin)
+ longPressDragObserver.onStop(Offset.Zero)
}
return changes
}
@@ -191,7 +191,7 @@
}
}
- val pxPosition: PxPosition ->
+ val pxPosition: Offset ->
dragEnabled = true
longPressDragObserver.onLongPress(pxPosition)
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressGestureFilter.kt
index 5192ea1..2d9ad7a 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/LongPressGestureFilter.kt
@@ -34,7 +34,7 @@
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.temputils.delay
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
import kotlinx.coroutines.Job
import kotlin.coroutines.CoroutineContext
@@ -50,7 +50,7 @@
* (double tap, triple tap) and tap.
*/
fun Modifier.longPressGestureFilter(
- onLongPress: (PxPosition) -> Unit
+ onLongPress: (Offset) -> Unit
): Modifier = composed {
@Suppress("DEPRECATION")
val coroutineContext = CoroutineContextAmbient.current
@@ -62,7 +62,7 @@
internal class LongPressGestureFilter(
private val coroutineContext: CoroutineContext
) : PointerInputFilter() {
- lateinit var onLongPress: (PxPosition) -> Unit
+ lateinit var onLongPress: (Offset) -> Unit
var longPressTimeout = LongPressTimeout
@@ -71,7 +71,7 @@
}
private var state = State.Idle
- private val pointerPositions = linkedMapOf<PointerId, PxPosition>()
+ private val pointerPositions = linkedMapOf<PointerId, Offset>()
private var job: Job? = null
private lateinit var customEventDispatcher: CustomEventDispatcher
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureFilter.kt
index 997f33b..dd17e9a0 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/PressIndicatorGestureFilter.kt
@@ -26,9 +26,8 @@
import androidx.ui.core.composed
import androidx.ui.core.consumeDownChange
import androidx.ui.core.pointerinput.PointerInputFilter
-import androidx.ui.geometry.Offset
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
/**
@@ -49,7 +48,7 @@
*/
// TODO(b/139020678): Probably has shared functionality with other press based detectors.
fun Modifier.pressIndicatorGestureFilter(
- onStart: ((PxPosition) -> Unit)? = null,
+ onStart: ((Offset) -> Unit)? = null,
onStop: (() -> Unit)? = null,
onCancel: (() -> Unit)? = null,
enabled: Boolean = true
@@ -70,7 +69,7 @@
* This callback should be used to indicate that the press state should be shown. An [Offset]
* is provided to indicate where the first pointer made contact with this gesrure detector.
*/
- var onStart: ((PxPosition) -> Unit)? = null
+ var onStart: ((Offset) -> Unit)? = null
/**
* Called if onStart was attempted to be called (it may have been null), no pointer movement
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
index 4a38933..84e5170 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawDragGestureFilter.kt
@@ -32,7 +32,7 @@
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.positionChange
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
import androidx.ui.util.fastForEach
@@ -50,7 +50,7 @@
* @see onDrag
* @see onStop
*/
- fun onStart(downPosition: PxPosition) {}
+ fun onStart(downPosition: Offset) {}
/**
* Override to be notified when a distance has been dragged.
@@ -67,7 +67,7 @@
* @param dragDistance The distance that has been dragged. Reflects the average drag distance
* of all pointers.
*/
- fun onDrag(dragDistance: PxPosition) = PxPosition.Origin
+ fun onDrag(dragDistance: Offset) = Offset.Zero
/**
* Override to be notified when a drag has stopped.
@@ -76,7 +76,7 @@
*
* Only called if the last call between [onStart] and [onStop] was [onStart].
*/
- fun onStop(velocity: PxPosition) {}
+ fun onStop(velocity: Offset) {}
/**
* Override to be notified when the drag has been cancelled.
@@ -134,7 +134,7 @@
internal class RawDragGestureFilter : PointerInputFilter() {
private val velocityTrackers: MutableMap<PointerId, VelocityTracker> = mutableMapOf()
- private val downPositions: MutableMap<PointerId, PxPosition> = mutableMapOf()
+ private val downPositions: MutableMap<PointerId, Offset> = mutableMapOf()
private var started = false
var canStartDragging: (() -> Boolean)? = null
lateinit var dragObserver: DragObserver
@@ -190,7 +190,7 @@
// velocityTracker at this point, that means at least one of the up events
// was not consumed so we should send velocity for flinging.
if (started) {
- val velocity: PxPosition? =
+ val velocity: Offset? =
if (velocityTracker != null) {
changesToReturn = changesToReturn.map {
it.consumeDownChange()
@@ -200,7 +200,7 @@
null
}
started = false
- dragObserver.onStop(velocity ?: PxPosition.Origin)
+ dragObserver.onStop(velocity ?: Offset.Zero)
}
}
}
@@ -282,7 +282,7 @@
if (started) {
val consumed = dragObserver.onDrag(
- PxPosition(
+ Offset(
totalDx / changesToReturn.size,
totalDy / changesToReturn.size
)
@@ -311,12 +311,12 @@
}
}
-private fun Iterable<PxPosition>.averagePosition(): PxPosition {
+private fun Iterable<Offset>.averagePosition(): Offset {
var x = 0f
var y = 0f
forEach {
x += it.x
y += it.y
}
- return PxPosition(x / count(), y / count())
+ return Offset(x / count(), y / count())
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawPressStartGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawPressStartGestureFilter.kt
index af4ef1c..03e3a5a 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawPressStartGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/RawPressStartGestureFilter.kt
@@ -26,7 +26,7 @@
import androidx.ui.core.consumeDownChange
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Reacts if the first pointer input change it sees is an unconsumed down change, and if it reacts,
@@ -42,7 +42,7 @@
* The theory is that this GestureDetector can be reused in PressIndicatorGestureDetector, and there
* could be a corresponding RawPressReleasedGestureDetector.
*
- * @param onPressStart Called when the first pointer "presses" on the GestureDetector. [PxPosition]
+ * @param onPressStart Called when the first pointer "presses" on the GestureDetector. [Offset]
* is the position of that first pointer on press.
* @param enabled If false, this GestureDetector will effectively act as if it is not in the
* hierarchy.
@@ -50,7 +50,7 @@
* react to and consume down changes. Defaults to [PointerEventPass.PostUp].
*/
fun Modifier.rawPressStartGestureFilter(
- onPressStart: (PxPosition) -> Unit,
+ onPressStart: (Offset) -> Unit,
enabled: Boolean = false,
executionPass: PointerEventPass = PointerEventPass.PostUp
): Modifier = composed {
@@ -63,7 +63,7 @@
internal class RawPressStartGestureFilter : PointerInputFilter() {
- lateinit var onPressStart: (PxPosition) -> Unit
+ lateinit var onPressStart: (Offset) -> Unit
private var enabled: Boolean = true
private var executionPass = PointerEventPass.InitialDown
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/TapGestureFilter.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/TapGestureFilter.kt
index 1fe9557..e16f156 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/TapGestureFilter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/TapGestureFilter.kt
@@ -32,7 +32,7 @@
import androidx.ui.core.gesture.customevents.DelayUpMessage
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
/**
@@ -60,7 +60,7 @@
// TODO(b/139020678): Probably has shared functionality with other press based detectors.
fun Modifier.tapGestureFilter(
- onTap: (PxPosition) -> Unit
+ onTap: (Offset) -> Unit
): Modifier = composed {
val filter = remember { TapGestureFilter() }
filter.>
@@ -73,7 +73,7 @@
*
* This should be used to fire a state changing event as if a button was pressed.
*/
- lateinit var onTap: (PxPosition) -> Unit
+ lateinit var onTap: (Offset) -> Unit
/**
* True when we are primed to call [onTap] and may be consuming all down changes.
@@ -82,7 +82,7 @@
private var downPointers: MutableSet<PointerId> = mutableSetOf()
private var upBlockedPointers: MutableSet<PointerId> = mutableSetOf()
- private var lastPxPosition: PxPosition? = null
+ private var lastPxPosition: Offset? = null
override fun onPointerInput(
changes: List<PointerInputChange>,
@@ -95,7 +95,7 @@
if (primed &&
changes.all { it.changedToUp() }
) {
- val pointerPxPosition: PxPosition = changes[0].previous.position!!
+ val pointerPxPosition: Offset = changes[0].previous.position!!
if (changes.fastAny { !upBlockedPointers.contains(it.id) }) {
// If we are primed, all pointers went up, and at least one of the pointers is
// not blocked, we can fire, reset, and consume all of the up events.
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt b/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
index c2c45bc..b8b2e5c 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/gesture/util/VelocityTracker.kt
@@ -17,7 +17,7 @@
package androidx.ui.core.gesture.util
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.Velocity
import androidx.ui.unit.inMilliseconds
@@ -56,7 +56,7 @@
// TODO(shepshapard): VelocityTracker needs to be updated to be passed vectors instead of
// positions. For velocity tracking, the only thing that is important is the change in
// position over time.
- fun addPosition(uptime: Uptime, position: PxPosition) {
+ fun addPosition(uptime: Uptime, position: Offset) {
index = (index + 1) % HistorySize
samples[index] = PointAtTime(position, uptime)
}
@@ -110,7 +110,7 @@
}
oldestSample = sample
- val position: PxPosition = sample.point
+ val position: Offset = sample.point
x.add(position.x)
y.add(position.y)
time.add(-age)
@@ -130,7 +130,7 @@
val xSlope = xFit.coefficients[1]
val ySlope = yFit.coefficients[1]
return VelocityEstimate(
- pixelsPerSecond = PxPosition(
+ pixelsPerSecond = Offset(
// Convert from pixels/ms to pixels/s
(xSlope * 1000),
(ySlope * 1000)
@@ -148,7 +148,7 @@
// We're unable to make a velocity estimate but we did have at least one
// valid pointer position.
return VelocityEstimate(
- pixelsPerSecond = PxPosition.Origin,
+ pixelsPerSecond = Offset.Zero,
confidence = 1.0f,
duration = newestSample.time - oldestSample.time,
offset = newestSample.point - oldestSample.point
@@ -156,7 +156,7 @@
}
}
-private data class PointAtTime(val point: PxPosition, val time: Uptime)
+private data class PointAtTime(val point: Offset, val time: Uptime)
/**
* A two dimensional velocity estimate.
@@ -175,7 +175,7 @@
*/
private data class VelocityEstimate(
/** The number of pixels per second of velocity in the x and y directions. */
- val pixelsPerSecond: PxPosition,
+ val pixelsPerSecond: Offset,
/**
* A value between 0.0 and 1.0 that indicates how well [VelocityTracker]
* was able to fit a straight line to its position data.
@@ -192,9 +192,9 @@
* The difference between the first and last position sample used
* to compute [pixelsPerSecond].
*/
- val offset: PxPosition
+ val offset: Offset
) {
companion object {
- val None = VelocityEstimate(PxPosition.Origin, 1f, Duration(0), PxPosition.Origin)
+ val None = VelocityEstimate(Offset.Zero, 1f, Duration(0), Offset.Zero)
}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/HitPathTracker.kt b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/HitPathTracker.kt
index 2999035..7ee67e5 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/HitPathTracker.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/HitPathTracker.kt
@@ -24,6 +24,7 @@
import androidx.ui.core.PointerInputChange
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
+import androidx.ui.unit.plus
/**
* Organizes pointers and the [PointerInputFilter]s that they hit into a hierarchy such that
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
index 310ecf9..84aa612 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/MotionEventAdapter.kt
@@ -26,7 +26,7 @@
import androidx.ui.core.PointerId
import androidx.ui.core.PointerInputData
import androidx.ui.unit.NanosecondsPerMillisecond
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
/**
@@ -144,7 +144,7 @@
): PointerInputData {
val pointerCoords = MotionEvent.PointerCoords()
motionEvent.getPointerCoords(index, pointerCoords)
- val offset = PxPosition(pointerCoords.x, pointerCoords.y)
+ val offset = Offset(pointerCoords.x, pointerCoords.y)
return PointerInputData(
timestamp,
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/PointerInput.kt b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/PointerInput.kt
index dc3969c..2f339da 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/PointerInput.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/pointerinput/PointerInput.kt
@@ -24,7 +24,7 @@
import androidx.ui.core.PointerInputChange
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.round
/**
@@ -96,7 +96,7 @@
internal val size: IntPxSize
get() = layoutCoordinates.size
internal val position: IntPxPosition
- get() = layoutCoordinates.localToGlobal(PxPosition.Origin).round()
+ get() = layoutCoordinates.localToGlobal(Offset.Zero).round()
internal val isAttached: Boolean
get() = layoutCoordinates.isAttached
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/selection/Selectable.kt b/ui/ui-core/src/main/java/androidx/ui/core/selection/Selectable.kt
index 9a6b35d..f585a98 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/selection/Selectable.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/selection/Selectable.kt
@@ -19,7 +19,7 @@
import androidx.ui.core.LayoutCoordinates
import androidx.ui.geometry.Rect
import androidx.ui.text.AnnotatedString
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Provides [Selection] information for a composable to SelectionContainer. Composables who can
@@ -42,8 +42,8 @@
* if selection is applied to this composable.
*/
fun getSelection(
- startPosition: PxPosition,
- endPosition: PxPosition,
+ startPosition: Offset,
+ endPosition: Offset,
containerLayoutCoordinates: LayoutCoordinates,
longPress: Boolean,
previousSelection: Selection? = null,
@@ -51,14 +51,14 @@
): Selection?
/**
- * Return the [PxPosition] of a [SelectionHandle].
+ * Return the [Offset] of a [SelectionHandle].
*
* @param selection [Selection] contains the [SelectionHandle]
* @param isStartHandle true if it's the start handle, false if it's the end handle.
*
- * @return [PxPosition] of this handle, based on which the [SelectionHandle] will be drawn.
+ * @return [Offset] of this handle, based on which the [SelectionHandle] will be drawn.
*/
- fun getHandlePosition(selection: Selection, isStartHandle: Boolean): PxPosition
+ fun getHandlePosition(selection: Selection, isStartHandle: Boolean): Offset
/**
* Return the [LayoutCoordinates] of the [Selectable].
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
index 5665510..e0fb3dd 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionManager.kt
@@ -33,7 +33,7 @@
import androidx.ui.text.AnnotatedString
import androidx.ui.text.length
import androidx.ui.text.subSequence
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import kotlin.math.max
import kotlin.math.min
@@ -87,13 +87,13 @@
* The beginning position of the drag gesture. Every time a new drag gesture starts, it wil be
* recalculated.
*/
- private var dragBeginPosition = PxPosition.Origin
+ private var dragBeginPosition = Offset.Zero
/**
* The total distance being dragged of the drag gesture. Every time a new drag gesture starts,
* it will be zeroed out.
*/
- private var dragTotalDistance = PxPosition.Origin
+ private var dragTotalDistance = Offset.Zero
/**
* A flag to check if the selection start or end handle is being dragged.
@@ -109,7 +109,7 @@
* It is a [State] so reading it during the composition will cause recomposition every time
* the position has been changed.
*/
- var startHandlePosition by mutableStateOf<PxPosition?>(null, areEquivalent = StructurallyEqual)
+ var startHandlePosition by mutableStateOf<Offset?>(null, areEquivalent = StructurallyEqual)
private set
/**
@@ -118,7 +118,7 @@
* It is a [State] so reading it during the composition will cause recomposition every time
* the position has been changed.
*/
- var endHandlePosition by mutableStateOf<PxPosition?>(null, areEquivalent = StructurallyEqual)
+ var endHandlePosition by mutableStateOf<Offset?>(null, areEquivalent = StructurallyEqual)
private set
init {
@@ -171,8 +171,8 @@
* Iterates over the handlers, gets the selection for each Composable, and merges all the
* returned [Selection]s.
*
- * @param startPosition [PxPosition] for the start of the selection
- * @param endPosition [PxPosition] for the end of the selection
+ * @param startPosition [Offset] for the start of the selection
+ * @param endPosition [Offset] for the end of the selection
* @param longPress the selection is a result of long press
* @param previousSelection previous selection
*
@@ -181,8 +181,8 @@
*/
// This function is internal for testing purposes.
internal fun mergeSelections(
- startPosition: PxPosition,
- endPosition: PxPosition,
+ startPosition: Offset,
+ endPosition: Offset,
longPress: Boolean = false,
previousSelection: Selection? = null,
isStartHandle: Boolean = true
@@ -307,7 +307,7 @@
var startTop = localLayoutCoordinates.childToLocal(
startLayoutCoordinates,
- PxPosition(
+ Offset(
0f,
selection.start.selectable.getBoundingBox(selection.start.offset).top
)
@@ -315,7 +315,7 @@
var endTop = localLayoutCoordinates.childToLocal(
endLayoutCoordinates,
- PxPosition(
+ Offset(
0.0f,
selection.end.selectable.getBoundingBox(selection.end.offset).top
)
@@ -342,15 +342,15 @@
// Call mergeSelections with an out of boundary input to inform all text widgets to
// cancel their individual selection.
mergeSelections(
- startPosition = PxPosition(-1f, -1f),
- endPosition = PxPosition(-1f, -1f),
+ startPosition = Offset(-1f, -1f),
+ endPosition = Offset(-1f, -1f),
previousSelection = selection
)
if (selection != null) onSelectionChange(null)
}
val longPressDragObserver = object : LongPressDragObserver {
- override fun onLongPress(pxPosition: PxPosition) {
+ override fun onLongPress(pxPosition: Offset) {
if (draggingHandle) return
val coordinates = containerLayoutCoordinates
if (coordinates == null || !coordinates.isAttached) return
@@ -369,12 +369,12 @@
// selection never started
if (selection == null) return
// Zero out the total distance that being dragged.
- dragTotalDistance = PxPosition.Origin
+ dragTotalDistance = Offset.Zero
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
// selection never started, did not consume any drag
- if (selection == null) return PxPosition.Origin
+ if (selection == null) return Offset.Zero
dragTotalDistance += dragDistance
val newSelection = mergeSelections(
@@ -396,13 +396,13 @@
* line's top offset, which is not included in current line's hit area. To be able to
* hit current line, move up this y coordinates by 1 pixel.
*/
- private fun getAdjustedCoordinates(position: PxPosition): PxPosition {
- return PxPosition(position.x, position.y - 1f)
+ private fun getAdjustedCoordinates(position: Offset): Offset {
+ return Offset(position.x, position.y - 1f)
}
fun handleDragObserver(isStartHandle: Boolean): DragObserver {
return object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
val selection = selection!!
// The LayoutCoordinates of the composable where the drag gesture should begin. This
// is used to convert the position of the beginning of the drag gesture from the
@@ -433,11 +433,11 @@
)
// Zero out the total distance that being dragged.
- dragTotalDistance = PxPosition.Origin
+ dragTotalDistance = Offset.Zero
draggingHandle = true
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
val selection = selection!!
dragTotalDistance += dragDistance
@@ -479,7 +479,7 @@
return dragDistance
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
super.onStop(velocity)
draggingHandle = false
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionRegistrarImpl.kt b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionRegistrarImpl.kt
index 724fc39..fb56822 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionRegistrarImpl.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/selection/SelectionRegistrarImpl.kt
@@ -17,7 +17,7 @@
package androidx.ui.core.selection
import androidx.ui.core.LayoutCoordinates
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
internal class SelectionRegistrarImpl : SelectionRegistrar {
/**
@@ -67,15 +67,15 @@
val positionA =
if (layoutCoordinatesA != null) containerLayoutCoordinates.childToLocal(
layoutCoordinatesA,
- PxPosition.Origin
+ Offset.Zero
)
- else PxPosition.Origin
+ else Offset.Zero
val positionB =
if (layoutCoordinatesB != null) containerLayoutCoordinates.childToLocal(
layoutCoordinatesB,
- PxPosition.Origin
+ Offset.Zero
)
- else PxPosition.Origin
+ else Offset.Zero
if (positionA.y == positionB.y) compareValues(positionA.x, positionB.x)
else compareValues(positionA.y, positionB.y)
diff --git a/ui/ui-core/src/main/java/androidx/ui/core/semantics/SemanticsNode.kt b/ui/ui-core/src/main/java/androidx/ui/core/semantics/SemanticsNode.kt
index e7ac627..a99e336 100644
--- a/ui/ui-core/src/main/java/androidx/ui/core/semantics/SemanticsNode.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/core/semantics/SemanticsNode.kt
@@ -26,7 +26,7 @@
import androidx.ui.semantics.SemanticsPropertyKey
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastForEach
/**
@@ -104,7 +104,7 @@
return layoutNode.coordinates.globalBounds
}
- val globalPosition: PxPosition
+ val globalPosition: Offset
get() {
return layoutNode.coordinates.globalPosition
}
diff --git a/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt b/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
index f6fa05c..70fca2d 100644
--- a/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
+++ b/ui/ui-core/src/main/java/androidx/ui/testutils/PointerInputTestUtil.kt
@@ -25,7 +25,7 @@
import androidx.ui.core.PointerInputHandler
import androidx.ui.unit.Duration
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.ipx
@@ -39,15 +39,15 @@
): PointerInputChange =
PointerInputChange(
PointerId(id),
- PointerInputData(Uptime.Boot + duration, PxPosition(x, y), true),
+ PointerInputData(Uptime.Boot + duration, Offset(x, y), true),
PointerInputData(null, null, false),
- ConsumedData(PxPosition.Origin, false)
+ ConsumedData(Offset.Zero, false)
)
fun PointerInputChange.moveTo(duration: Duration, x: Float = 0f, y: Float = 0f) =
copy(
previous = current,
- current = PointerInputData(Uptime.Boot + duration, PxPosition(x, y), true),
+ current = PointerInputData(Uptime.Boot + duration, Offset(x, y), true),
consumed = ConsumedData()
)
@@ -56,7 +56,7 @@
previous = current,
current = PointerInputData(
current.uptime!! + duration,
- PxPosition(current.position!!.x + dx, current.position.y + dy),
+ Offset(current.position!!.x + dx, current.position.y + dy),
true
),
consumed = ConsumedData()
@@ -72,7 +72,7 @@
fun PointerInputChange.consume(dx: Float = 0f, dy: Float = 0f, downChange: Boolean = false) =
copy(
consumed = consumed.copy(
- positionChange = PxPosition(
+ positionChange = Offset(
consumed.positionChange.x + dx,
consumed.positionChange.y + dy
), downChange = consumed.downChange || downChange
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
index 977a5c9..f9c9d42 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/LayoutNodeTest.kt
@@ -20,7 +20,7 @@
import androidx.ui.core.pointerinput.PointerInputModifier
import androidx.ui.core.pointerinput.resize
import androidx.ui.unit.IntPxPosition
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.anyOrNull
@@ -37,7 +37,6 @@
import org.junit.rules.ExpectedException
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
-import org.mockito.Mockito.mock
import org.mockito.Mockito.reset
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
@@ -343,11 +342,11 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val globalPosition = PxPosition(250f, 300f)
+ val globalPosition = Offset(250f, 300f)
val expectedX = globalPosition.x - x0.value.toFloat() - x1.value.toFloat()
val expectedY = globalPosition.y - y0.value.toFloat() - y1.value.toFloat()
- val expectedPosition = PxPosition(expectedX, expectedY)
+ val expectedPosition = Offset(expectedX, expectedY)
val result = node1.coordinates.globalToLocal(globalPosition)
@@ -368,11 +367,11 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val globalPosition = PxPosition(250f, 300f)
+ val globalPosition = Offset(250f, 300f)
val expectedX = globalPosition.x - x0.value.toFloat() - x1.value.toFloat()
val expectedY = globalPosition.y - y0.value.toFloat() - y1.value.toFloat()
- val expectedPosition = PxPosition(expectedX, expectedY)
+ val expectedPosition = Offset(expectedX, expectedY)
val result = node1.coordinates.globalToLocal(globalPosition)
@@ -393,11 +392,11 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val localPosition = PxPosition(5f, 15f)
+ val localPosition = Offset(5f, 15f)
val expectedX = localPosition.x + x0.value.toFloat() + x1.value.toFloat()
val expectedY = localPosition.y + y0.value.toFloat() + y1.value.toFloat()
- val expectedPosition = PxPosition(expectedX, expectedY)
+ val expectedPosition = Offset(expectedX, expectedY)
val result = node1.coordinates.localToGlobal(localPosition)
@@ -418,11 +417,11 @@
node0.place(x0, y0)
node1.place(x1, y1)
- val localPosition = PxPosition(5.ipx, 15.ipx)
+ val localPosition = Offset(5f, 15f)
val expectedX = localPosition.x + x0.value.toFloat() + x1.value.toFloat()
val expectedY = localPosition.y + y0.value.toFloat() + y1.value.toFloat()
- val expectedPosition = PxPosition(expectedX, expectedY)
+ val expectedPosition = Offset(expectedX, expectedY)
val result = node1.coordinates.localToGlobal(localPosition)
@@ -435,9 +434,9 @@
node.attach(mockOwner(IntPxPosition(20.ipx, 20.ipx)))
node.place(100.ipx, 10.ipx)
- val result = node.coordinates.localToGlobal(PxPosition.Origin)
+ val result = node.coordinates.localToGlobal(Offset.Zero)
- assertEquals(PxPosition(120f, 30f), result)
+ assertEquals(Offset(120f, 30f), result)
}
@Test
@@ -446,9 +445,9 @@
node.attach(mockOwner(IntPxPosition(20.ipx, 20.ipx)))
node.place(100.ipx, 10.ipx)
- val result = node.coordinates.localToGlobal(PxPosition.Origin)
+ val result = node.coordinates.localToGlobal(Offset.Zero)
- assertEquals(PxPosition(120.ipx, 30.ipx), result)
+ assertEquals(Offset(120f, 30f), result)
}
@Test
@@ -463,11 +462,11 @@
node0.place(100.ipx, 10.ipx)
node1.place(x1, y1)
- val localPosition = PxPosition(5f, 15f)
+ val localPosition = Offset(5f, 15f)
val expectedX = localPosition.x + x1.value.toFloat()
val expectedY = localPosition.y + y1.value.toFloat()
- val expectedPosition = PxPosition(expectedX, expectedY)
+ val expectedPosition = Offset(expectedX, expectedY)
val result = node0.coordinates.childToLocal(node1.coordinates, localPosition)
@@ -485,7 +484,7 @@
thrown.expect(IllegalStateException::class.java)
- node2.coordinates.childToLocal(node1.coordinates, PxPosition(5f, 15f))
+ node2.coordinates.childToLocal(node1.coordinates, Offset(5f, 15f))
}
@Test
@@ -498,14 +497,14 @@
thrown.expect(IllegalStateException::class.java)
- node1.coordinates.childToLocal(node0.coordinates, PxPosition(5f, 15f))
+ node1.coordinates.childToLocal(node0.coordinates, Offset(5f, 15f))
}
@Test
fun testChildToLocalTheSameNode() {
val node = LayoutNode()
node.attach(mockOwner())
- val position = PxPosition(5f, 15f)
+ val position = Offset(5f, 15f)
val result = node.coordinates.childToLocal(node.coordinates, position)
@@ -523,7 +522,7 @@
val actual = child.coordinates.positionInRoot
- assertEquals(PxPosition(-50.ipx, 90.ipx), actual)
+ assertEquals(Offset(-50f, 90f), actual)
}
@Test
@@ -536,7 +535,7 @@
val actual = child.coordinates.positionInRoot
- assertEquals(PxPosition(50.ipx, 80.ipx), actual)
+ assertEquals(Offset(50f, 80f), actual)
}
@Test
@@ -548,9 +547,9 @@
parent.place(-100.ipx, 10.ipx)
child.place(50.ipx, 80.ipx)
- val actual = parent.coordinates.childToLocal(child.coordinates, PxPosition.Origin)
+ val actual = parent.coordinates.childToLocal(child.coordinates, Offset.Zero)
- assertEquals(PxPosition(50f, 80f), actual)
+ assertEquals(Offset(50f, 80f), actual)
}
@Test
@@ -565,9 +564,9 @@
parent.place(23.ipx, -13.ipx)
child.place(-3.ipx, 11.ipx)
- val actual = grandParent.coordinates.childToLocal(child.coordinates, PxPosition.Origin)
+ val actual = grandParent.coordinates.childToLocal(child.coordinates, Offset.Zero)
- assertEquals(PxPosition(20f, -2f), actual)
+ assertEquals(Offset(20f, -2f), actual)
}
// LayoutNode shouldn't allow adding beyond the count
@@ -707,7 +706,7 @@
}
val hit = mutableListOf<PointerInputFilter>()
- layoutNode.hitTest(PxPosition(0.ipx, 0.ipx), hit)
+ layoutNode.hitTest(Offset(0f, 0f), hit)
assertThat(hit).isEqualTo(listOf(pointerInputFilter))
}
@@ -724,17 +723,17 @@
}
val hit = mutableListOf<PointerInputFilter>()
- layoutNode.hitTest(PxPosition(-1.ipx, -1.ipx), hit)
- layoutNode.hitTest(PxPosition(0.ipx, -1.ipx), hit)
- layoutNode.hitTest(PxPosition(1.ipx, -1.ipx), hit)
+ layoutNode.hitTest(Offset(-1f, -1f), hit)
+ layoutNode.hitTest(Offset(0f, -1f), hit)
+ layoutNode.hitTest(Offset(1f, -1f), hit)
- layoutNode.hitTest(PxPosition(-1.ipx, 0.ipx), hit)
+ layoutNode.hitTest(Offset(-1f, 0f), hit)
// 0, 0 would hit
- layoutNode.hitTest(PxPosition(1.ipx, 0.ipx), hit)
+ layoutNode.hitTest(Offset(1f, 0f), hit)
- layoutNode.hitTest(PxPosition(-1.ipx, 1.ipx), hit)
- layoutNode.hitTest(PxPosition(0.ipx, 1.ipx), hit)
- layoutNode.hitTest(PxPosition(1.ipx, 1.ipx), hit)
+ layoutNode.hitTest(Offset(-1f, 1f), hit)
+ layoutNode.hitTest(Offset(0f, 1f), hit)
+ layoutNode.hitTest(Offset(1f, 1f), hit)
assertThat(hit).isEmpty()
}
@@ -789,9 +788,9 @@
}
val offset = when (numberOfChildrenHit) {
- 3 -> PxPosition(250f, 250f)
- 2 -> PxPosition(150f, 150f)
- 1 -> PxPosition(50f, 50f)
+ 3 -> Offset(250f, 250f)
+ 2 -> Offset(150f, 150f)
+ 1 -> Offset(50f, 50f)
else -> throw IllegalStateException()
}
@@ -877,8 +876,8 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25f, 25f)
- val offset2 = PxPosition(75f, 75f)
+ val offset1 = Offset(25f, 25f)
+ val offset2 = Offset(75f, 75f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -954,9 +953,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25f, 25f)
- val offset2 = PxPosition(75f, 75f)
- val offset3 = PxPosition(125f, 125f)
+ val offset1 = Offset(25f, 25f)
+ val offset2 = Offset(75f, 75f)
+ val offset3 = Offset(125f, 125f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1016,9 +1015,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(50f, 25f)
- val offset2 = PxPosition(50f, 75f)
- val offset3 = PxPosition(50f, 125f)
+ val offset1 = Offset(50f, 25f)
+ val offset2 = Offset(50f, 75f)
+ val offset3 = Offset(50f, 125f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1078,9 +1077,9 @@
attach(mockOwner())
}
- val offset1 = PxPosition(25f, 50f)
- val offset2 = PxPosition(75f, 50f)
- val offset3 = PxPosition(125f, 50f)
+ val offset1 = Offset(25f, 50f)
+ val offset2 = Offset(75f, 50f)
+ val offset3 = Offset(125f, 50f)
val hit1 = mutableListOf<PointerInputFilter>()
val hit2 = mutableListOf<PointerInputFilter>()
@@ -1164,21 +1163,21 @@
attach(mockOwner())
}
- val offsetThatHits1 = PxPosition(1f, 1f)
- val offsetThatHits2 = PxPosition(3f, 1f)
- val offsetThatHits3 = PxPosition(1f, 3f)
- val offsetThatHits4 = PxPosition(3f, 3f)
+ val offsetThatHits1 = Offset(1f, 1f)
+ val offsetThatHits2 = Offset(3f, 1f)
+ val offsetThatHits3 = Offset(1f, 3f)
+ val offsetThatHits4 = Offset(3f, 3f)
val offsetsThatMiss =
listOf(
- PxPosition(1f, 0f),
- PxPosition(3f, 0f),
- PxPosition(0f, 1f),
- PxPosition(4f, 1f),
- PxPosition(0f, 3f),
- PxPosition(4f, 3f),
- PxPosition(1f, 4f),
- PxPosition(3f, 4f)
+ Offset(1f, 0f),
+ Offset(3f, 0f),
+ Offset(0f, 1f),
+ Offset(4f, 1f),
+ Offset(0f, 3f),
+ Offset(4f, 3f),
+ Offset(1f, 4f),
+ Offset(3f, 4f)
)
val hit1 = mutableListOf<PointerInputFilter>()
@@ -1244,14 +1243,14 @@
attach(mockOwner(IntPxPosition(1.ipx, 1.ipx)))
}
- val offsetThatHits1 = PxPosition(2f, 2f)
- val offsetThatHits2 = PxPosition(2f, 1f)
- val offsetThatHits3 = PxPosition(1f, 2f)
+ val offsetThatHits1 = Offset(2f, 2f)
+ val offsetThatHits2 = Offset(2f, 1f)
+ val offsetThatHits3 = Offset(1f, 2f)
val offsetsThatMiss =
listOf(
- PxPosition(0f, 0f),
- PxPosition(0f, 1f),
- PxPosition(1f, 0f)
+ Offset(0f, 0f),
+ Offset(0f, 1f),
+ Offset(1f, 0f)
)
val hit1 = mutableListOf<PointerInputFilter>()
@@ -1303,7 +1302,7 @@
attach(mockOwner())
}
- val offset1 = PxPosition(50f, 75f)
+ val offset1 = Offset(50f, 75f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1347,7 +1346,7 @@
}.apply {
attach(mockOwner())
}
- val offset1 = PxPosition(499f, 499f)
+ val offset1 = Offset(499f, 499f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1402,7 +1401,7 @@
attach(mockOwner())
}
- val offset1 = PxPosition(499f, 499f)
+ val offset1 = Offset(499f, 499f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1447,7 +1446,7 @@
attach(mockOwner())
}
- val offset = PxPosition(50f, 50f)
+ val offset = Offset(50f, 50f)
val hit = mutableListOf<PointerInputFilter>()
@@ -1474,7 +1473,7 @@
attach(mockOwner())
}
- val offset = PxPosition.Origin
+ val offset = Offset.Zero
val hit = mutableListOf<PointerInputFilter>()
@@ -1519,7 +1518,7 @@
// Act.
- parent.hitTest(PxPosition(1f, 1f), hit)
+ parent.hitTest(Offset(1f, 1f), hit)
// Assert.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
index e82abb5..aa8c1e8 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/PointerInputTest.kt
@@ -17,7 +17,7 @@
package androidx.ui.core
import androidx.test.filters.SmallTest
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.milliseconds
import org.hamcrest.CoreMatchers.`is`
@@ -185,7 +185,7 @@
createPointerInputChange(11f, 13f, true, 11f, 13f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition.Origin))
+ `is`(equalTo(Offset.Zero))
)
}
@@ -195,7 +195,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition(6f, 12f)))
+ `is`(equalTo(Offset(6f, 12f)))
)
}
@@ -205,7 +205,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 5f, 9f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition(1f, 3f)))
+ `is`(equalTo(Offset(1f, 3f)))
)
}
@@ -215,7 +215,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 6f, 12f, false)
assertThat(
pointerInputChange.positionChange(),
- `is`(equalTo(PxPosition.Origin))
+ `is`(equalTo(Offset.Zero))
)
}
@@ -225,7 +225,7 @@
createPointerInputChange(11f, 13f, true, 11f, 13f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition.Origin))
+ `is`(equalTo(Offset.Zero))
)
}
@@ -235,7 +235,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 0f, 0f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6f, 12f)))
+ `is`(equalTo(Offset(6f, 12f)))
)
}
@@ -245,7 +245,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 5f, 9f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6f, 12f)))
+ `is`(equalTo(Offset(6f, 12f)))
)
}
@@ -255,7 +255,7 @@
createPointerInputChange(8f, 16f, true, 2f, 4f, true, 6f, 12f, false)
assertThat(
pointerInputChange.positionChangeIgnoreConsumed(),
- `is`(equalTo(PxPosition(6f, 12f)))
+ `is`(equalTo(Offset(6f, 12f)))
)
}
@@ -583,15 +583,15 @@
PointerId(0),
PointerInputData(
Uptime.Boot + 100.milliseconds,
- PxPosition(currentX, currentY),
+ Offset(currentX, currentY),
currentDown
),
PointerInputData(
Uptime.Boot + 0.milliseconds,
- PxPosition(previousX, previousY),
+ Offset(previousX, previousY),
previousDown
),
- ConsumedData(PxPosition(consumedX, consumedY), consumedDown)
+ ConsumedData(Offset(consumedX, consumedY), consumedDown)
)
}
}
\ No newline at end of file
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
index f7c77ed..7b7b741 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/DoubleTapGestureFilterTest.kt
@@ -27,7 +27,7 @@
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -55,7 +55,7 @@
private val DoubleTapTimeoutMillis = 100.milliseconds
@Suppress("DEPRECATION")
private val testContext = kotlinx.coroutines.test.TestCoroutineContext()
- private val onDoubleTap: (PxPosition) -> Unit = mock()
+ private val onDoubleTap: (Offset) -> Unit = mock()
private val customEventDispatcher: CustomEventDispatcher = mock()
private lateinit var filter: DoubleTapGestureFilter
@@ -524,7 +524,7 @@
filter::onPointerInput.invokeOverAllPasses(down2)
filter::onPointerInput.invokeOverAllPasses(up2)
- verify(onDoubleTap).invoke(PxPosition.Origin)
+ verify(onDoubleTap).invoke(Offset.Zero)
}
@Test
@@ -542,7 +542,7 @@
filter::onPointerInput.invokeOverAllPasses(move2)
filter::onPointerInput.invokeOverAllPasses(up2)
- verify(onDoubleTap).invoke(PxPosition(3f, 5f))
+ verify(onDoubleTap).invoke(Offset(3f, 5f))
}
@Test
@@ -565,7 +565,7 @@
filter::onPointerInput.invokeOverAllPasses(up2A, move2B2)
filter::onPointerInput.invokeOverAllPasses(up2B)
- verify(onDoubleTap).invoke(PxPosition(7f, 11f))
+ verify(onDoubleTap).invoke(Offset(7f, 11f))
}
// Tests that verify correct consumption behavior
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
index d4b6d4a..3ff6562 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/LongPressGestureFilterTest.kt
@@ -27,7 +27,7 @@
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -48,7 +48,7 @@
private val LongPressTimeoutMillis = 100.milliseconds
@Suppress("DEPRECATION")
private val testContext = kotlinx.coroutines.test.TestCoroutineContext()
- private val onLongPress: (PxPosition) -> Unit = mock()
+ private val onLongPress: (Offset) -> Unit = mock()
private val customEventDispatcher: CustomEventDispatcher = mock()
private lateinit var filter: LongPressGestureFilter
@@ -276,7 +276,7 @@
filter::onPointerInput.invokeOverAllPasses(down)
testContext.advanceTimeBy(100, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(13f, 17f))
+ verify(onLongPress).invoke(Offset(13f, 17f))
}
@Test
@@ -289,7 +289,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(7f, 5f))
+ verify(onLongPress).invoke(Offset(7f, 5f))
}
@Test
@@ -304,7 +304,7 @@
filter::onPointerInput.invokeOverAllPasses(move0, down1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(13f, 17f))
+ verify(onLongPress).invoke(Offset(13f, 17f))
}
@Test
@@ -324,7 +324,7 @@
filter::onPointerInput.invokeOverAllPasses(up0, move1)
testContext.advanceTimeBy(25, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(11f, 19f))
+ verify(onLongPress).invoke(Offset(11f, 19f))
}
@Test
@@ -339,7 +339,7 @@
filter::onPointerInput.invokeOverAllPasses(move0, down1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(27f, 29f))
+ verify(onLongPress).invoke(Offset(27f, 29f))
}
@Test
@@ -359,7 +359,7 @@
filter::onPointerInput.invokeOverAllPasses(up0, move1)
testContext.advanceTimeBy(50, TimeUnit.MILLISECONDS)
- verify(onLongPress).invoke(PxPosition(27f, 23f))
+ verify(onLongPress).invoke(Offset(27f, 23f))
}
// Tests that verify that consumption behavior
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
index 42153bb..fa0f950 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/PressIndicatorGestureFilterTest.kt
@@ -26,7 +26,7 @@
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.nhaarman.mockitokotlin2.any
@@ -448,7 +448,7 @@
fun onPointerInput_down_downPositionIsCorrect() {
filter::onPointerInput
.invokeOverAllPasses(down(0, 0.milliseconds, x = 13f, y = 17f))
- verify(filter.onStart!!).invoke(PxPosition(13f, 17f))
+ verify(filter.onStart!!).invoke(Offset(13f, 17f))
}
// Verification of correct consumption behavior.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
index 7ef81c0..c8b3cf5 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawDragGestureFilterTest.kt
@@ -28,7 +28,7 @@
import androidx.ui.testutils.up
import androidx.ui.unit.Duration
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -219,8 +219,8 @@
assertThat(onDragLog).hasSize(2)
// OnDrags get's called twice each time because RawDragGestureDetector calls it on both
// PostUp and PostDown and the distance is not consumed by PostUp.
- assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(5f, -2f))
- assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(5f, -2f))
+ assertThat(onDragLog[0].pxPosition).isEqualTo(Offset(5f, -2f))
+ assertThat(onDragLog[1].pxPosition).isEqualTo(Offset(5f, -2f))
}
@Test
@@ -251,14 +251,14 @@
assertThat(onDragLog).hasSize(8)
// OnDrags get's called twice each time because RawDragGestureDetector calls it on both
// PostUp and PostDown and the distance is not consumed by PostUp.
- assertThat(onDragLog[0].pxPosition).isEqualTo(PxPosition(3f, -5f))
- assertThat(onDragLog[1].pxPosition).isEqualTo(PxPosition(3f, -5f))
- assertThat(onDragLog[2].pxPosition).isEqualTo(PxPosition(-3f, 7f))
- assertThat(onDragLog[3].pxPosition).isEqualTo(PxPosition(-3f, 7f))
- assertThat(onDragLog[4].pxPosition).isEqualTo(PxPosition(6f, 10f))
- assertThat(onDragLog[5].pxPosition).isEqualTo(PxPosition(6f, 10f))
- assertThat(onDragLog[6].pxPosition).isEqualTo(PxPosition(-10f, -6f))
- assertThat(onDragLog[7].pxPosition).isEqualTo(PxPosition(-10f, -6f))
+ assertThat(onDragLog[0].pxPosition).isEqualTo(Offset(3f, -5f))
+ assertThat(onDragLog[1].pxPosition).isEqualTo(Offset(3f, -5f))
+ assertThat(onDragLog[2].pxPosition).isEqualTo(Offset(-3f, 7f))
+ assertThat(onDragLog[3].pxPosition).isEqualTo(Offset(-3f, 7f))
+ assertThat(onDragLog[4].pxPosition).isEqualTo(Offset(6f, 10f))
+ assertThat(onDragLog[5].pxPosition).isEqualTo(Offset(6f, 10f))
+ assertThat(onDragLog[6].pxPosition).isEqualTo(Offset(-10f, -6f))
+ assertThat(onDragLog[7].pxPosition).isEqualTo(Offset(-10f, -6f))
}
@Test
@@ -287,10 +287,10 @@
// 2 onDrags because RawDragGestureDetector calls onDrag on both PostUp and PostDown and the
// distance is never consumed.
assertThat(onDragLog[0].pxPosition).isEqualTo(
- PxPosition(3f, -4f)
+ Offset(3f, -4f)
)
assertThat(onDragLog[1].pxPosition).isEqualTo(
- PxPosition(3f, -4f)
+ Offset(3f, -4f)
)
}
@@ -439,7 +439,7 @@
1f,
0f
)
- dragObserver.dragConsume = PxPosition(7.ipx, (-11).ipx)
+ dragObserver.dragConsume = Offset(7f, -11f)
var result = filter::onPointerInput.invokeOverPasses(
change,
PointerEventPass.InitialDown,
@@ -447,7 +447,7 @@
PointerEventPass.PreDown,
PointerEventPass.PostUp
)
- dragObserver.dragConsume = PxPosition.Origin
+ dragObserver.dragConsume = Offset.Zero
result = filter::onPointerInput.invokeOverPasses(
result,
PointerEventPass.InitialDown,
@@ -461,7 +461,7 @@
@Test
fun onPointerInput_unblockedDownMoveCallBackDoesNotConsume_distanceChangeNotConsumed() {
- dragObserver.dragConsume = PxPosition.Origin
+ dragObserver.dragConsume = Offset.Zero
var change = down(0, 0.milliseconds)
filter::onPointerInput.invokeOverAllPasses(change)
@@ -506,7 +506,7 @@
3f,
-5f
)
- dragObserver.dragConsume = PxPosition(7.ipx, (-11).ipx)
+ dragObserver.dragConsume = Offset(7f, -11f)
var result = filter::onPointerInput.invokeOverPasses(
change,
PointerEventPass.InitialDown,
@@ -514,7 +514,7 @@
PointerEventPass.PreDown,
PointerEventPass.PostUp
)
- dragObserver.dragConsume = PxPosition.Origin
+ dragObserver.dragConsume = Offset.Zero
result = filter::onPointerInput.invokeOverPasses(
result,
PointerEventPass.PostDown
@@ -552,7 +552,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
- .isEqualTo(PxPosition(3f, 4f))
+ .isEqualTo(Offset(3f, 4f))
}
@Test
@@ -573,7 +573,7 @@
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
// average position
- .isEqualTo(PxPosition(3f, 4f))
+ .isEqualTo(Offset(3f, 4f))
}
// Tests that verify when onCancel should not be called.
@@ -630,7 +630,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
assertThat(log.first { it.methodName == "onStart" }.pxPosition)
- .isEqualTo(PxPosition(7f, 11f))
+ .isEqualTo(Offset(7f, 11f))
}
@Test
@@ -679,25 +679,25 @@
data class LogItem(
val methodName: String,
- val pxPosition: PxPosition? = null
+ val pxPosition: Offset? = null
)
class MockDragObserver(
private val log: MutableList<LogItem>,
- var dragConsume: PxPosition? = null
+ var dragConsume: Offset? = null
) : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
log.add(LogItem("onStart", pxPosition = downPosition))
super.onStart(downPosition)
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
log.add(LogItem("onDrag", pxPosition = dragDistance))
return dragConsume ?: super.onDrag(dragDistance)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
log.add(LogItem("onStop", pxPosition = velocity))
super.onStop(velocity)
}
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
index 40cec62..44127cf 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawPressStartGestureFilterTest.kt
@@ -25,7 +25,7 @@
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.nhaarman.mockitokotlin2.any
@@ -143,7 +143,7 @@
@Test
fun onPointerInput_down_downPositionIsCorrect() {
filter::onPointerInput.invokeOverAllPasses(down(0, x = 13f, y = 17f))
- verify(filter.onPressStart).invoke(PxPosition(13f, 17f))
+ verify(filter.onPressStart).invoke(Offset(13f, 17f))
}
// Verification of correct consumption behavior.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
index 86cfa61..28c3495 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/RawScaleGestureFilterTest.kt
@@ -26,7 +26,7 @@
import androidx.ui.testutils.moveBy
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
import org.junit.Before
@@ -664,9 +664,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1f, 0f))
+ .isEqualTo(Offset(-1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1f, 0f))
+ .isEqualTo(Offset(1f, 0f))
}
@Test
@@ -698,9 +698,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, -1f))
+ .isEqualTo(Offset(0f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, 1f))
+ .isEqualTo(Offset(0f, 1f))
}
@Test
@@ -716,9 +716,9 @@
val result = filter::onPointerInput.invokeOverAllPasses(change1, change2)
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1f, -1f))
+ .isEqualTo(Offset(-1f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1f, 1f))
+ .isEqualTo(Offset(1f, 1f))
}
@Test
@@ -750,9 +750,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(1f, 0f))
+ .isEqualTo(Offset(1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1f, 0f))
+ .isEqualTo(Offset(-1f, 0f))
}
@Test
@@ -784,9 +784,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, 1f))
+ .isEqualTo(Offset(0f, 1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, -1f))
+ .isEqualTo(Offset(0f, -1f))
}
@Test
@@ -801,8 +801,8 @@
change2 = change2.moveTo(10.milliseconds, 6f, 6f)
val result = filter::onPointerInput.invokeOverAllPasses(change1, change2)
- assertThat(result[0].consumed.positionChange).isEqualTo(PxPosition(2f, 2f))
- assertThat(result[1].consumed.positionChange).isEqualTo(PxPosition(-2f, -2f))
+ assertThat(result[0].consumed.positionChange).isEqualTo(Offset(2f, 2f))
+ assertThat(result[1].consumed.positionChange).isEqualTo(Offset(-2f, -2f))
}
@Test
@@ -836,9 +836,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1f, 0f))
+ .isEqualTo(Offset(-1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(1f, 0f))
+ .isEqualTo(Offset(1f, 0f))
}
@Test
@@ -870,9 +870,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, -1f))
+ .isEqualTo(Offset(0f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, 1f))
+ .isEqualTo(Offset(0f, 1f))
}
@Test
@@ -904,9 +904,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(1f, 0f))
+ .isEqualTo(Offset(1f, 0f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-1f, 0f))
+ .isEqualTo(Offset(-1f, 0f))
}
@Test
@@ -938,9 +938,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, 1f))
+ .isEqualTo(Offset(0f, 1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(0f, -1f))
+ .isEqualTo(Offset(0f, -1f))
}
@Test
@@ -972,9 +972,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(.5f, -1.5f))
+ .isEqualTo(Offset(.5f, -1.5f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-.5f, 1.5f))
+ .isEqualTo(Offset(-.5f, 1.5f))
}
@Test
@@ -1006,9 +1006,9 @@
// Assert
assertThat(result.first { it.id == PointerId(0) }.consumed.positionChange)
- .isEqualTo(PxPosition(2f, -1f))
+ .isEqualTo(Offset(2f, -1f))
assertThat(result.first { it.id == PointerId(1) }.consumed.positionChange)
- .isEqualTo(PxPosition(-2f, 1f))
+ .isEqualTo(Offset(-2f, 1f))
}
@Test
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
index 7024b0e..da46e86 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/TapGestureFilterTest.kt
@@ -28,7 +28,7 @@
import androidx.ui.testutils.moveTo
import androidx.ui.testutils.up
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.milliseconds
import com.nhaarman.mockitokotlin2.any
@@ -193,7 +193,7 @@
filter::onPointerInput.invokeOverAllPasses(down)
filter::onPointerInput.invokeOverAllPasses(up)
- verify(filter.onTap).invoke(PxPosition(123f, 456f))
+ verify(filter.onTap).invoke(Offset(123f, 456f))
}
@Test
@@ -206,7 +206,7 @@
filter::onPointerInput.invokeOverAllPasses(move)
filter::onPointerInput.invokeOverAllPasses(up)
- verify(filter.onTap).invoke(PxPosition(321f, 654f))
+ verify(filter.onTap).invoke(Offset(321f, 654f))
}
@Test
@@ -226,7 +226,7 @@
filter::onPointerInput.invokeOverAllPasses(upA, moveB)
filter::onPointerInput.invokeOverAllPasses(upB)
- verify(filter.onTap).invoke(PxPosition(321f, 654f))
+ verify(filter.onTap).invoke(Offset(321f, 654f))
}
@Test
@@ -246,7 +246,7 @@
filter::onPointerInput.invokeOverAllPasses(moveA2, upB)
filter::onPointerInput.invokeOverAllPasses(upA)
- verify(filter.onTap).invoke(PxPosition(123f, 456f))
+ verify(filter.onTap).invoke(Offset(123f, 456f))
}
@Test
@@ -262,7 +262,7 @@
filter::onPointerInput.invokeOverAllPasses(up)
filter::onCustomEvent.invokeOverAllPasses(delayUpNotConsumed)
- verify(filter.onTap).invoke(PxPosition(123f, 456f))
+ verify(filter.onTap).invoke(Offset(123f, 456f))
}
@Test
@@ -285,7 +285,7 @@
filter::onPointerInput.invokeOverAllPasses(upA, moveB)
filter::onPointerInput.invokeOverAllPasses(upB)
- verify(filter.onTap).invoke(PxPosition(321f, 654f))
+ verify(filter.onTap).invoke(Offset(321f, 654f))
}
@Test
@@ -312,7 +312,7 @@
filter::onPointerInput.invokeOverAllPasses(upB)
filter::onCustomEvent.invokeOverAllPasses(delayUpNotConsumed)
- verify(filter.onTap).invoke(PxPosition(321f, 654f))
+ verify(filter.onTap).invoke(Offset(321f, 654f))
}
// Verification that the down changes should not be consumed.
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
index 2a2f421..2e4b73f 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/gesture/util/VelocityTrackerTest.kt
@@ -17,7 +17,7 @@
package androidx.ui.core.gesture.util
import androidx.ui.core.PointerInputData
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.Velocity
import androidx.ui.unit.milliseconds
@@ -119,7 +119,7 @@
* This extracts the inline PxPosition to a separate function so that velocityEventData
* creation doesn't make the function too long for dex.
*/
-private fun createPxPosition(width: Float, height: Float) = PxPosition(width, height)
+private fun createPxPosition(width: Float, height: Float) = Offset(width, height)
val velocityEventData: List<PointerInputData> = listOf(
PointerInputData(
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
index e2b89f1..3f2b7a1 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/HitPathTrackerTest.kt
@@ -33,7 +33,7 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
@@ -3008,19 +3008,19 @@
override val parentCoordinates: LayoutCoordinates?
get() = TODO("not implemented")
- override fun globalToLocal(global: PxPosition): PxPosition {
+ override fun globalToLocal(global: Offset): Offset {
TODO("not implemented")
}
- override fun localToGlobal(local: PxPosition): PxPosition {
+ override fun localToGlobal(local: Offset): Offset {
return local
}
- override fun localToRoot(local: PxPosition): PxPosition {
+ override fun localToRoot(local: Offset): Offset {
TODO("not implemented")
}
- override fun childToLocal(child: LayoutCoordinates, childLocal: PxPosition): PxPosition {
+ override fun childToLocal(child: LayoutCoordinates, childLocal: Offset): Offset {
TODO("not implemented")
}
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
index dfbc831..4a33465 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/PointerInputEventProcessorTest.kt
@@ -29,9 +29,10 @@
import androidx.ui.core.consumePositionChange
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.ipx
+import androidx.ui.unit.minus
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
@@ -103,8 +104,8 @@
root.insertAt(0, layoutNode)
- val offset = PxPosition(100f, 200f)
- val offset2 = PxPosition(300f, 400f)
+ val offset = Offset(100f, 200f)
+ val offset2 = Offset(300f, 400f)
val events = arrayOf(
PointerInputEvent(8712, Uptime.Boot + 3.milliseconds, offset, true),
@@ -164,7 +165,7 @@
// Arrange
- val childOffset = PxPosition(100f, 200f)
+ val childOffset = Offset(100f, 200f)
val pointerInputFilter: PointerInputFilter = spy()
val layoutNode = LayoutNode(
100, 200, 301, 401,
@@ -176,10 +177,10 @@
root.insertAt(0, layoutNode)
val offsets = arrayOf(
- PxPosition(100f, 200f),
- PxPosition(300f, 200f),
- PxPosition(100f, 400f),
- PxPosition(300f, 400f)
+ Offset(100f, 200f),
+ Offset(300f, 200f),
+ Offset(100f, 400f),
+ Offset(300f, 400f)
)
val events = Array(4) { index ->
@@ -239,14 +240,14 @@
root.insertAt(0, layoutNode)
val offsets = arrayOf(
- PxPosition(99f, 200f),
- PxPosition(99f, 400f),
- PxPosition(100f, 199f),
- PxPosition(100f, 401f),
- PxPosition(300f, 199f),
- PxPosition(300f, 401f),
- PxPosition(301f, 200f),
- PxPosition(301f, 400f)
+ Offset(99f, 200f),
+ Offset(99f, 400f),
+ Offset(100f, 199f),
+ Offset(100f, 401f),
+ Offset(300f, 199f),
+ Offset(300f, 401f),
+ Offset(301f, 200f),
+ Offset(301f, 400f)
)
val events = Array(8) { index ->
@@ -314,9 +315,9 @@
root.insertAt(0, parentLayoutNode)
val offset = when (numberOfChildrenHit) {
- 3 -> PxPosition(250f, 250f)
- 2 -> PxPosition(150f, 150f)
- 1 -> PxPosition(50f, 50f)
+ 3 -> Offset(250f, 250f)
+ 2 -> Offset(150f, 150f)
+ 1 -> Offset(50f, 50f)
else -> throw IllegalStateException()
}
@@ -393,21 +394,21 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 0f),
+ Offset(100f, 0f),
true
),
- previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0f, 0f), true),
- consumed = ConsumedData(positionChange = PxPosition(0f, 0f))
+ previous = PointerInputData(Uptime.Boot + 3.milliseconds, Offset(0f, 0f), true),
+ consumed = ConsumedData(positionChange = Offset(0f, 0f))
)
val output = PointerInputChange(
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 0f),
+ Offset(100f, 0f),
true
),
- previous = PointerInputData(Uptime.Boot + 3.milliseconds, PxPosition(0f, 0f), true),
- consumed = ConsumedData(positionChange = PxPosition(13f, 0f))
+ previous = PointerInputData(Uptime.Boot + 3.milliseconds, Offset(0f, 0f), true),
+ consumed = ConsumedData(positionChange = Offset(13f, 0f))
)
val pointerInputFilter: PointerInputFilter =
@@ -435,13 +436,13 @@
val down = PointerInputEvent(
0,
Uptime.Boot + 3.milliseconds,
- PxPosition(0f, 0f),
+ Offset(0f, 0f),
true
)
val move = PointerInputEvent(
0,
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 0f),
+ Offset(100f, 0f),
true
)
@@ -518,14 +519,14 @@
val middlePointerInputFilter: PointerInputFilter = spy()
val parentPointerInputFilter: PointerInputFilter = spy()
- val childOffset = PxPosition(cX1.toFloat(), cY1.toFloat())
+ val childOffset = Offset(cX1.toFloat(), cY1.toFloat())
val childLayoutNode = LayoutNode(
cX1, cY1, cX2, cY2,
PointerInputModifierImpl(
childPointerInputFilter
)
)
- val middleOffset = PxPosition(mX1.toFloat(), mY1.toFloat())
+ val middleOffset = Offset(mX1.toFloat(), mY1.toFloat())
val middleLayoutNode: LayoutNode = LayoutNode(
mX1, mY1, mX2, mY2,
PointerInputModifierImpl(
@@ -549,7 +550,7 @@
val additionalOffset = IntPxPosition(aOX.ipx, aOY.ipx)
- val offset = PxPosition(pointerX.toFloat(), pointerY.toFloat())
+ val offset = Offset(pointerX.toFloat(), pointerY.toFloat())
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
@@ -669,8 +670,8 @@
insertAt(0, childLayoutNode2)
}
- val offset1 = PxPosition(25f, 25f)
- val offset2 = PxPosition(75f, 75f)
+ val offset1 = Offset(25f, 25f)
+ val offset2 = Offset(75f, 75f)
val down = PointerInputEvent(
Uptime.Boot + 5.milliseconds,
@@ -690,7 +691,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset2 - PxPosition(50f, 50f),
+ offset2 - Offset(50f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -780,9 +781,9 @@
insertAt(2, childLayoutNode3)
}
- val offset1 = PxPosition(25f, 25f)
- val offset2 = PxPosition(75f, 75f)
- val offset3 = PxPosition(125f, 125f)
+ val offset1 = Offset(25f, 25f)
+ val offset2 = Offset(75f, 75f)
+ val offset3 = Offset(125f, 125f)
val down = PointerInputEvent(
Uptime.Boot + 5.milliseconds,
@@ -803,7 +804,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset2 - PxPosition(50f, 50f),
+ offset2 - Offset(50f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -813,7 +814,7 @@
id = PointerId(2),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- offset3 - PxPosition(100f, 100f),
+ offset3 - Offset(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -902,9 +903,9 @@
insertAt(1, childLayoutNode2)
}
- val offset1 = PxPosition(50f, 25f)
- val offset2 = PxPosition(50f, 75f)
- val offset3 = PxPosition(50f, 125f)
+ val offset1 = Offset(50f, 25f)
+ val offset2 = Offset(50f, 75f)
+ val offset3 = Offset(50f, 125f)
val down = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -925,7 +926,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset2 - PxPosition(25f, 50f),
+ offset2 - Offset(25f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -1007,9 +1008,9 @@
insertAt(1, childLayoutNode2)
}
- val offset1 = PxPosition(25f, 50f)
- val offset2 = PxPosition(75f, 50f)
- val offset3 = PxPosition(125f, 50f)
+ val offset1 = Offset(25f, 50f)
+ val offset2 = Offset(75f, 50f)
+ val offset3 = Offset(125f, 50f)
val down = PointerInputEvent(
Uptime.Boot + 11.milliseconds,
@@ -1030,7 +1031,7 @@
id = PointerId(1),
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
- offset2 - PxPosition(50f, 25f),
+ offset2 - Offset(50f, 25f),
true
),
previous = PointerInputData(null, null, false),
@@ -1140,21 +1141,21 @@
}
val offsetsThatHit =
listOf(
- PxPosition(1f, 1f),
- PxPosition(3f, 1f),
- PxPosition(1f, 3f),
- PxPosition(3f, 3f)
+ Offset(1f, 1f),
+ Offset(3f, 1f),
+ Offset(1f, 3f),
+ Offset(3f, 3f)
)
val offsetsThatMiss =
listOf(
- PxPosition(1f, 0f),
- PxPosition(3f, 0f),
- PxPosition(0f, 1f),
- PxPosition(4f, 1f),
- PxPosition(0f, 3f),
- PxPosition(4f, 3f),
- PxPosition(1f, 4f),
- PxPosition(3f, 4f)
+ Offset(1f, 0f),
+ Offset(3f, 0f),
+ Offset(0f, 1f),
+ Offset(4f, 1f),
+ Offset(0f, 3f),
+ Offset(4f, 3f),
+ Offset(1f, 4f),
+ Offset(3f, 4f)
)
val allOffsets = offsetsThatHit + offsetsThatMiss
val pointerInputEvent =
@@ -1177,7 +1178,7 @@
id = PointerId(it.toLong()),
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
- PxPosition(
+ Offset(
if (offsetsThatHit[it].x == 1f) 1f else 0f,
if (offsetsThatHit[it].y == 1f) 1f else 0f
),
@@ -1267,15 +1268,15 @@
}
val offsetsThatHit =
listOf(
- PxPosition(2f, 2f),
- PxPosition(2f, 1f),
- PxPosition(1f, 2f)
+ Offset(2f, 2f),
+ Offset(2f, 1f),
+ Offset(1f, 2f)
)
val offsetsThatMiss =
listOf(
- PxPosition(0f, 0f),
- PxPosition(0f, 1f),
- PxPosition(1f, 0f)
+ Offset(0f, 0f),
+ Offset(0f, 1f),
+ Offset(1f, 0f)
)
val allOffsets = offsetsThatHit + offsetsThatMiss
val pointerInputEvent =
@@ -1299,7 +1300,7 @@
id = PointerId(it.toLong()),
current = PointerInputData(
Uptime.Boot + 11.milliseconds,
- offsetsThatHit[it] - PxPosition(1f, 1f),
+ offsetsThatHit[it] - Offset(1f, 1f),
true
),
previous = PointerInputData(null, null, false),
@@ -1341,7 +1342,7 @@
insertAt(0, layoutNode)
}
- val offset1 = PxPosition(50f, 75f)
+ val offset1 = Offset(50f, 75f)
val down = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -1354,7 +1355,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset1 - PxPosition(25f, 50f),
+ offset1 - Offset(25f, 50f),
true
),
previous = PointerInputData(null, null, false),
@@ -1421,7 +1422,7 @@
insertAt(0, layoutNode4)
}
- val offset1 = PxPosition(499f, 499f)
+ val offset1 = Offset(499f, 499f)
val downEvent = PointerInputEvent(
Uptime.Boot + 7.milliseconds,
@@ -1434,7 +1435,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 7.milliseconds,
- offset1 - PxPosition(1f + 2f + 3f + 4f, 5f + 6f + 7f + 8f),
+ offset1 - Offset(1f + 2f + 3f + 4f, 5f + 6f + 7f + 8f),
true
),
previous = PointerInputData(null, null, false),
@@ -1500,7 +1501,7 @@
insertAt(0, layoutNode5)
}
- val offset1 = PxPosition(499f, 499f)
+ val offset1 = Offset(499f, 499f)
val downEvent = PointerInputEvent(
Uptime.Boot + 3.milliseconds,
@@ -1513,7 +1514,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 3.milliseconds,
- offset1 - PxPosition(
+ offset1 - Offset(
1f + 2f + 3f + 4f + 5f,
6f + 7f + 8f + 9f + 10f
),
@@ -1527,7 +1528,7 @@
id = PointerId(0),
current = PointerInputData(
Uptime.Boot + 3.milliseconds,
- offset1 - PxPosition(3f + 4f + 5f, 8f + 9f + 10f),
+ offset1 - Offset(3f + 4f + 5f, 8f + 9f + 10f),
true
),
previous = PointerInputData(null, null, false),
@@ -1605,7 +1606,7 @@
}
val down = PointerInputEvent(
- 1, Uptime.Boot + 0.milliseconds, PxPosition(50f, 50f), true
+ 1, Uptime.Boot + 0.milliseconds, Offset(50f, 50f), true
)
// Act
@@ -1632,7 +1633,7 @@
}
val down = PointerInputEvent(
- 1, Uptime.Boot + 0.milliseconds, PxPosition(0f, 0f), true
+ 1, Uptime.Boot + 0.milliseconds, Offset(0f, 0f), true
)
// Act
@@ -1667,7 +1668,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(250f, 250f),
+ Offset(250f, 250f),
true
)
@@ -1676,7 +1677,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(250f, 250f),
+ Offset(250f, 250f),
true
),
previous = PointerInputData(null, null, false),
@@ -1727,7 +1728,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
)
@@ -1738,13 +1739,13 @@
PointerInputEventData(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
PointerInputEventData(
9,
Uptime.Boot + 10.milliseconds,
- PxPosition(300f, 300f),
+ Offset(300f, 300f),
true
)
)
@@ -1756,7 +1757,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -1770,12 +1771,12 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
consumed = ConsumedData()
@@ -1784,7 +1785,7 @@
id = PointerId(9),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(300f, 300f),
+ Offset(300f, 300f),
true
),
previous = PointerInputData(null, null, false),
@@ -1848,7 +1849,7 @@
PointerInputEventData(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 100f),
+ Offset(100f, 100f),
true
)
@@ -1856,7 +1857,7 @@
PointerInputEventData(
9,
Uptime.Boot + 5.milliseconds,
- PxPosition(300f, 300f),
+ Offset(300f, 300f),
true
)
@@ -1870,7 +1871,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 100f),
+ Offset(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -1882,7 +1883,7 @@
id = PointerId(9),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(100f, 100f),
+ Offset(100f, 100f),
true
),
previous = PointerInputData(null, null, false),
@@ -1942,7 +1943,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
)
@@ -1950,7 +1951,7 @@
PointerInputEvent(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(300f, 300f),
+ Offset(300f, 300f),
true
)
@@ -1959,7 +1960,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -1971,12 +1972,12 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(300f, 300f),
+ Offset(300f, 300f),
true
),
previous = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
consumed = ConsumedData()
@@ -2031,7 +2032,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
)
@@ -2040,7 +2041,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2090,7 +2091,7 @@
PointerInputEvent(
7,
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
)
@@ -2098,7 +2099,7 @@
PointerInputEvent(
7,
Uptime.Boot + 10.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
)
@@ -2107,7 +2108,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 5.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2119,7 +2120,7 @@
id = PointerId(7),
current = PointerInputData(
Uptime.Boot + 10.milliseconds,
- PxPosition(200f, 200f),
+ Offset(200f, 200f),
true
),
previous = PointerInputData(null, null, false),
@@ -2179,7 +2180,7 @@
root.insertAt(0, parentLayoutNode)
- val offset = PxPosition(50f, 50f)
+ val offset = Offset(50f, 50f)
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2245,7 +2246,7 @@
root.insertAt(0, parentLayoutNode)
val down =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50f, 50f), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, Offset(50f, 50f), true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2285,7 +2286,7 @@
root.insertAt(0, parentLayoutNode)
- val offset = PxPosition(50f, 50f)
+ val offset = Offset(50f, 50f)
val down = PointerInputEvent(0, Uptime.Boot + 7.milliseconds, offset, true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2351,7 +2352,7 @@
root.insertAt(0, parentLayoutNode)
val down =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(50f, 50f), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, Offset(50f, 50f), true)
val up = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, null, false)
@@ -2369,7 +2370,7 @@
@Test
fun process_downNoPointerInputModifiers_nothingInteractedWithAndNoMovementConsumed() {
val pointerInputEvent =
- PointerInputEvent(0, Uptime.Boot + 7.milliseconds, PxPosition(0f, 0f), true)
+ PointerInputEvent(0, Uptime.Boot + 7.milliseconds, Offset(0f, 0f), true)
val result: ProcessResult = pointerInputEventProcessor.process(pointerInputEvent)
@@ -2401,10 +2402,10 @@
val offsets =
listOf(
- PxPosition(-1f, 0f),
- PxPosition(0f, -1f),
- PxPosition(1f, 0f),
- PxPosition(0f, 1f)
+ Offset(-1f, 0f),
+ Offset(0f, -1f),
+ Offset(1f, 0f),
+ Offset(0f, 1f)
)
val pointerInputEvent =
PointerInputEvent(
@@ -2442,7 +2443,7 @@
)
root.apply { insertAt(0, layoutNode) }
val pointerInputEvent =
- PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
+ PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(0f, 0f), true)
// Act
@@ -2471,9 +2472,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(1f, 0f), true)
// Act
@@ -2503,9 +2504,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(1f, 0f), true)
// Act
@@ -2544,9 +2545,9 @@
)
)
root.apply { insertAt(0, layoutNode) }
- val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(0f, 0f), true)
+ val down = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(0f, 0f), true)
pointerInputEventProcessor.process(down)
- val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, PxPosition(1f, 0f), true)
+ val move = PointerInputEvent(0, Uptime.Boot + 11.milliseconds, Offset(1f, 0f), true)
// Act
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/TestUtils.kt b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/TestUtils.kt
index 0e80752..f0f2782 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/TestUtils.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/pointerinput/TestUtils.kt
@@ -29,7 +29,7 @@
import androidx.ui.core.PointerInputHandler
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Uptime
import androidx.ui.unit.ipx
@@ -78,7 +78,7 @@
internal fun PointerInputEventData(
id: Int,
uptime: Uptime,
- position: PxPosition?,
+ position: Offset?,
down: Boolean
): PointerInputEventData {
val pointerInputData = PointerInputData(uptime, position, down)
@@ -88,7 +88,7 @@
internal fun PointerInputEvent(
id: Int,
uptime: Uptime,
- position: PxPosition?,
+ position: Offset?,
down: Boolean
): PointerInputEvent {
return PointerInputEvent(
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
index 87f5948..57c608b 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerDragTest.kt
@@ -21,7 +21,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.LayoutCoordinates
import androidx.ui.text.style.TextDirection
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.doReturn
@@ -46,7 +46,7 @@
private val containerLayoutCoordinates = mock<LayoutCoordinates> {
on { isAttached } doReturn true
}
- private val childToLocal_result = PxPosition(300f, 400f)
+ private val childToLocal_result = Offset(300f, 400f)
private val startSelectable = mock<Selectable>()
private val endSelectable = mock<Selectable>()
@@ -107,8 +107,8 @@
whenever(startSelectable.getLayoutCoordinates()).thenReturn(startLayoutCoordinates)
whenever(endSelectable.getLayoutCoordinates()).thenReturn(endLayoutCoordinates)
- whenever(startSelectable.getHandlePosition(any(), any())).thenReturn(PxPosition.Origin)
- whenever(endSelectable.getHandlePosition(any(), any())).thenReturn(PxPosition.Origin)
+ whenever(startSelectable.getHandlePosition(any(), any())).thenReturn(Offset.Zero)
+ whenever(endSelectable.getHandlePosition(any(), any())).thenReturn(Offset.Zero)
selectionManager.containerLayoutCoordinates = containerLayoutCoordinates
selectionManager.>
@@ -123,12 +123,12 @@
@Test
fun handleDragObserver_onStart_startHandle_enable_draggingHandle_get_startHandle_info() {
- selectionManager.handleDragObserver(isStartHandle = true).onStart(PxPosition.Origin)
+ selectionManager.handleDragObserver(isStartHandle = true).onStart(Offset.Zero)
verify(containerLayoutCoordinates, times(1))
.childToLocal(
child = startLayoutCoordinates,
- childLocal = getAdjustedCoordinates(PxPosition.Origin)
+ childLocal = getAdjustedCoordinates(Offset.Zero)
)
verify_draggingHandle(expectedDraggingHandleValue = true)
verify(spyLambda, times(0)).invoke(fakeResultSelection)
@@ -136,12 +136,12 @@
@Test
fun handleDragObserver_onStart_endHandle_enable_draggingHandle_get_endHandle_info() {
- selectionManager.handleDragObserver(isStartHandle = false).onStart(PxPosition.Origin)
+ selectionManager.handleDragObserver(isStartHandle = false).onStart(Offset.Zero)
verify(containerLayoutCoordinates, times(1))
.childToLocal(
child = endLayoutCoordinates,
- childLocal = getAdjustedCoordinates(PxPosition.Origin)
+ childLocal = getAdjustedCoordinates(Offset.Zero)
)
verify_draggingHandle(expectedDraggingHandleValue = true)
verify(spyLambda, times(0)).invoke(fakeResultSelection)
@@ -150,15 +150,15 @@
@Test
fun handleDragObserver_onDrag_startHandle_reuse_endHandle_calls_getSelection_change_selection
() {
- val dragDistance = PxPosition(100f, 100f)
- selectionManager.handleDragObserver(isStartHandle = true).onStart(PxPosition.Origin)
+ val dragDistance = Offset(100f, 100f)
+ selectionManager.handleDragObserver(isStartHandle = true).onStart(Offset.Zero)
val result = selectionManager.handleDragObserver(isStartHandle = true).onDrag(dragDistance)
verify(containerLayoutCoordinates, times(1))
.childToLocal(
child = endLayoutCoordinates,
- childLocal = getAdjustedCoordinates(PxPosition.Origin)
+ childLocal = getAdjustedCoordinates(Offset.Zero)
)
verify(selectable, times(1))
.getSelection(
@@ -177,15 +177,15 @@
@Test
fun handleDragObserver_onDrag_endHandle_resue_startHandle_calls_getSelection_change_selection
() {
- val dragDistance = PxPosition(100f, 100f)
- selectionManager.handleDragObserver(isStartHandle = false).onStart(PxPosition.Origin)
+ val dragDistance = Offset(100f, 100f)
+ selectionManager.handleDragObserver(isStartHandle = false).onStart(Offset.Zero)
val result = selectionManager.handleDragObserver(isStartHandle = false).onDrag(dragDistance)
verify(containerLayoutCoordinates, times(1))
.childToLocal(
child = startLayoutCoordinates,
- childLocal = getAdjustedCoordinates(PxPosition.Origin)
+ childLocal = getAdjustedCoordinates(Offset.Zero)
)
verify(selectable, times(1))
.getSelection(
@@ -203,21 +203,21 @@
@Test
fun handleDragObserver_onStop_disable_draggingHandle() {
- selectionManager.handleDragObserver(false).onStart(PxPosition.Origin)
- selectionManager.handleDragObserver(false).onDrag(PxPosition.Origin)
+ selectionManager.handleDragObserver(false).onStart(Offset.Zero)
+ selectionManager.handleDragObserver(false).onDrag(Offset.Zero)
- selectionManager.handleDragObserver(false).onStop(PxPosition.Origin)
+ selectionManager.handleDragObserver(false).onStop(Offset.Zero)
verify_draggingHandle(expectedDraggingHandleValue = false)
}
- private fun getAdjustedCoordinates(position: PxPosition): PxPosition {
- return PxPosition(position.x, position.y - 1f)
+ private fun getAdjustedCoordinates(position: Offset): Offset {
+ return Offset(position.x, position.y - 1f)
}
private fun verify_draggingHandle(expectedDraggingHandleValue: Boolean) {
// Verify draggingHandle is true, by verifying LongPress does nothing. Vice Versa.
- val position = PxPosition(100f, 100f)
+ val position = Offset(100f, 100f)
selectionManager.longPressDragObserver.onLongPress(position)
verify(selectable, times(if (expectedDraggingHandleValue) 0 else 1))
.getSelection(
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
index 1c69bfc..6fc39b6 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerLongPressDragTest.kt
@@ -21,7 +21,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.LayoutCoordinates
import androidx.ui.text.style.TextDirection
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.anyOrNull
@@ -109,7 +109,7 @@
@Test
fun longPressDragObserver_onLongPress_calls_getSelection_change_selection() {
- val position = PxPosition(100f, 100f)
+ val position = Offset(100f, 100f)
selectionManager.longPressDragObserver.onLongPress(position)
@@ -129,10 +129,10 @@
@Test
fun longPressDragObserver_onDragStart_reset_dragTotalDistance() {
// Setup. Make sure selectionManager.dragTotalDistance is not 0.
- val dragDistance1 = PxPosition(15f, 10f)
- val beginPosition1 = PxPosition(30f, 20f)
- val dragDistance2 = PxPosition(100f, 300f)
- val beginPosition2 = PxPosition(300f, 200f)
+ val dragDistance1 = Offset(15f, 10f)
+ val beginPosition1 = Offset(30f, 20f)
+ val dragDistance2 = Offset(100f, 300f)
+ val beginPosition2 = Offset(300f, 200f)
selectionManager.longPressDragObserver.onLongPress(beginPosition1)
selectionManager.longPressDragObserver.onDragStart()
selectionManager.longPressDragObserver.onDrag(dragDistance1)
@@ -162,8 +162,8 @@
@Test
fun longPressDragObserver_onDrag_calls_getSelection_change_selection() {
- val dragDistance = PxPosition(15f, 10f)
- val beginPosition = PxPosition(30f, 20f)
+ val dragDistance = Offset(15f, 10f)
+ val beginPosition = Offset(30f, 20f)
selectionManager.longPressDragObserver.onLongPress(beginPosition)
selectionManager.selection = fakeInitialSelection
selection = fakeInitialSelection
@@ -186,13 +186,13 @@
@Test
fun longPressDragObserver_onDrag_directly_not_call_getSelection_not_change_selection() {
- val dragDistance = PxPosition(15f, 10f)
- val beginPosition = PxPosition(30f, 20f)
+ val dragDistance = Offset(15f, 10f)
+ val beginPosition = Offset(30f, 20f)
selection = fakeInitialSelection
val result = selectionManager.longPressDragObserver.onDrag(dragDistance)
- assertThat(result).isEqualTo(PxPosition.Origin)
+ assertThat(result).isEqualTo(Offset.Zero)
verify(selectable, times(0))
.getSelection(
startPosition = beginPosition,
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
index a56b8c1..b6888ed 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionManagerTest.kt
@@ -29,7 +29,7 @@
import androidx.ui.text.length
import androidx.ui.text.style.TextDirection
import androidx.ui.text.subSequence
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.doReturn
@@ -60,8 +60,8 @@
private val middleSelectable = mock<Selectable>()
private val lastSelectable = mock<Selectable>()
- private val startCoordinates = PxPosition(3f, 30f)
- private val endCoordinates = PxPosition(3f, 600f)
+ private val startCoordinates = Offset(3f, 30f)
+ private val endCoordinates = Offset(3f, 600f)
private val fakeSelection =
Selection(
@@ -99,7 +99,7 @@
@Test
fun mergeSelections_sorting() {
whenever((containerLayoutCoordinates.childToLocal(any(), any())))
- .thenReturn(PxPosition.Origin)
+ .thenReturn(Offset.Zero)
selectionManager.mergeSelections(
startPosition = startCoordinates,
@@ -141,7 +141,7 @@
val selectable_another = mock<Selectable>()
selectionRegistrar.subscribe(selectable_another)
whenever((containerLayoutCoordinates.childToLocal(any(), any())))
- .thenReturn(PxPosition.Origin)
+ .thenReturn(Offset.Zero)
selectionManager.mergeSelections(
startPosition = startCoordinates,
@@ -416,8 +416,8 @@
verify(selectable, times(1))
.getSelection(
- startPosition = PxPosition(-1f, -1f),
- endPosition = PxPosition(-1f, -1f),
+ startPosition = Offset(-1f, -1f),
+ endPosition = Offset(-1f, -1f),
containerLayoutCoordinates = selectionManager.requireContainerCoordinates(),
longPress = false,
previousSelection = fakeSelection
diff --git a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
index 4188bb3..fb1db38 100644
--- a/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
+++ b/ui/ui-core/src/test/java/androidx/ui/core/selection/SelectionRegistrarImplTest.kt
@@ -18,7 +18,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.core.LayoutCoordinates
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.mock
import com.nhaarman.mockitokotlin2.whenever
@@ -75,19 +75,19 @@
whenever(handler3.getLayoutCoordinates()).thenReturn(layoutCoordinates3)
// The order of the 4 handlers should be 1, 0, 3, 2.
- val relativeCoordinates0 = PxPosition(20f, 12f)
- val relativeCoordinates1 = PxPosition(5f, 12f)
- val relativeCoordinates2 = PxPosition(20f, 24f)
- val relativeCoordinates3 = PxPosition(5f, 24f)
+ val relativeCoordinates0 = Offset(20f, 12f)
+ val relativeCoordinates1 = Offset(5f, 12f)
+ val relativeCoordinates2 = Offset(20f, 24f)
+ val relativeCoordinates3 = Offset(5f, 24f)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, Offset.Zero))
.thenReturn(relativeCoordinates0)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates1, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates1, Offset.Zero))
.thenReturn(relativeCoordinates1)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates2, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates2, Offset.Zero))
.thenReturn(relativeCoordinates2)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates3, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates3, Offset.Zero))
.thenReturn(relativeCoordinates3)
val selectionRegistrar = SelectionRegistrarImpl()
@@ -126,19 +126,19 @@
whenever(handler3.getLayoutCoordinates()).thenReturn(layoutCoordinates3)
// The order of the 4 handlers should be 1, 0, 3, 2.
- val relativeCoordinates0 = PxPosition(20f, 12f)
- val relativeCoordinates1 = PxPosition(5f, 12f)
- val relativeCoordinates2 = PxPosition(20f, 24f)
- val relativeCoordinates3 = PxPosition(5f, 24f)
+ val relativeCoordinates0 = Offset(20f, 12f)
+ val relativeCoordinates1 = Offset(5f, 12f)
+ val relativeCoordinates2 = Offset(20f, 24f)
+ val relativeCoordinates3 = Offset(5f, 24f)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, Offset.Zero))
.thenReturn(relativeCoordinates0)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates1, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates1, Offset.Zero))
.thenReturn(relativeCoordinates1)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates2, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates2, Offset.Zero))
.thenReturn(relativeCoordinates2)
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates3, PxPosition.Origin))
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates3, Offset.Zero))
.thenReturn(relativeCoordinates3)
val selectionRegistrar = SelectionRegistrarImpl()
@@ -165,8 +165,8 @@
val layoutCoordinates0 = mock<LayoutCoordinates>()
whenever(handler0.getLayoutCoordinates()).thenReturn(layoutCoordinates0)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
- .thenReturn(PxPosition.Origin)
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, Offset.Zero))
+ .thenReturn(Offset.Zero)
val selectionRegistrar = SelectionRegistrarImpl()
selectionRegistrar.subscribe(handler0)
@@ -187,8 +187,8 @@
val layoutCoordinates0 = mock<LayoutCoordinates>()
whenever(handler0.getLayoutCoordinates()).thenReturn(layoutCoordinates0)
val containerLayoutCoordinates = mock<LayoutCoordinates>()
- whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, PxPosition.Origin))
- .thenReturn(PxPosition.Origin)
+ whenever(containerLayoutCoordinates.childToLocal(layoutCoordinates0, Offset.Zero))
+ .thenReturn(Offset.Zero)
val selectionRegistrar = SelectionRegistrarImpl()
selectionRegistrar.subscribe(handler0)
diff --git a/ui/ui-foundation/api/0.1.0-dev14.txt b/ui/ui-foundation/api/0.1.0-dev14.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/0.1.0-dev14.txt
+++ b/ui/ui-foundation/api/0.1.0-dev14.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/api/current.txt b/ui/ui-foundation/api/current.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/current.txt
+++ b/ui/ui-foundation/api/current.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev14.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_0.1.0-dev14.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/api/public_plus_experimental_current.txt b/ui/ui-foundation/api/public_plus_experimental_current.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/public_plus_experimental_current.txt
+++ b/ui/ui-foundation/api/public_plus_experimental_current.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/api/restricted_0.1.0-dev14.txt b/ui/ui-foundation/api/restricted_0.1.0-dev14.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-foundation/api/restricted_0.1.0-dev14.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/api/restricted_current.txt b/ui/ui-foundation/api/restricted_current.txt
index 21097e6..61e4cf7 100644
--- a/ui/ui-foundation/api/restricted_current.txt
+++ b/ui/ui-foundation/api/restricted_current.txt
@@ -115,10 +115,10 @@
@androidx.compose.Stable public final class InteractionState implements androidx.compose.State<java.util.Set<? extends androidx.ui.foundation.Interaction>> {
ctor public InteractionState();
- method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.unit.PxPosition? position = null);
+ method public void addInteraction(androidx.ui.foundation.Interaction interaction, androidx.ui.geometry.Offset? position = null);
method public operator boolean contains(androidx.ui.foundation.Interaction interaction);
method public java.util.Set<androidx.ui.foundation.Interaction> getValue();
- method public androidx.ui.unit.PxPosition? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
+ method public androidx.ui.geometry.Offset? interactionPositionFor(androidx.ui.foundation.Interaction interaction);
method public void removeInteraction(androidx.ui.foundation.Interaction interaction);
property public java.util.Set<androidx.ui.foundation.Interaction> value;
}
@@ -284,12 +284,12 @@
}
public final class DraggableKt {
- method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
+ method public static androidx.ui.core.Modifier draggable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true, androidx.ui.foundation.InteractionState? interactionState = null, boolean startDragImmediately = false, kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onDragDeltaConsumptionRequested);
}
public final class ScrollableKt {
method @androidx.compose.Composable public static androidx.ui.foundation.gestures.ScrollableState ScrollableState(kotlin.jvm.functions.Function1<? super java.lang.Float,java.lang.Float> onScrollDeltaConsumptionRequested);
- method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.unit.PxPosition,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
+ method public static androidx.ui.core.Modifier scrollable(androidx.ui.core.Modifier, androidx.ui.foundation.gestures.DragDirection dragDirection, androidx.ui.foundation.gestures.ScrollableState scrollableState, kotlin.jvm.functions.Function1<? super androidx.ui.geometry.Offset,kotlin.Unit> kotlin.jvm.functions.Function1<? super java.lang.Float,kotlin.Unit> boolean enabled = true);
}
public final class ScrollableState {
diff --git a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
index c1bff5a1..4cff560 100644
--- a/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
+++ b/ui/ui-foundation/samples/src/main/java/androidx/ui/foundation/samples/CanvasSamples.kt
@@ -34,7 +34,7 @@
drawRect(Color.Magenta)
inset(10.0f) {
drawLine(
- p1 = Offset.zero,
+ p1 = Offset.Zero,
p2 = Offset(size.width, size.height),
stroke = Stroke(width = 5.0f),
color = Color.Red
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
index 34ac07a..246d264 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/BoxTest.kt
@@ -42,9 +42,8 @@
import androidx.ui.test.findByTag
import androidx.ui.unit.Density
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
-import androidx.ui.unit.ipx
import com.google.common.truth.Truth
import org.junit.Rule
import org.junit.Test
@@ -83,7 +82,7 @@
@Test
fun box_testPadding_separate() {
var childSize: IntPxSize? = null
- var childPosition: PxPosition? = null
+ var childPosition: Offset? = null
val size = 100.dp
val start = 17.dp
val top = 2.dp
@@ -100,7 +99,7 @@
) {
Box(Modifier.fillMaxSize().onPositioned {
childSize = it.size
- childPosition = it.localToGlobal(PxPosition.Origin)
+ childPosition = it.localToGlobal(Offset.Zero)
})
}
}
@@ -112,14 +111,14 @@
Truth.assertThat(childSize!!.height)
.isEqualTo(size.toIntPx() - top.toIntPx() - bottom.toIntPx())
Truth.assertThat(childPosition!!)
- .isEqualTo(PxPosition(start.toIntPx(), top.toIntPx()))
+ .isEqualTo(Offset(start.toIntPx().value.toFloat(), top.toIntPx().value.toFloat()))
}
}
@Test
fun box_testPadding_rtl() {
var childSize: IntPxSize? = null
- var childPosition: PxPosition? = null
+ var childPosition: Offset? = null
val size = 100.dp
val start = 17.dp
val top = 2.dp
@@ -136,7 +135,7 @@
) {
Box(Modifier.fillMaxSize().onPositioned {
childSize = it.size
- childPosition = it.localToGlobal(PxPosition.Origin)
+ childPosition = it.localToGlobal(Offset.Zero)
})
}
}
@@ -148,7 +147,7 @@
Truth.assertThat(childSize!!.height)
.isEqualTo(size.toIntPx() - top.toIntPx() - bottom.toIntPx())
Truth.assertThat(childPosition!!)
- .isEqualTo(PxPosition(end.toIntPx(), top.toIntPx()))
+ .isEqualTo(Offset(end.toIntPx().value.toFloat(), top.toIntPx().value.toFloat()))
}
}
@@ -186,9 +185,9 @@
fun box_testLayout_multipleChildren() {
val size = 100.dp
val childSize = 20.dp
- var childPosition1: PxPosition? = null
- var childPosition2: PxPosition? = null
- var childPosition3: PxPosition? = null
+ var childPosition1: Offset? = null
+ var childPosition2: Offset? = null
+ var childPosition3: Offset? = null
composeTestRule.setContent {
SemanticsParent {
Box(
@@ -209,21 +208,21 @@
}
with(composeTestRule.density) {
Truth.assertThat(childPosition1).isEqualTo(
- PxPosition(
- (size.toIntPx() - childSize.toIntPx()) / 2,
- 0.ipx
+ Offset(
+ (size.toIntPx() - childSize.toIntPx()).value / 2f,
+ 0f
)
)
Truth.assertThat(childPosition2).isEqualTo(
- PxPosition(
- (size.toIntPx() - childSize.toIntPx()) / 2,
- childSize.toIntPx()
+ Offset(
+ (size.toIntPx() - childSize.toIntPx()).value / 2f,
+ childSize.toIntPx().value.toFloat()
)
)
Truth.assertThat(childPosition3).isEqualTo(
- PxPosition(
- (size.toIntPx() - childSize.toIntPx()) / 2,
- childSize.toIntPx() * 2
+ Offset(
+ (size.toIntPx() - childSize.toIntPx()).value / 2f,
+ childSize.toIntPx().value.toFloat() * 2
)
)
}
@@ -233,7 +232,7 @@
fun box_testLayout_absoluteAlignment() {
val size = 100.dp
val childSize = 20.dp
- var childPosition: PxPosition? = null
+ var childPosition: Offset? = null
composeTestRule.setContent {
SemanticsParent {
Box(
@@ -246,7 +245,7 @@
}
}
}
- Truth.assertThat(childPosition).isEqualTo(PxPosition(0.ipx, 0.ipx))
+ Truth.assertThat(childPosition).isEqualTo(Offset(0f, 0f))
}
@Test
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
index 5a340a6..35466f2 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/CanvasTest.kt
@@ -79,7 +79,7 @@
.wrapContentSize(Alignment.Center)) {
Canvas(modifier = Modifier.preferredSize(minWidth, minHeight)) {
drawLine(
- p1 = Offset.zero,
+ p1 = Offset.Zero,
p2 = Offset(size.width, size.height),
color = Color.Red,
stroke = Stroke(width = strokeWidth)
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
index 59e5574..4d9fff49 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/DraggableTest.kt
@@ -34,7 +34,7 @@
import androidx.ui.test.runOnIdleCompose
import androidx.ui.test.sendSwipe
import androidx.ui.test.sendSwipeWithVelocity
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -67,7 +67,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -78,7 +78,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100f),
+ end = Offset(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -88,7 +88,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x - 100f, this.center.y),
+ end = Offset(this.center.x - 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -112,7 +112,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100f),
+ end = Offset(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -123,7 +123,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -133,7 +133,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y - 100f),
+ end = Offset(this.center.x, this.center.y - 100f),
duration = 100.milliseconds
)
}
@@ -167,7 +167,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -194,7 +194,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -206,7 +206,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -232,7 +232,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
endVelocity = 112f,
duration = 100.milliseconds
@@ -259,7 +259,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -289,7 +289,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -332,7 +332,7 @@
findByTag(draggableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 200f, this.center.y),
+ end = Offset(this.center.x + 200f, this.center.y),
duration = 300.milliseconds
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
index 993dbb0..acd9946 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/IndicationTest.kt
@@ -29,7 +29,7 @@
import androidx.ui.test.runOnIdleCompose
import androidx.ui.test.sendDown
import androidx.ui.test.sendUp
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import com.google.common.truth.Truth.assertThat
import org.junit.Ignore
@@ -123,7 +123,7 @@
@Test
@Ignore("b/155466122: multitouch is not supported yet")
fun indication_multiplyPress_firstWins() {
- var lastPosition: PxPosition? = null
+ var lastPosition: Offset? = null
val indication = makeIndication {
it.value // value read
lastPosition = it.interactionPositionFor(Interaction.Pressed)
@@ -136,11 +136,11 @@
)
}
assertThat(lastPosition).isNull()
- var position1: PxPosition? = null
+ var position1: Offset? = null
findByTag(testTag)
.assertExists()
.doPartialGesture {
- position1 = PxPosition(center.x, center.y + 20f)
+ position1 = Offset(center.x, center.y + 20f)
// pointer 1, when we have multitouch
sendDown(position1!!)
}
@@ -150,7 +150,7 @@
findByTag(testTag)
.assertExists()
.doPartialGesture {
- val position2 = PxPosition(center.x + 20f, center.y)
+ val position2 = Offset(center.x + 20f, center.y)
// pointer 2, when we have multitouch
sendDown(position2)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
index 3ebd1a0a..8795598 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ScrollableTest.kt
@@ -41,7 +41,7 @@
import androidx.ui.test.runOnUiThread
import androidx.ui.test.sendSwipe
import androidx.ui.test.sendSwipeWithVelocity
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth
@@ -83,7 +83,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -96,7 +96,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100f),
+ end = Offset(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -108,7 +108,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x - 100f, this.center.y),
+ end = Offset(this.center.x - 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -139,7 +139,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y + 100f),
+ end = Offset(this.center.x, this.center.y + 100f),
duration = 100.milliseconds
)
}
@@ -152,7 +152,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -164,7 +164,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x, this.center.y - 100f),
+ end = Offset(this.center.x, this.center.y - 100f),
duration = 100.milliseconds
)
}
@@ -203,7 +203,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -243,7 +243,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -256,7 +256,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -291,7 +291,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
endVelocity = 112f,
duration = 100.milliseconds
@@ -302,7 +302,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipeWithVelocity(
start = this.center,
- end = PxPosition(this.center.x - 100f, this.center.y),
+ end = Offset(this.center.x - 100f, this.center.y),
endVelocity = 312f,
duration = 100.milliseconds
@@ -335,7 +335,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100f, this.center.y),
+ end = Offset(this.center.x + 100f, this.center.y),
duration = 100.milliseconds
)
}
@@ -347,7 +347,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 114f, this.center.y),
+ end = Offset(this.center.x + 114f, this.center.y),
duration = 100.milliseconds
)
}
@@ -387,7 +387,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 100, this.center.y),
+ end = Offset(this.center.x + 100, this.center.y),
duration = 100.milliseconds
)
}
@@ -550,7 +550,7 @@
findByTag(scrollableBoxTag).doGesture {
this.sendSwipe(
start = this.center,
- end = PxPosition(this.center.x + 200f, this.center.y),
+ end = Offset(this.center.x + 200f, this.center.y),
duration = 300.milliseconds
)
}
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
index 150bcaa..4a5ab4d 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/TextFieldOnValueChangeTextFieldValueTest.kt
@@ -36,7 +36,7 @@
import androidx.ui.test.runOnUiThread
import androidx.ui.test.sendClick
import androidx.ui.text.TextRange
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
import com.nhaarman.mockitokotlin2.argumentCaptor
@@ -94,7 +94,7 @@
// Perform click to focus in.
find(hasInputMethodsSupport())
- .doGesture { sendClick(PxPosition(1f, 1f)) }
+ .doGesture { sendClick(Offset(1f, 1f)) }
runOnIdleCompose {
// Verify startInput is called and capture the callback.
diff --git a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ZoomableTest.kt b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ZoomableTest.kt
index 71bcc43..37bc291 100644
--- a/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ZoomableTest.kt
+++ b/ui/ui-foundation/src/androidTest/java/androidx/ui/foundation/ZoomableTest.kt
@@ -22,6 +22,7 @@
import androidx.ui.core.testTag
import androidx.ui.foundation.gestures.ZoomableState
import androidx.ui.foundation.gestures.zoomable
+import androidx.ui.geometry.Offset
import androidx.ui.layout.preferredSize
import androidx.ui.test.AnimationClockTestRule
import androidx.ui.test.center
@@ -32,7 +33,6 @@
import androidx.ui.test.runOnUiThread
import androidx.ui.test.sendPinch
import androidx.ui.test.size
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.toPxSize
import com.google.common.truth.Truth.assertWithMessage
@@ -71,10 +71,10 @@
val rightEndX = size.toPxSize().width * (1 - EDGE_FUZZ_FACTOR)
sendPinch(
- PxPosition(leftStartX, center.y),
- PxPosition(leftEndX, center.y),
- PxPosition(rightStartX, center.y),
- PxPosition(rightEndX, center.y)
+ Offset(leftStartX, center.y),
+ Offset(leftEndX, center.y),
+ Offset(rightStartX, center.y),
+ Offset(rightEndX, center.y)
)
}
@@ -102,10 +102,10 @@
val rightEndX = center.x + 10
sendPinch(
- PxPosition(leftStartX, center.y),
- PxPosition(leftEndX, center.y),
- PxPosition(rightStartX, center.y),
- PxPosition(rightEndX, center.y)
+ Offset(leftStartX, center.y),
+ Offset(leftEndX, center.y),
+ Offset(rightStartX, center.y),
+ Offset(rightEndX, center.y)
)
}
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
index 65d54c7..f519eca 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/Clickable.kt
@@ -38,7 +38,7 @@
import androidx.ui.semantics.enabled
import androidx.ui.semantics.onClick
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastAny
/**
@@ -181,7 +181,7 @@
*/
@Composable
private fun Modifier.noConsumptionIndicatorGestureFilter(
- onStart: (PxPosition) -> Unit,
+ onStart: (Offset) -> Unit,
onStop: () -> Unit,
onCancel: () -> Unit
): Modifier = this + remember { NoConsumptionIndicatorGestureFilter(onStart, onStop, onCancel) }
@@ -190,7 +190,7 @@
* Temporary, see [noConsumptionIndicatorGestureFilter]
*/
private class NoConsumptionIndicatorGestureFilter(
- val onStart: (PxPosition) -> Unit,
+ val onStart: (Offset) -> Unit,
val onStop: () -> Unit,
// Rename to avoid clashing with onCancel() function
val onCancelCallback: () -> Unit
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/InteractionState.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/InteractionState.kt
index d10f73a..9b080fa 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/InteractionState.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/InteractionState.kt
@@ -21,7 +21,7 @@
import androidx.compose.getValue
import androidx.compose.mutableStateOf
import androidx.compose.setValue
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* InteractionState represents a [Set] of [Interaction]s present on a given component. This
@@ -40,7 +40,7 @@
@Stable
class InteractionState : State<Set<Interaction>> {
- private var map: Map<Interaction, PxPosition?> by mutableStateOf(emptyMap())
+ private var map: Map<Interaction, Offset?> by mutableStateOf(emptyMap())
override val value: Set<Interaction>
get() = map.keys
@@ -55,7 +55,7 @@
* [Interaction.Pressed], this will be the position of the pointer input that triggered the
* pressed state.
*/
- fun addInteraction(interaction: Interaction, position: PxPosition? = null) {
+ fun addInteraction(interaction: Interaction, position: Offset? = null) {
if (interaction !in this) map = map + (interaction to position)
}
@@ -73,7 +73,7 @@
* @return position associated with the interaction, or `null` if the interaction is not
* present in this state, or there is no associated position with the given interaction.
*/
- fun interactionPositionFor(interaction: Interaction): PxPosition? = map[interaction]
+ fun interactionPositionFor(interaction: Interaction): Offset? = map[interaction]
/**
* @return whether the provided [interaction] exists inside this InteractionState.
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
index fe7d19a..4c6c5f0 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/DragDirection.kt
@@ -17,7 +17,7 @@
package androidx.ui.foundation.gestures
import androidx.ui.core.Direction
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Draggable Direction specifies the direction in which you can drag an [draggable] or [scrollable].
@@ -33,7 +33,7 @@
currentValue: Float
) -> Boolean
- internal open fun project(pos: PxPosition) = xProjection(pos.x) + yProjection(pos.y)
+ internal open fun project(pos: Offset) = xProjection(pos.x) + yProjection(pos.y)
/**
* Horizontal direction of dragging in [draggable] or [scrollable].
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
index d929b46..efd8772 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Draggable.kt
@@ -25,7 +25,7 @@
import androidx.ui.core.gesture.dragGestureFilter
import androidx.ui.foundation.Interaction
import androidx.ui.foundation.InteractionState
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Configure touch dragging for the UI element in a single [DragDirection]. The drag distance is
@@ -60,7 +60,7 @@
*/
fun Modifier.draggable(
dragDirection: DragDirection,
- onDragStarted: (startedPosition: PxPosition) -> Unit = {},
+ onDragStarted: (startedPosition: Offset) -> Unit = {},
onDragStopped: (velocity: Float) -> Unit = {},
enabled: Boolean = true,
interactionState: InteractionState? = null,
@@ -74,20 +74,20 @@
dragGestureFilter(
dragObserver = object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
if (enabled) {
interactionState?.addInteraction(Interaction.Dragged)
onDragStarted(downPosition)
}
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
if (!enabled) return dragDistance
val projected = dragDirection.project(dragDistance)
val consumed = onDragDeltaConsumptionRequested(projected)
dragState.value = dragState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
- return PxPosition(
+ return Offset(
dragDirection.xProjection(dragDistance.x) * fractionConsumed,
dragDirection.yProjection(dragDistance.y) * fractionConsumed
)
@@ -100,7 +100,7 @@
}
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
if (enabled) {
interactionState?.removeInteraction(Interaction.Dragged)
onDragStopped(dragDirection.project(velocity))
diff --git a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
index d9c9ce6..c6aa03c 100644
--- a/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
+++ b/ui/ui-foundation/src/main/java/androidx/ui/foundation/gestures/Scrollable.kt
@@ -33,7 +33,7 @@
import androidx.ui.core.gesture.dragGestureFilter
import androidx.ui.foundation.animation.FlingConfig
import androidx.ui.foundation.animation.fling
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Create [ScrollableState] for [scrollable] with default [FlingConfig] and
@@ -160,7 +160,7 @@
fun Modifier.scrollable(
dragDirection: DragDirection,
scrollableState: ScrollableState,
- onScrollStarted: (startedPosition: PxPosition) -> Unit = {},
+ onScrollStarted: (startedPosition: Offset) -> Unit = {},
onScrollStopped: (velocity: Float) -> Unit = {},
enabled: Boolean = true
): Modifier = composed {
@@ -170,20 +170,20 @@
dragGestureFilter(
dragObserver = object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
if (enabled) {
scrollableState.stopAnimation()
onScrollStarted(downPosition)
}
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
- if (!enabled) return PxPosition.Origin
+ override fun onDrag(dragDistance: Offset): Offset {
+ if (!enabled) return Offset.Zero
val projected = dragDirection.project(dragDistance)
val consumed = scrollableState.onScrollDeltaConsumptionRequested(projected)
scrollableState.value = scrollableState.value + consumed
val fractionConsumed = if (projected == 0f) 0f else consumed / projected
- return PxPosition(
+ return Offset(
dragDirection.xProjection(dragDistance.x) * fractionConsumed,
dragDirection.yProjection(dragDistance.y) * fractionConsumed
)
@@ -194,7 +194,7 @@
if (enabled) onScrollStopped(0f)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
if (enabled) {
scrollableState.fling(dragDirection.project(velocity), onScrollStopped)
}
diff --git a/ui/ui-geometry/api/0.1.0-dev14.txt b/ui/ui-geometry/api/0.1.0-dev14.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/0.1.0-dev14.txt
+++ b/ui/ui-geometry/api/0.1.0-dev14.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/api/current.txt b/ui/ui-geometry/api/current.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/current.txt
+++ b/ui/ui-geometry/api/current.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-geometry/api/public_plus_experimental_0.1.0-dev14.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-geometry/api/public_plus_experimental_0.1.0-dev14.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/api/public_plus_experimental_current.txt b/ui/ui-geometry/api/public_plus_experimental_current.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/public_plus_experimental_current.txt
+++ b/ui/ui-geometry/api/public_plus_experimental_current.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/api/restricted_0.1.0-dev14.txt b/ui/ui-geometry/api/restricted_0.1.0-dev14.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-geometry/api/restricted_0.1.0-dev14.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/api/restricted_current.txt b/ui/ui-geometry/api/restricted_current.txt
index 0ca2e11..d0429e0 100644
--- a/ui/ui-geometry/api/restricted_current.txt
+++ b/ui/ui-geometry/api/restricted_current.txt
@@ -1,38 +1,30 @@
// Signature format: 3.0
package androidx.ui.geometry {
- @androidx.compose.Immutable public final inline class Offset {
- ctor public Offset();
- method public static infix androidx.ui.geometry.Rect and-b2zCL34(long $this, long other);
- method public static long constructor-impl(internal long packedValue);
- method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
- method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
- method public static boolean equals-impl0(long p1, long p2);
- method public static float getDirection-impl(long $this);
- method @androidx.compose.Stable public static float getDistance-impl(long $this);
- method @androidx.compose.Stable public static float getDistanceSquared-impl(long $this);
- method public static float getDx-impl(long $this);
- method public static float getDy-impl(long $this);
- method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
- method @androidx.compose.Stable public static long scale-impl(long $this, float scaleX, float scaleY);
- method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
- method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long translate-impl(long $this, float translateX, float translateY);
- method public static long truncDiv-impl(long $this, float operand);
- method @androidx.compose.Stable public static operator long unaryMinus-impl(long $this);
+ @androidx.compose.Immutable public final class Offset {
+ ctor public Offset(internal long packedValue);
+ method @androidx.compose.Immutable public androidx.ui.geometry.Offset copy(long packedValue);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset div(float operand);
+ method @androidx.compose.Stable public float getDistance();
+ method @androidx.compose.Stable public float getDistanceSquared();
+ method public float getX();
+ method public float getY();
+ method @androidx.compose.Stable public boolean isValid();
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset rem(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset times(float operand);
+ method @androidx.compose.Stable public operator androidx.ui.geometry.Offset unaryMinus();
+ property public final float x;
+ property public final float y;
field public static final androidx.ui.geometry.Offset.Companion! Companion;
}
public static final class Offset.Companion {
- method public long getInfinite();
- method public long getZero();
- method @androidx.compose.Stable public boolean isValid-RIqb49o(long offset);
- method @androidx.compose.Stable public long lerp-nqy8KaQ(long start, long stop, float fraction);
- property public final long infinite;
- property public final long zero;
+ method public androidx.ui.geometry.Offset getInfinite();
+ method public androidx.ui.geometry.Offset getZero();
+ property public final androidx.ui.geometry.Offset Infinite;
+ property public final androidx.ui.geometry.Offset Zero;
}
public interface OffsetBase {
@@ -49,7 +41,8 @@
}
public final class OffsetKt {
- method public static long Offset(float dx, float dy);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset(float x, float y);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset lerp(androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset stop, float fraction);
}
public final class RRect {
@@ -66,7 +59,7 @@
method public float component7();
method public float component8();
method public float component9();
- method public boolean contains-RIqb49o(long point);
+ method public boolean contains(androidx.ui.geometry.Offset point);
method public androidx.ui.geometry.RRect copy(float left, float top, float right, float bottom, float topLeftRadiusX, float topLeftRadiusY, float topRightRadiusX, float topRightRadiusY, float bottomRightRadiusX, float bottomRightRadiusY, float bottomLeftRadiusX, float bottomLeftRadiusY);
method @Deprecated public androidx.ui.geometry.RRect deflate(float delta);
method public float getBottom();
@@ -104,7 +97,7 @@
method public static androidx.ui.geometry.RRect RRect(androidx.ui.geometry.Rect rect, androidx.ui.geometry.Radius topLeft = Radius.zero, androidx.ui.geometry.Radius topRight = Radius.zero, androidx.ui.geometry.Radius bottomRight = Radius.zero, androidx.ui.geometry.Radius bottomLeft = Radius.zero);
method public static androidx.ui.geometry.Radius bottomLeftRadius(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius bottomRightRadius(androidx.ui.geometry.RRect);
- method public static long center(androidx.ui.geometry.RRect);
+ method public static androidx.ui.geometry.Offset center(androidx.ui.geometry.RRect);
method public static float getLongestSide(androidx.ui.geometry.RRect);
method public static float getShortestSide(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.RRect grow(androidx.ui.geometry.RRect, float delta);
@@ -119,7 +112,7 @@
method public static androidx.ui.geometry.Rect middleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect outerRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Rect safeInnerRect(androidx.ui.geometry.RRect);
- method public static androidx.ui.geometry.RRect shift-q6ZkaaM(androidx.ui.geometry.RRect, long offset);
+ method public static androidx.ui.geometry.RRect shift(androidx.ui.geometry.RRect, androidx.ui.geometry.Offset offset);
method public static androidx.ui.geometry.RRect shrink(androidx.ui.geometry.RRect, float delta);
method public static androidx.ui.geometry.Rect tallMiddleRect(androidx.ui.geometry.RRect);
method public static androidx.ui.geometry.Radius topLeftRadius(androidx.ui.geometry.RRect);
@@ -162,17 +155,17 @@
method public float component2();
method public float component3();
method public float component4();
- method public boolean contains-RIqb49o(long offset);
+ method public boolean contains(androidx.ui.geometry.Offset offset);
method @androidx.compose.Immutable public androidx.ui.geometry.Rect copy(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect deflate(float delta);
method public androidx.ui.geometry.Rect expandToInclude(androidx.ui.geometry.Rect other);
method public float getBottom();
- method public long getBottomCenter();
- method public long getBottomLeft();
- method public long getBottomRight();
- method public long getCenter();
- method public long getCenterLeft();
- method public long getCenterRight();
+ method public androidx.ui.geometry.Offset getBottomCenter();
+ method public androidx.ui.geometry.Offset getBottomLeft();
+ method public androidx.ui.geometry.Offset getBottomRight();
+ method public androidx.ui.geometry.Offset getCenter();
+ method public androidx.ui.geometry.Offset getCenterLeft();
+ method public androidx.ui.geometry.Offset getCenterRight();
method public float getHeight();
method public float getLeft();
method public float getMaxDimension();
@@ -180,9 +173,9 @@
method public float getRight();
method public long getSize();
method public float getTop();
- method public long getTopCenter();
- method public long getTopLeft();
- method public long getTopRight();
+ method public androidx.ui.geometry.Offset getTopCenter();
+ method public androidx.ui.geometry.Offset getTopLeft();
+ method public androidx.ui.geometry.Offset getTopRight();
method public float getWidth();
method @androidx.compose.Stable public androidx.ui.geometry.Rect inflate(float delta);
method @androidx.compose.Stable public androidx.ui.geometry.Rect intersect(androidx.ui.geometry.Rect other);
@@ -191,7 +184,7 @@
method @androidx.compose.Stable public boolean isInfinite();
method public androidx.ui.geometry.Rect join(androidx.ui.geometry.Rect other);
method public boolean overlaps(androidx.ui.geometry.Rect other);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect shift-RIqb49o(long offset);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect shift(androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public androidx.ui.geometry.Rect translate(float translateX, float translateY);
property public final float height;
property public final float maxDimension;
@@ -201,10 +194,10 @@
}
public static final class Rect.Companion {
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle-hSKLB2U(long center, float radius);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromCircle(androidx.ui.geometry.Offset center, float radius);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTRB(float left, float top, float right, float bottom);
method @androidx.compose.Stable public androidx.ui.geometry.Rect fromLTWH(float left, float top, float width, float height);
- method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints-cs1Rg_A(long a, long b);
+ method @androidx.compose.Stable public androidx.ui.geometry.Rect fromPoints(androidx.ui.geometry.Offset a, androidx.ui.geometry.Offset b);
method public androidx.ui.geometry.Rect getLargest();
method public androidx.ui.geometry.Rect getZero();
method public float get_giantScalar();
@@ -219,14 +212,14 @@
@androidx.compose.Immutable public final inline class Size {
ctor public Size();
- method @androidx.compose.Stable public static long bottomCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long bottomRight-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long center-RIqb49o(long $this, long origin = Offset.zero);
- method @androidx.compose.Stable public static long centerLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long centerRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset bottomRight-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center-impl(long $this, androidx.ui.geometry.Offset origin = Offset.Zero);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset centerRight-impl(long $this, androidx.ui.geometry.Offset origin);
method public static long constructor-impl(internal long value);
- method @androidx.compose.Stable public static boolean contains-RIqb49o(long $this, long offset);
+ method @androidx.compose.Stable public static boolean contains-impl(long $this, androidx.ui.geometry.Offset offset);
method @androidx.compose.Stable public static operator long div-impl(long $this, float operand);
method @androidx.compose.Immutable public static inline boolean equals-impl(long p, Object? p1);
method public static boolean equals-impl0(long p1, long p2);
@@ -237,15 +230,15 @@
method public static float getWidth-impl(long $this);
method @androidx.compose.Immutable public static inline int hashCode-impl(long p);
method @androidx.compose.Stable public static boolean isEmpty-impl(long $this);
- method @androidx.compose.Stable public static operator long minus-RIqb49o(long $this, long other);
- method @androidx.compose.Stable public static operator long minus-b2zCL34(long $this, long other);
- method @androidx.compose.Stable public static operator long plus-RIqb49o(long $this, long other);
+ method @androidx.compose.Stable public static operator androidx.ui.geometry.Offset minus-b2zCL34(long $this, long other);
+ method @androidx.compose.Stable public static operator long minus-impl(long $this, androidx.ui.geometry.Offset other);
+ method @androidx.compose.Stable public static operator long plus-impl(long $this, androidx.ui.geometry.Offset other);
method @androidx.compose.Stable public static operator long rem-impl(long $this, float operand);
method @androidx.compose.Stable public static operator long times-impl(long $this, float operand);
method public static String toString-impl(long $this);
- method @androidx.compose.Stable public static long topCenter-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topLeft-RIqb49o(long $this, long origin);
- method @androidx.compose.Stable public static long topRight-RIqb49o(long $this, long origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topCenter-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topLeft-impl(long $this, androidx.ui.geometry.Offset origin);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset topRight-impl(long $this, androidx.ui.geometry.Offset origin);
method @androidx.compose.Stable public static long truncDiv-impl(long $this, float operand);
field public static final androidx.ui.geometry.Size.Companion! Companion;
}
diff --git a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Offset.kt b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Offset.kt
index af6c248..30fb6c0 100644
--- a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Offset.kt
+++ b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Offset.kt
@@ -23,14 +23,14 @@
import androidx.ui.util.toStringAsFixed
import androidx.ui.util.unpackFloat1
import androidx.ui.util.unpackFloat2
-import kotlin.math.atan2
import kotlin.math.sqrt
-import kotlin.math.truncate
/**
* Constructs an Offset from the given relative x and y offsets
*/
-fun Offset(dx: Float, dy: Float) = Offset(packFloats(dx, dy))
+@Suppress("NOTHING_TO_INLINE")
+@Stable
+inline fun Offset(x: Float, y: Float) = Offset(packFloats(x, y))
/**
* An immutable 2D floating-point offset.
@@ -55,18 +55,20 @@
*
* * [Size], which represents a vector describing the size of a rectangle.
*
- * Creates an offset. The first argument sets [dx], the horizontal component,
- * and the second sets [dy], the vertical component.
+ * Creates an offset. The first argument sets [x], the horizontal component,
+ * and the second sets [y], the vertical component.
*/
+// TODO njawad make this an inline class again once the fix for b/155690960 has been picked
+// up by the compose kotlin compiler
@Immutable
-inline class Offset(@PublishedApi internal val packedValue: Long) {
+/* inline */ data class Offset(@PublishedApi internal val packedValue: Long) {
@Stable
- val dx: Float
+ val x: Float
get() = unpackFloat1(packedValue)
@Stable
- val dy: Float
+ val y: Float
get() = unpackFloat2(packedValue)
companion object {
@@ -76,7 +78,7 @@
* This can be used to represent the origin of a coordinate space.
*/
@Stable
- val zero = Offset(0.0f, 0.0f)
+ val Zero = Offset(0.0f, 0.0f)
/**
* An offset with infinite x and y components.
@@ -88,38 +90,15 @@
*/
// This is included for completeness, because [Size.infinite] exists.
@Stable
- val infinite = Offset(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)
+ val Infinite = Offset(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)
+ }
- /**
- * Linearly interpolate between two offsets.
- *
- * The [fraction] argument represents position on the timeline, with 0.0 meaning
- * that the interpolation has not started, returning [start] (or something
- * equivalent to [start]), 1.0 meaning that the interpolation has finished,
- * returning [stop] (or something equivalent to [stop]), and values in between
- * meaning that the interpolation is at the relevant point on the timeline
- * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
- * 1.0, so negative values and values greater than 1.0 are valid (and can
- * easily be generated by curves).
- *
- * Values for [fraction] are usually obtained from an [Animation<Float>], such as
- * an `AnimationController`.
- */
- @Stable
- fun lerp(start: Offset, stop: Offset, fraction: Float): Offset {
- return Offset(
- lerp(start.dx, stop.dx, fraction),
- lerp(start.dy, stop.dy, fraction)
- )
+ @Stable
+ fun isValid(): Boolean {
+ check(!x.isNaN() && !y.isNaN()) {
+ "Offset argument contained a NaN value."
}
-
- @Stable
- fun isValid(offset: Offset): Boolean {
- check(!offset.dx.isNaN() && !offset.dy.isNaN()) {
- "Offset argument contained a NaN value."
- }
- return true
- }
+ return true
}
/**
@@ -129,7 +108,7 @@
* consider using [getDistanceSquared] instead, since it is cheaper to compute.
*/
@Stable
- fun getDistance() = sqrt(dx * dx + dy * dy)
+ fun getDistance() = sqrt(x * x + y * y)
/**
* The square of the magnitude of the offset.
@@ -137,79 +116,7 @@
* This is cheaper than computing the [getDistance] itself.
*/
@Stable
- fun getDistanceSquared() = dx * dx + dy * dy
-
- /**
- * The angle of this offset as radians clockwise from the positive x-axis, in
- * the range -[pi] to [pi], assuming positive values of the x-axis go to the
- * left and positive values of the y-axis go down.
- *
- * Zero means that [dy] is zero and [dx] is zero or positive.
- *
- * Values from zero to [pi]/2 indicate positive values of [dx] and [dy], the
- * bottom-right quadrant.
- *
- * Values from [pi]/2 to [pi] indicate negative values of [dx] and positive
- * values of [dy], the bottom-left quadrant.
- *
- * Values from zero to -[pi]/2 indicate positive values of [dx] and negative
- * values of [dy], the top-right quadrant.
- *
- * Values from -[pi]/2 to -[pi] indicate negative values of [dx] and [dy],
- * the top-left quadrant.
- *
- * When [dy] is zero and [dx] is negative, the [direction] is [pi].
- *
- * When [dx] is zero, [direction] is [pi]/2 if [dy] is positive and -[pi]/2
- * if [dy] is negative.
- *
- * See also:
- *
- * * [distance], to compute the magnitude of the vector.
- * * [Canvas.rotate], which uses the same convention for its angle.
- */
- fun getDirection() = atan2(dy, dx)
-
- /**
- * Returns a new offset with the x component scaled by `scaleX` and the y
- * component scaled by `scaleY`.
- *
- * If the two scale arguments are the same, consider using the `*` operator
- * instead:
- *
- * ```dart
- * Offset a = const Offset(10.0, 10.0);
- * Offset b = a * 2.0; // same as: a.scale(2.0, 2.0)
- * ```
- *
- * If the two arguments are -1, consider using the unary `-` operator
- * instead:
- *
- * ```dart
- * Offset a = const Offset(10.0, 10.0);
- * Offset b = -a; // same as: a.scale(-1.0, -1.0)
- * ```
- */
- @Stable
- fun scale(scaleX: Float, scaleY: Float): Offset = Offset(dx * scaleX, dy * scaleY)
-
- /**
- * Returns a new offset with translateX added to the x component and
- * translateY added to the y component.
- *
- * If the arguments come from another [Offset], consider using the `+` or `-`
- * operators instead:
- *
- * ```dart
- * Offset a = const Offset(10.0, 10.0);
- * Offset b = const Offset(10.0, 10.0);
- * Offset c = a + b; // same as: a.translate(b.dx, b.dy)
- * Offset d = a - b; // same as: a.translate(-b.dx, -b.dy)
- * ```
- */
- @Stable
- fun translate(translateX: Float, translateY: Float): Offset =
- Offset(dx + translateX, dy + translateY)
+ fun getDistanceSquared() = x * x + y * y
/**
* Unary negation operator.
@@ -220,31 +127,27 @@
* same arrow but pointing in the reverse direction.
*/
@Stable
- operator fun unaryMinus(): Offset = Offset(-dx, -dy)
+ operator fun unaryMinus(): Offset = Offset(-x, -y)
/**
* Binary subtraction operator.
*
- * Returns an offset whose [dx] value is the left-hand-side operand's [dx]
- * minus the right-hand-side operand's [dx] and whose [dy] value is the
- * left-hand-side operand's [dy] minus the right-hand-side operand's [dy].
- *
- * See also [translate].
+ * Returns an offset whose [x] value is the left-hand-side operand's [x]
+ * minus the right-hand-side operand's [x] and whose [y] value is the
+ * left-hand-side operand's [y] minus the right-hand-side operand's [y].
*/
@Stable
- operator fun minus(other: Offset): Offset = Offset(dx - other.dx, dy - other.dy)
+ operator fun minus(other: Offset): Offset = Offset(x - other.x, y - other.y)
/**
* Binary addition operator.
*
- * Returns an offset whose [dx] value is the sum of the [dx] values of the
- * two operands, and whose [dy] value is the sum of the [dy] values of the
+ * Returns an offset whose [x] value is the sum of the [x] values of the
+ * two operands, and whose [y] value is the sum of the [y] values of the
* two operands.
- *
- * See also [translate].
*/
@Stable
- operator fun plus(other: Offset): Offset = Offset(dx + other.dx, dy + other.dy)
+ operator fun plus(other: Offset): Offset = Offset(x + other.x, y + other.y)
/**
* Multiplication operator.
@@ -252,11 +155,9 @@
* Returns an offset whose coordinates are the coordinates of the
* left-hand-side operand (an Offset) multiplied by the scalar
* right-hand-side operand (a Float).
- *
- * See also [scale].
*/
@Stable
- operator fun times(operand: Float): Offset = Offset(dx * operand, dy * operand)
+ operator fun times(operand: Float): Offset = Offset(x * operand, y * operand)
/**
* Division operator.
@@ -264,22 +165,9 @@
* Returns an offset whose coordinates are the coordinates of the
* left-hand-side operand (an Offset) divided by the scalar right-hand-side
* operand (a Float).
- *
- * See also [scale].
*/
@Stable
- operator fun div(operand: Float): Offset = Offset(dx / operand, dy / operand)
-
- /**
- * Integer (truncating) division operator.
- *
- * Returns an offset whose coordinates are the coordinates of the
- * left-hand-side operand (an Offset) divided by the scalar right-hand-side
- * operand (a Float), rounded towards zero.
- */
- // TODO(Filip): Original operator ~/ could not be overriden in Kotlin
- fun truncDiv(operand: Float) =
- Offset(truncate(dx / operand), truncate(dy / operand))
+ operator fun div(operand: Float): Offset = Offset(x / operand, y / operand)
/**
* Modulo (remainder) operator.
@@ -289,22 +177,30 @@
* right-hand-side operand (a Float).
*/
@Stable
- operator fun rem(operand: Float) = Offset(dx % operand, dy % operand)
+ operator fun rem(operand: Float) = Offset(x % operand, y % operand)
- /**
- * Rectangle constructor operator.
- *
- * Combines an [Offset] and a [Size] to form a [Rect] whose top-left
- * coordinate is the point given by adding this offset, the left-hand-side
- * operand, to the origin, and whose size is the right-hand-side operand.
- *
- * ```dart
- * Rect myRect = Offset.zero & const Size(100.0, 100.0);
- * // same as: new Rect.fromLTWH(0.0, 0.0, 100.0, 100.0)
- * ```
- */
- // TODO(Filip): Original operator & could not be overriden in Kotlin
- infix fun and(other: Size): Rect = Rect.fromLTWH(dx, dy, other.width, other.height)
+ override fun toString() = "Offset(${x.toStringAsFixed(1)}, ${y.toStringAsFixed(1)})"
+}
- override fun toString() = "Offset(${dx.toStringAsFixed(1)}, ${dy.toStringAsFixed(1)})"
+/**
+ * Linearly interpolate between two offsets.
+ *
+ * The [fraction] argument represents position on the timeline, with 0.0 meaning
+ * that the interpolation has not started, returning [start] (or something
+ * equivalent to [start]), 1.0 meaning that the interpolation has finished,
+ * returning [stop] (or something equivalent to [stop]), and values in between
+ * meaning that the interpolation is at the relevant point on the timeline
+ * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
+ * 1.0, so negative values and values greater than 1.0 are valid (and can
+ * easily be generated by curves).
+ *
+ * Values for [fraction] are usually obtained from an [Animation<Float>], such as
+ * an `AnimationController`.
+ */
+@Stable
+fun lerp(start: Offset, stop: Offset, fraction: Float): Offset {
+ return Offset(
+ lerp(start.x, stop.x, fraction),
+ lerp(start.y, stop.y, fraction)
+ )
}
\ No newline at end of file
diff --git a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/RRect.kt b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/RRect.kt
index e093dab..9c31a6b 100644
--- a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/RRect.kt
+++ b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/RRect.kt
@@ -119,7 +119,7 @@
* recreating the object each time.
*/
fun contains(point: Offset): Boolean {
- if (point.dx < left || point.dx >= right || point.dy < top || point.dy >= bottom) {
+ if (point.x < left || point.x >= right || point.y < top || point.y >= bottom) {
return false; // outside bounding box
}
@@ -131,32 +131,32 @@
val radiusY: Float
// check whether point is in one of the rounded corner areas
// x, y -> translate to ellipse center
- if (point.dx < left + scaled.topLeftRadiusX &&
- point.dy < top + scaled.topLeftRadiusY
+ if (point.x < left + scaled.topLeftRadiusX &&
+ point.y < top + scaled.topLeftRadiusY
) {
- x = point.dx - left - scaled.topLeftRadiusX
- y = point.dy - top - scaled.topLeftRadiusY
+ x = point.x - left - scaled.topLeftRadiusX
+ y = point.y - top - scaled.topLeftRadiusY
radiusX = scaled.topLeftRadiusX
radiusY = scaled.topLeftRadiusY
- } else if (point.dx > right - scaled.topRightRadiusX &&
- point.dy < top + scaled.topRightRadiusY
+ } else if (point.x > right - scaled.topRightRadiusX &&
+ point.y < top + scaled.topRightRadiusY
) {
- x = point.dx - right + scaled.topRightRadiusX
- y = point.dy - top - scaled.topRightRadiusY
+ x = point.x - right + scaled.topRightRadiusX
+ y = point.y - top - scaled.topRightRadiusY
radiusX = scaled.topRightRadiusX
radiusY = scaled.topRightRadiusY
- } else if (point.dx > right - scaled.bottomRightRadiusX &&
- point.dy > bottom - scaled.bottomRightRadiusY
+ } else if (point.x > right - scaled.bottomRightRadiusX &&
+ point.y > bottom - scaled.bottomRightRadiusY
) {
- x = point.dx - right + scaled.bottomRightRadiusX
- y = point.dy - bottom + scaled.bottomRightRadiusY
+ x = point.x - right + scaled.bottomRightRadiusX
+ y = point.y - bottom + scaled.bottomRightRadiusY
radiusX = scaled.bottomRightRadiusX
radiusY = scaled.bottomRightRadiusY
- } else if (point.dx < left + scaled.bottomLeftRadiusX &&
- point.dy > bottom - scaled.bottomLeftRadiusY
+ } else if (point.x < left + scaled.bottomLeftRadiusX &&
+ point.y > bottom - scaled.bottomLeftRadiusY
) {
- x = point.dx - left - scaled.bottomLeftRadiusX
- y = point.dy - bottom + scaled.bottomLeftRadiusY
+ x = point.x - left - scaled.bottomLeftRadiusX
+ y = point.y - bottom + scaled.bottomLeftRadiusY
radiusX = scaled.bottomLeftRadiusX
radiusY = scaled.bottomLeftRadiusY
} else {
@@ -369,10 +369,10 @@
/** Returns a new [RRect] translated by the given offset. */
fun RRect.shift(offset: Offset): RRect = RRect(
- left = left + offset.dx,
- top = top + offset.dy,
- right = right + offset.dx,
- bottom = bottom + offset.dy,
+ left = left + offset.x,
+ top = top + offset.y,
+ right = right + offset.x,
+ bottom = bottom + offset.y,
topLeft = Radius.elliptical(topLeftRadiusX, topLeftRadiusY),
topRight = Radius.elliptical(topRightRadiusX, topRightRadiusY),
bottomRight = Radius.elliptical(bottomRightRadiusX, bottomRightRadiusY),
diff --git a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Rect.kt b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Rect.kt
index 9ebaf29..2fbe835 100644
--- a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Rect.kt
+++ b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Rect.kt
@@ -79,10 +79,10 @@
@Stable
fun fromCircle(center: Offset, radius: Float): Rect {
return Rect(
- center.dx - radius,
- center.dy - radius,
- center.dx + radius,
- center.dy + radius
+ center.x - radius,
+ center.y - radius,
+ center.x + radius,
+ center.y + radius
)
}
@@ -93,10 +93,10 @@
@Stable
fun fromPoints(a: Offset, b: Offset): Rect {
return Rect(
- min(a.dx, b.dx),
- min(a.dy, b.dy),
- max(a.dx, b.dx),
- max(a.dy, b.dy)
+ min(a.x, b.x),
+ min(a.y, b.y),
+ max(a.x, b.x),
+ max(a.y, b.y)
)
}
@@ -177,7 +177,7 @@
*/
@Stable
fun shift(offset: Offset): Rect {
- return fromLTRB(left + offset.dx, top + offset.dy, right + offset.dx, bottom + offset.dy)
+ return fromLTRB(left + offset.x, top + offset.y, right + offset.x, bottom + offset.y)
}
/**
@@ -344,7 +344,7 @@
* right edges.
*/
fun contains(offset: Offset): Boolean {
- return offset.dx >= left && offset.dx < right && offset.dy >= top && offset.dy < bottom
+ return offset.x >= left && offset.x < right && offset.y >= top && offset.y < bottom
}
override fun toString() = "Rect.fromLTRB(" +
diff --git a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Size.kt b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Size.kt
index 10ca029..81306e7 100644
--- a/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Size.kt
+++ b/ui/ui-geometry/src/commonMain/kotlin/androidx/ui/geometry/Size.kt
@@ -161,14 +161,14 @@
* Subtracting an [Offset] from a [Size] returns the [Size] that is smaller than
* the [Size] operand by the difference given by the [Offset] operand. In other
* words, the returned [Size] has a [width] consisting of the [width] of the
- * left-hand-side operand minus the [Offset.dx] dimension of the
+ * left-hand-side operand minus the [Offset.x] dimension of the
* right-hand-side operand, and a [height] consisting of the [height] of the
- * left-hand-side operand minus the [Offset.dy] dimension of the
+ * left-hand-side operand minus the [Offset.y] dimension of the
* right-hand-side operand.
*/
@Stable
operator fun minus(other: Offset): Size {
- return Size(width - other.dx, height - other.dy)
+ return Size(width - other.x, height - other.y)
}
@Stable
@@ -180,13 +180,13 @@
* Binary addition operator for adding an [Offset] to a [Size].
*
* Returns a [Size] whose [width] is the sum of the [width] of the
- * left-hand-side operand, a [Size], and the [Offset.dx] dimension of the
+ * left-hand-side operand, a [Size], and the [Offset.x] dimension of the
* right-hand-side operand, an [Offset], and whose [height] is the sum of the
- * [height] of the left-hand-side operand and the [Offset.dy] dimension of
+ * [height] of the left-hand-side operand and the [Offset.y] dimension of
* the right-hand-side operand.
*/
@Stable
- operator fun plus(other: Offset) = Size(width + other.dx, height + other.dy)
+ operator fun plus(other: Offset) = Size(width + other.x, height + other.y)
/**
* Multiplication operator.
@@ -263,7 +263,7 @@
* See also [Rect.topCenter].
*/
@Stable
- fun topCenter(origin: Offset): Offset = Offset(origin.dx + width / 2.0f, origin.dy)
+ fun topCenter(origin: Offset): Offset = Offset(origin.x + width / 2.0f, origin.y)
/**
* The offset to the intersection of the top and right edges of the rectangle
@@ -273,7 +273,7 @@
* See also [Rect.topRight].
*/
@Stable
- fun topRight(origin: Offset): Offset = Offset(origin.dx + width, origin.dy)
+ fun topRight(origin: Offset): Offset = Offset(origin.x + width, origin.y)
/**
* The offset to the center of the left edge of the rectangle described by the
@@ -282,7 +282,7 @@
* See also [Rect.centerLeft].
*/
@Stable
- fun centerLeft(origin: Offset): Offset = Offset(origin.dx, origin.dy + height / 2.0f)
+ fun centerLeft(origin: Offset): Offset = Offset(origin.x, origin.y + height / 2.0f)
/**
* The offset to the point halfway between the left and right and the top and
@@ -292,7 +292,7 @@
* See also [Rect.center].
*/
@Stable
- fun center(origin: Offset = Offset.zero): Offset = Offset(origin.dx + width / 2.0f, origin.dy +
+ fun center(origin: Offset = Offset.Zero): Offset = Offset(origin.x + width / 2.0f, origin.y +
height / 2.0f)
/**
@@ -302,7 +302,7 @@
* See also [Rect.centerLeft].
*/
@Stable
- fun centerRight(origin: Offset): Offset = Offset(origin.dx + width, origin.dy + height / 2.0f)
+ fun centerRight(origin: Offset): Offset = Offset(origin.x + width, origin.y + height / 2.0f)
/**
* The offset to the intersection of the bottom and left edges of the
@@ -312,7 +312,7 @@
* See also [Rect.bottomLeft].
*/
@Stable
- fun bottomLeft(origin: Offset): Offset = Offset(origin.dx, origin.dy + height)
+ fun bottomLeft(origin: Offset): Offset = Offset(origin.x, origin.y + height)
/**
* The offset to the center of the bottom edge of the rectangle described by
@@ -322,7 +322,7 @@
* See also [Rect.bottomLeft].
*/
@Stable
- fun bottomCenter(origin: Offset): Offset = Offset(origin.dx + width / 2.0f, origin.dy + height)
+ fun bottomCenter(origin: Offset): Offset = Offset(origin.x + width / 2.0f, origin.y + height)
/**
* The offset to the intersection of the bottom and right edges of the
@@ -332,7 +332,7 @@
* See also [Rect.bottomRight].
*/
@Stable
- fun bottomRight(origin: Offset): Offset = Offset(origin.dx + width, origin.dy + height)
+ fun bottomRight(origin: Offset): Offset = Offset(origin.x + width, origin.y + height)
/**
* Whether the point specified by the given offset (which is assumed to be
@@ -344,7 +344,7 @@
*/
@Stable
fun contains(offset: Offset): Boolean {
- return offset.dx >= 0.0f && offset.dx < width && offset.dy >= 0.0f && offset.dy < height
+ return offset.x >= 0.0f && offset.x < width && offset.y >= 0.0f && offset.y < height
}
/**
diff --git a/ui/ui-graphics/api/0.1.0-dev14.txt b/ui/ui-graphics/api/0.1.0-dev14.txt
index cb99c3c..0092d51 100644
--- a/ui/ui-graphics/api/0.1.0-dev14.txt
+++ b/ui/ui-graphics/api/0.1.0-dev14.txt
@@ -32,7 +32,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -53,7 +53,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -132,10 +132,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -383,7 +383,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -404,7 +404,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -469,18 +469,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -725,41 +725,41 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -777,9 +777,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -792,7 +792,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -829,7 +829,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1239,7 +1239,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/api/current.txt b/ui/ui-graphics/api/current.txt
index cb99c3c..0092d51 100644
--- a/ui/ui-graphics/api/current.txt
+++ b/ui/ui-graphics/api/current.txt
@@ -32,7 +32,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -53,7 +53,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -132,10 +132,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -383,7 +383,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -404,7 +404,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -469,18 +469,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -725,41 +725,41 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -777,9 +777,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -792,7 +792,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -829,7 +829,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1239,7 +1239,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-graphics/api/public_plus_experimental_0.1.0-dev14.txt
index cb99c3c..0092d51 100644
--- a/ui/ui-graphics/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-graphics/api/public_plus_experimental_0.1.0-dev14.txt
@@ -32,7 +32,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -53,7 +53,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -132,10 +132,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -383,7 +383,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -404,7 +404,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -469,18 +469,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -725,41 +725,41 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -777,9 +777,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -792,7 +792,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -829,7 +829,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1239,7 +1239,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/api/public_plus_experimental_current.txt b/ui/ui-graphics/api/public_plus_experimental_current.txt
index cb99c3c..0092d51 100644
--- a/ui/ui-graphics/api/public_plus_experimental_current.txt
+++ b/ui/ui-graphics/api/public_plus_experimental_current.txt
@@ -32,7 +32,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -53,7 +53,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -132,10 +132,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -383,7 +383,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -404,7 +404,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -469,18 +469,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -725,41 +725,41 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -777,9 +777,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -792,7 +792,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -829,7 +829,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1239,7 +1239,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/api/restricted_0.1.0-dev14.txt b/ui/ui-graphics/api/restricted_0.1.0-dev14.txt
index ec1eb78..7a86710 100644
--- a/ui/ui-graphics/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-graphics/api/restricted_0.1.0-dev14.txt
@@ -20,10 +20,10 @@
method public void concat(androidx.ui.graphics.vectormath.Matrix4 matrix4);
method public void disableZ();
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize, long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize, androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
method public void drawPoints(androidx.ui.graphics.PointMode pointMode, java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.Paint paint);
@@ -64,7 +64,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -85,7 +85,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -164,10 +164,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -416,7 +416,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -437,7 +437,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -502,18 +502,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -758,42 +758,42 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
method @kotlin.PublishedApi internal final void setSize-b2zCL34(long size);
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -813,9 +813,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -828,7 +828,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -865,7 +865,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1275,7 +1275,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/api/restricted_current.txt b/ui/ui-graphics/api/restricted_current.txt
index ec1eb78..7a86710 100644
--- a/ui/ui-graphics/api/restricted_current.txt
+++ b/ui/ui-graphics/api/restricted_current.txt
@@ -20,10 +20,10 @@
method public void concat(androidx.ui.graphics.vectormath.Matrix4 matrix4);
method public void disableZ();
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize, long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize, androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
method public void drawPoints(androidx.ui.graphics.PointMode pointMode, java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.Paint paint);
@@ -64,7 +64,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -85,7 +85,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType value);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public androidx.ui.graphics.PathFillType fillType;
property public boolean isConvex;
property public boolean isEmpty;
@@ -164,10 +164,10 @@
method public default void drawArc(androidx.ui.geometry.Rect rect, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public void drawArc(float left, float top, float right, float bottom, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.graphics.Paint paint);
method public default void drawArcRad(androidx.ui.geometry.Rect rect, float startAngleRad, float sweepAngleRad, boolean useCenter, androidx.ui.graphics.Paint paint);
- method public void drawCircle-NfwrgZA(long center, float radius, androidx.ui.graphics.Paint paint);
- method public void drawImage--AHD2Ng(androidx.ui.graphics.ImageAsset image, long topLeftOffset, androidx.ui.graphics.Paint paint);
- method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
- method public void drawLine-d9kBv1M(long p1, long p2, androidx.ui.graphics.Paint paint);
+ method public void drawCircle(androidx.ui.geometry.Offset center, float radius, androidx.ui.graphics.Paint paint);
+ method public void drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeftOffset, androidx.ui.graphics.Paint paint);
+ method public void drawImageRect-btuv3no(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset, long dstSize, androidx.ui.graphics.Paint paint);
+ method public void drawLine(androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.Paint paint);
method public default void drawOval(androidx.ui.geometry.Rect rect, androidx.ui.graphics.Paint paint);
method public void drawOval(float left, float top, float right, float bottom, androidx.ui.graphics.Paint paint);
method public void drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Paint paint);
@@ -416,7 +416,7 @@
method public void addArc(androidx.ui.geometry.Rect oval, float startAngleDegrees, float sweepAngleDegrees);
method public void addArcRad(androidx.ui.geometry.Rect oval, float startAngleRadians, float sweepAngleRadians);
method public void addOval(androidx.ui.geometry.Rect oval);
- method public void addPath-m3TnucA(androidx.ui.graphics.Path path, long offset = Offset.zero);
+ method public void addPath(androidx.ui.graphics.Path path, androidx.ui.geometry.Offset offset = Offset.Zero);
method public void addRRect(androidx.ui.geometry.RRect rrect);
method public void addRect(androidx.ui.geometry.Rect rect);
method public void arcTo(androidx.ui.geometry.Rect rect, float startAngleDegrees, float sweepAngleDegrees, boolean forceMoveTo);
@@ -437,7 +437,7 @@
method public void relativeQuadraticBezierTo(float x1, float y1, float x2, float y2);
method public void reset();
method public void setFillType(androidx.ui.graphics.PathFillType p);
- method public void shift-RIqb49o(long offset);
+ method public void shift(androidx.ui.geometry.Offset offset);
property public abstract androidx.ui.graphics.PathFillType fillType;
property public abstract boolean isConvex;
property public abstract boolean isEmpty;
@@ -502,18 +502,18 @@
public final class ShaderKt {
method public static android.graphics.Shader ImageShader(androidx.ui.graphics.ImageAsset image, androidx.ui.graphics.TileMode tileModeX = androidx.ui.graphics.TileMode.Clamp, androidx.ui.graphics.TileMode tileModeY = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader LinearGradientShader-BG1VTC8(long from, long to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
- method public static android.graphics.Shader RadialGradientShader-nSjqbmE(long center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader LinearGradientShader(androidx.ui.geometry.Offset from, androidx.ui.geometry.Offset to, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
+ method public static android.graphics.Shader RadialGradientShader(androidx.ui.geometry.Offset center, float radius, java.util.List<androidx.ui.graphics.Color> colors, java.util.List<java.lang.Float>? colorStops = null, androidx.ui.graphics.TileMode tileMode = androidx.ui.graphics.TileMode.Clamp);
}
@androidx.compose.Immutable public final class Shadow {
method public long component1();
- method public long component2();
+ method public androidx.ui.geometry.Offset component2();
method public float component3();
- method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, long offset, float blurRadius);
+ method @androidx.compose.Immutable public androidx.ui.graphics.Shadow copy-hgWLwZA(long color, androidx.ui.geometry.Offset offset, float blurRadius);
method public float getBlurRadius();
method public long getColor();
- method public long getOffset();
+ method public androidx.ui.geometry.Offset getOffset();
field public static final androidx.ui.graphics.Shadow.Companion! Companion;
}
@@ -758,42 +758,42 @@
@androidx.ui.graphics.drawscope.DrawScopeMarker public interface CanvasTransform {
method public void clipPath(androidx.ui.graphics.Path path, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
method public void clipRect(float left = 0.0f, float top = 0.0f, float right = size.width, float bottom = size.height, androidx.ui.graphics.ClipOp clipOp = androidx.ui.graphics.ClipOp.intersect);
- method public default long getCenter();
+ method public default androidx.ui.geometry.Offset getCenter();
method public long getSize();
method public void inset(float left, float top, float right, float bottom);
- method public void rotate(float degrees, float pivotX = center.dx, float pivotY = center.dy);
- method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy);
+ method public void rotate(float degrees, float pivotX = center.x, float pivotY = center.y);
+ method public void scale(float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y);
method public void translate(float left = 0.0f, float top = 0.0f);
- property public default long center;
+ property public default androidx.ui.geometry.Offset center;
property public abstract long size;
}
@androidx.ui.graphics.drawscope.DrawScopeMarker public abstract class DrawScope implements androidx.ui.unit.Density {
ctor public DrawScope();
method public final void draw-mEaFHtM(androidx.ui.graphics.Canvas canvas, long size, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawCircle-nE2_nkE(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, long center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, long srcOffset = Offset.zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), long dstOffset = Offset.zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawImage-p3XzKf0(androidx.ui.graphics.ImageAsset image, long topLeft = Offset.zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-SuN1Ejc(long color, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawLine-p3tcZP4(androidx.ui.graphics.Brush brush, long p1, long p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-MKXvu20(androidx.ui.graphics.Brush brush, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawArc-w9iw49s(long color, float startAngle, float sweepAngle, boolean useCenter, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle(androidx.ui.graphics.Brush brush, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawCircle-UNeD5NE(long color, float radius = size.minDimension / 2.0, androidx.ui.geometry.Offset center = this.center, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset topLeft = Offset.Zero, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawImage-SM7YF0Q(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset = Offset.Zero, long srcSize = Size(image.width.toFloat(), image.height.toFloat()), androidx.ui.geometry.Offset dstOffset = Offset.Zero, long dstSize = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawLine-SuN1Ejc(long color, androidx.ui.geometry.Offset p1, androidx.ui.geometry.Offset p2, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawOval-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath(androidx.ui.graphics.Path path, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPath-u5ZPEDk(androidx.ui.graphics.Path path, long color, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, androidx.ui.graphics.Brush brush, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
method public final kotlin.Unit? drawPoints-kayC28I(java.util.List<androidx.ui.geometry.Offset> points, androidx.ui.graphics.PointMode pointMode, long color, androidx.ui.graphics.drawscope.Stroke stroke, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-5gW23P0(long color, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, long topLeft = Offset.zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
- method public final long getCenter();
+ method public final kotlin.Unit? drawRect-5gW23P0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRect-m7aN-JY(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-4SUkJp4(androidx.ui.graphics.Brush brush, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final kotlin.Unit? drawRoundRect-JepXTL0(long color, androidx.ui.geometry.Offset topLeft = Offset.Zero, long size = this.size, float radiusX = 0.0f, float radiusY = 0.0f, androidx.ui.graphics.drawscope.DrawStyle style = Fill, @FloatRange(from=0.0, to=1.0) float alpha = 1.0f, androidx.ui.graphics.ColorFilter? colorFilter = null, androidx.ui.graphics.BlendMode blendMode = DefaultBlendMode);
+ method public final androidx.ui.geometry.Offset getCenter();
method public abstract androidx.ui.core.LayoutDirection getLayoutDirection();
method public final long getSize();
method @kotlin.PublishedApi internal final void setSize-b2zCL34(long size);
- property public final long center;
+ property public final androidx.ui.geometry.Offset center;
property public abstract androidx.ui.core.LayoutDirection layoutDirection;
property public final long size;
field public static final androidx.ui.graphics.drawscope.DrawScope.Companion! Companion;
@@ -813,9 +813,9 @@
method public static inline kotlin.Unit? drawCanvas(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.geometry.Size,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float left, float top, float right, float bottom, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? inset(androidx.ui.graphics.drawscope.DrawScope, float dx = 0.0f, float dy = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
- method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.dx, float pivotY = center.dy, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotate(androidx.ui.graphics.drawscope.DrawScope, float degrees, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? rotateRad(androidx.ui.graphics.drawscope.DrawScope, float radians, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
+ method public static inline androidx.ui.graphics.Canvas? scale(androidx.ui.graphics.drawscope.DrawScope, float scaleX, float scaleY = scaleX, float pivotX = center.x, float pivotY = center.y, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? translate(androidx.ui.graphics.drawscope.DrawScope, float left = 0.0f, float top = 0.0f, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> block);
method public static inline androidx.ui.graphics.Canvas? withTransform(androidx.ui.graphics.drawscope.DrawScope, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.CanvasTransform,kotlin.Unit> transformBlock, kotlin.jvm.functions.Function1<? super androidx.ui.graphics.drawscope.DrawScope,kotlin.Unit> drawBlock);
}
@@ -828,7 +828,7 @@
public final class DrawTransformKt {
method public static inline void inset(androidx.ui.graphics.drawscope.CanvasTransform, float dx = 0.0f, float dy = 0.0f);
- method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.dx, float pivotY = center.dy);
+ method public static inline void rotateRad(androidx.ui.graphics.drawscope.CanvasTransform, float radians, float pivotX = center.x, float pivotY = center.y);
}
public final class Fill extends androidx.ui.graphics.drawscope.DrawStyle {
@@ -865,7 +865,7 @@
}
public final class ImagePainter extends androidx.ui.graphics.painter.Painter {
- method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, long srcOffset, long srcSize);
+ method public androidx.ui.graphics.painter.ImagePainter copy-gqgapXI(androidx.ui.graphics.ImageAsset image, androidx.ui.geometry.Offset srcOffset, long srcSize);
method public long getIntrinsicSize();
method protected void onDraw(androidx.ui.graphics.drawscope.DrawScope);
property public long intrinsicSize;
@@ -1275,7 +1275,7 @@
method public static androidx.ui.geometry.Rect inverseTransformRect(androidx.ui.graphics.vectormath.Matrix4 transform, androidx.ui.geometry.Rect rect);
method public static boolean isIdentity(androidx.ui.graphics.vectormath.Matrix4);
method public static boolean matrixEquals(androidx.ui.graphics.vectormath.Matrix4? a, androidx.ui.graphics.vectormath.Matrix4? b);
- method public static long transformPoint-k2M_ft0(androidx.ui.graphics.vectormath.Matrix4, long point);
+ method public static androidx.ui.geometry.Offset transformPoint(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Offset point);
method public static androidx.ui.geometry.Rect transformRect(androidx.ui.graphics.vectormath.Matrix4, androidx.ui.geometry.Rect rect);
}
diff --git a/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/ui/graphics/painter/ImagePainterTest.kt b/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/ui/graphics/painter/ImagePainterTest.kt
index 26dfd81..ca4cdf8 100644
--- a/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/ui/graphics/painter/ImagePainterTest.kt
+++ b/ui/ui-graphics/src/androidAndroidTest/kotlin/androidx/ui/graphics/painter/ImagePainterTest.kt
@@ -134,7 +134,7 @@
val canvas = Canvas(dst)
val topLeftPainter = ImagePainter(srcImage,
- srcOffset = Offset.zero,
+ srcOffset = Offset.Zero,
srcSize = Size(50.0f, 50.0f)
)
diff --git a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidCanvas.kt b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidCanvas.kt
index e86b2d6..acecd0e 100644
--- a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidCanvas.kt
+++ b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidCanvas.kt
@@ -188,10 +188,10 @@
*/
override fun drawLine(p1: Offset, p2: Offset, paint: Paint) {
internalCanvas.drawLine(
- p1.dx,
- p1.dy,
- p2.dx,
- p2.dy,
+ p1.x,
+ p1.y,
+ p2.x,
+ p2.y,
paint.asFrameworkPaint()
)
}
@@ -229,8 +229,8 @@
*/
override fun drawCircle(center: Offset, radius: Float, paint: Paint) {
internalCanvas.drawCircle(
- center.dx,
- center.dy,
+ center.x,
+ center.y,
radius,
paint.asFrameworkPaint()
)
@@ -271,8 +271,8 @@
override fun drawImage(image: ImageAsset, topLeftOffset: Offset, paint: Paint) {
internalCanvas.drawBitmap(
image.asAndroidBitmap(),
- topLeftOffset.dx,
- topLeftOffset.dy,
+ topLeftOffset.x,
+ topLeftOffset.y,
paint.asFrameworkPaint()
)
}
@@ -294,16 +294,16 @@
internalCanvas.drawBitmap(
image.asAndroidBitmap(),
srcRect.apply {
- left = srcOffset.dx.toInt()
- top = srcOffset.dy.toInt()
- right = (srcOffset.dx + srcSize.width).toInt()
- bottom = (srcOffset.dy + srcSize.height).toInt()
+ left = srcOffset.x.toInt()
+ top = srcOffset.y.toInt()
+ right = (srcOffset.x + srcSize.width).toInt()
+ bottom = (srcOffset.y + srcSize.height).toInt()
},
dstRect.apply {
- left = dstOffset.dx.toInt()
- top = dstOffset.dy.toInt()
- right = (dstOffset.dx + dstSize.width).toInt()
- bottom = (dstOffset.dy + dstSize.height).toInt()
+ left = dstOffset.x.toInt()
+ top = dstOffset.y.toInt()
+ right = (dstOffset.x + dstSize.width).toInt()
+ bottom = (dstOffset.y + dstSize.height).toInt()
},
paint.asFrameworkPaint()
)
@@ -337,8 +337,8 @@
private fun drawPoints(points: List<Offset>, paint: Paint) {
points.fastForEach { point ->
internalCanvas.drawPoint(
- point.dx,
- point.dy,
+ point.x,
+ point.y,
paint.asFrameworkPaint()
)
}
@@ -362,10 +362,10 @@
val p1 = points[i]
val p2 = points[i + 1]
internalCanvas.drawLine(
- p1.dx,
- p1.dy,
- p2.dx,
- p2.dy,
+ p1.x,
+ p1.y,
+ p2.x,
+ p2.y,
paint.asFrameworkPaint()
)
}
diff --git a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidPath.kt b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidPath.kt
index 9722bd4..4025d38 100644
--- a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidPath.kt
+++ b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidPath.kt
@@ -169,7 +169,7 @@
}
override fun addPath(path: Path, offset: Offset) {
- internalPath.addPath(path.asAndroidPath(), offset.dx, offset.dy)
+ internalPath.addPath(path.asAndroidPath(), offset.x, offset.y)
}
override fun close() {
@@ -182,7 +182,7 @@
override fun shift(offset: Offset) {
mMatrix.reset()
- mMatrix.setTranslate(offset.dx, offset.dy)
+ mMatrix.setTranslate(offset.x, offset.y)
internalPath.transform(mMatrix)
}
diff --git a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidShader.kt b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidShader.kt
index 9972694..dcbbfbb 100644
--- a/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidShader.kt
+++ b/ui/ui-graphics/src/androidMain/kotlin/androidx/ui/graphics/AndroidShader.kt
@@ -33,10 +33,10 @@
validateColorStops(colors, colorStops)
return Shader(
LinearGradient(
- from.dx,
- from.dy,
- to.dx,
- to.dy,
+ from.x,
+ from.y,
+ to.x,
+ to.y,
colors.toIntArray(),
colorStops?.toFloatArray(),
tileMode.toNativeTileMode()
@@ -54,8 +54,8 @@
validateColorStops(colors, colorStops)
return Shader(
RadialGradient(
- center.dx,
- center.dy,
+ center.x,
+ center.y,
radius,
colors.toIntArray(),
colorStops?.toFloatArray(),
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Canvas.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Canvas.kt
index 5dbebc7..69f3a10 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Canvas.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Canvas.kt
@@ -560,7 +560,7 @@
*/
fun drawImageRect(
image: ImageAsset,
- srcOffset: Offset = Offset.zero,
+ srcOffset: Offset = Offset.Zero,
srcSize: Size = Size(image.width.toFloat(), image.height.toFloat()),
dstOffset: Offset,
dstSize: Size,
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Path.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Path.kt
index 281462d..cac643c 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Path.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Path.kt
@@ -207,7 +207,7 @@
* after the matrix is translated by the given offset. The matrix is a 4x4
* matrix stored in column major order.
*/
- fun addPath(path: Path, offset: Offset = Offset.zero)
+ fun addPath(path: Path, offset: Offset = Offset.Zero)
/**
* Closes the last subpath, as if a straight line had been drawn
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Shadow.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Shadow.kt
index ce60cdd..29d8aaa 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Shadow.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Shadow.kt
@@ -19,6 +19,7 @@
import androidx.compose.Immutable
import androidx.compose.Stable
import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import androidx.ui.util.lerp
/**
@@ -29,7 +30,7 @@
@Stable
val color: Color = Color(0xFF000000),
@Stable
- val offset: Offset = Offset.zero,
+ val offset: Offset = Offset.Zero,
@Stable
val blurRadius: Float = 0.0f
) {
@@ -49,7 +50,7 @@
fun lerp(start: Shadow, stop: Shadow, fraction: Float): Shadow {
return Shadow(
lerp(start.color, stop.color, fraction),
- Offset.lerp(start.offset, stop.offset, fraction),
+ lerp(start.offset, stop.offset, fraction),
lerp(start.blurRadius, stop.blurRadius, fraction)
)
}
\ No newline at end of file
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Vertices.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Vertices.kt
index deeb0f2..68cf6f8a 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Vertices.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/Vertices.kt
@@ -61,9 +61,9 @@
val pointIndex = i / 2
val point = points[pointIndex]
if (i % 2 == 0) {
- point.dx
+ point.x
} else {
- point.dy
+ point.y
}
}
}
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawScope.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawScope.kt
index 0330aee..39c9dd1 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawScope.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawScope.kt
@@ -111,8 +111,8 @@
*/
inline fun DrawScope.rotate(
degrees: Float,
- pivotX: Float = center.dx,
- pivotY: Float = center.dy,
+ pivotX: Float = center.x,
+ pivotY: Float = center.y,
block: DrawScope.() -> Unit
) = withTransform({ rotate(degrees, pivotX, pivotY) }, block)
@@ -130,8 +130,8 @@
*/
inline fun DrawScope.rotateRad(
radians: Float,
- pivotX: Float = center.dx,
- pivotY: Float = center.dy,
+ pivotX: Float = center.x,
+ pivotY: Float = center.y,
block: DrawScope.() -> Unit
) = withTransform({ rotate(degrees(radians), pivotX, pivotY) }, block)
@@ -155,8 +155,8 @@
inline fun DrawScope.scale(
scaleX: Float,
scaleY: Float = scaleX,
- pivotX: Float = center.dx,
- pivotY: Float = center.dy,
+ pivotX: Float = center.x,
+ pivotY: Float = center.y,
block: DrawScope.() -> Unit
) = withTransform({ scale(scaleX, scaleY, pivotX, pivotY) }, block)
@@ -413,17 +413,17 @@
*/
fun drawRect(
brush: Brush,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawRect(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
paint = configurePaint(brush, style, alpha, colorFilter, blendMode)
)
@@ -443,17 +443,17 @@
*/
fun drawRect(
color: Color,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawRect(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
paint = configurePaint(color, style, alpha, colorFilter, blendMode)
)
@@ -471,7 +471,7 @@
*/
fun drawImage(
image: ImageAsset,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
@@ -507,9 +507,9 @@
*/
fun drawImage(
image: ImageAsset,
- srcOffset: Offset = Offset.zero,
+ srcOffset: Offset = Offset.Zero,
srcSize: Size = Size(image.width.toFloat(), image.height.toFloat()),
- dstOffset: Offset = Offset.zero,
+ dstOffset: Offset = Offset.Zero,
dstSize: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
@@ -542,7 +542,7 @@
*/
fun drawRoundRect(
brush: Brush,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
radiusX: Float = 0.0f,
radiusY: Float = 0.0f,
@@ -551,10 +551,10 @@
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawRoundRect(
- topLeft.dx,
- topLeft.dy,
- topLeft.dx + size.width,
- topLeft.dy + size.height,
+ topLeft.x,
+ topLeft.y,
+ topLeft.x + size.width,
+ topLeft.y + size.height,
radiusX,
radiusY,
configurePaint(brush, style, alpha, colorFilter, blendMode)
@@ -577,7 +577,7 @@
*/
fun drawRoundRect(
color: Color,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
radiusX: Float = 0.0f,
radiusY: Float = 0.0f,
@@ -586,10 +586,10 @@
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawRoundRect(
- topLeft.dx,
- topLeft.dy,
- topLeft.dx + size.width,
- topLeft.dy + size.height,
+ topLeft.x,
+ topLeft.y,
+ topLeft.x + size.width,
+ topLeft.y + size.height,
radiusX,
radiusY,
configurePaint(color, style, alpha, colorFilter, blendMode)
@@ -665,17 +665,17 @@
*/
fun drawOval(
brush: Brush,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawOval(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
paint = configurePaint(brush, style, alpha, colorFilter, blendMode)
)
@@ -695,17 +695,17 @@
*/
fun drawOval(
color: Color,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawOval(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
paint = configurePaint(color, style, alpha, colorFilter, blendMode)
)
@@ -737,17 +737,17 @@
startAngle: Float,
sweepAngle: Float,
useCenter: Boolean,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawArc(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
startAngle = startAngle,
sweepAngle = sweepAngle,
useCenter = useCenter,
@@ -782,17 +782,17 @@
startAngle: Float,
sweepAngle: Float,
useCenter: Boolean,
- topLeft: Offset = Offset.zero,
+ topLeft: Offset = Offset.Zero,
size: Size = this.size,
@FloatRange(from = 0.0, to = 1.0) alpha: Float = DefaultAlpha,
style: DrawStyle = Fill,
colorFilter: ColorFilter? = null,
blendMode: BlendMode = DefaultBlendMode
) = canvas?.drawArc(
- left = topLeft.dx,
- top = topLeft.dy,
- right = topLeft.dx + size.width,
- bottom = topLeft.dy + size.height,
+ left = topLeft.x,
+ top = topLeft.y,
+ right = topLeft.x + size.width,
+ bottom = topLeft.y + size.height,
startAngle = startAngle,
sweepAngle = sweepAngle,
useCenter = useCenter,
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawTransform.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawTransform.kt
index d09b05f..26be071 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawTransform.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/drawscope/DrawTransform.kt
@@ -47,8 +47,8 @@
@Suppress("NOTHING_TO_INLINE")
inline fun CanvasTransform.rotateRad(
radians: Float,
- pivotX: Float = center.dx,
- pivotY: Float = center.dy
+ pivotX: Float = center.x,
+ pivotY: Float = center.y
) = rotate(degrees(radians), pivotX, pivotY)
/**
@@ -131,7 +131,7 @@
* @param pivotY The y-coordinate for the pivot point, defaults to the center of the
* coordinate space vertically
*/
- fun rotate(degrees: Float, pivotX: Float = center.dx, pivotY: Float = center.dy)
+ fun rotate(degrees: Float, pivotX: Float = center.x, pivotY: Float = center.y)
/**
* Add an axis-aligned scale to the current transform, scaling by the first
@@ -152,7 +152,7 @@
fun scale(
scaleX: Float,
scaleY: Float = scaleX,
- pivotX: Float = center.dx,
- pivotY: Float = center.dy
+ pivotX: Float = center.x,
+ pivotY: Float = center.y
)
}
\ No newline at end of file
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/painter/ImagePainter.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/painter/ImagePainter.kt
index c991b9b..e9c6726 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/painter/ImagePainter.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/painter/ImagePainter.kt
@@ -38,7 +38,7 @@
*/
data class ImagePainter(
private val image: ImageAsset,
- private val srcOffset: Offset = Offset.zero,
+ private val srcOffset: Offset = Offset.Zero,
private val srcSize: Size = Size(image.width.toFloat(), image.height.toFloat())
) : Painter() {
@@ -75,8 +75,8 @@
private fun validateSize(srcOffset: Offset, srcSize: Size): Size {
require(
- srcOffset.dx >= 0 &&
- srcOffset.dy >= 0 &&
+ srcOffset.x >= 0 &&
+ srcOffset.y >= 0 &&
srcSize.width >= 0 &&
srcSize.height >= 0 &&
srcSize.width <= image.width &&
diff --git a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/vectormath/Matrix4.kt b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/vectormath/Matrix4.kt
index 29fe766..c0fc9b9e 100644
--- a/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/vectormath/Matrix4.kt
+++ b/ui/ui-graphics/src/commonMain/kotlin/androidx/ui/graphics/vectormath/Matrix4.kt
@@ -612,7 +612,7 @@
* z-coordinate of the result is ignored.
*/
fun Matrix4.transformPoint(point: Offset): Offset {
- val position3 = Vector3(point.dx, point.dy, 0.0f)
+ val position3 = Vector3(point.x, point.y, 0.0f)
val transformed3 = perspectiveTransform(position3)
return Offset(transformed3.x, transformed3.y)
}
@@ -631,10 +631,10 @@
val point3 = transformPoint(rect.getBottomLeft())
val point4 = transformPoint(rect.getBottomRight())
return Rect.fromLTRB(
- min4(point1.dx, point2.dx, point3.dx, point4.dx),
- min4(point1.dy, point2.dy, point3.dy, point4.dy),
- max4(point1.dx, point2.dx, point3.dx, point4.dx),
- max4(point1.dy, point2.dy, point3.dy, point4.dy)
+ min4(point1.x, point2.x, point3.x, point4.x),
+ min4(point1.y, point2.y, point3.y, point4.y),
+ max4(point1.x, point2.x, point3.x, point4.x),
+ max4(point1.y, point2.y, point3.y, point4.y)
)
}
diff --git a/ui/ui-graphics/src/test/java/androidx/ui/graphics/ShadowTest.kt b/ui/ui-graphics/src/test/java/androidx/ui/graphics/ShadowTest.kt
index a5660ca..da7b419 100644
--- a/ui/ui-graphics/src/test/java/androidx/ui/graphics/ShadowTest.kt
+++ b/ui/ui-graphics/src/test/java/androidx/ui/graphics/ShadowTest.kt
@@ -17,6 +17,7 @@
package androidx.ui.painting
import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import androidx.ui.graphics.Color
import androidx.ui.graphics.Shadow
import androidx.ui.graphics.lerp
@@ -34,7 +35,7 @@
val shadow = Shadow()
assertThat(shadow.color, equalTo(Color(0xFF000000)))
assertThat(shadow.blurRadius, equalTo(0.0f))
- assertThat(shadow.offset, equalTo(Offset.zero))
+ assertThat(shadow.offset, equalTo(Offset.Zero))
}
@Test
@@ -63,7 +64,7 @@
val shadow = lerp(shadowA, shadowB, t)
assertThat(shadow.color, equalTo(lerp(colorA, colorB, t)))
- assertThat(shadow.offset, equalTo(Offset.lerp(offsetA, offsetB, t)))
+ assertThat(shadow.offset, equalTo(lerp(offsetA, offsetB, t)))
assertThat(shadow.blurRadius, equalTo(lerp(radiusA, radiusB, t)))
}
}
\ No newline at end of file
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
index 9890171..2b81664 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/AlignmentLineTest.kt
@@ -25,11 +25,11 @@
import androidx.ui.core.WithConstraints
import androidx.ui.core.globalPosition
import androidx.ui.core.onPositioned
+import androidx.ui.geometry.Offset
import androidx.ui.layout.Stack
import androidx.ui.layout.preferredSizeIn
import androidx.ui.layout.relativePaddingFrom
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
@@ -54,7 +54,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(
Modifier.onPositioned {
@@ -103,7 +103,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(
modifier = Modifier.onPositioned {
@@ -150,7 +150,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)) {
Layout(
@@ -184,7 +184,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)) {
Layout(
@@ -219,7 +219,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)) {
Layout(
@@ -260,7 +260,7 @@
val parentSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(Modifier.saveLayoutInfo(parentSize, Ref(), layoutLatch)) {
Layout(
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
index eef79e1..324a8eb 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
@@ -43,7 +43,7 @@
import androidx.ui.test.runOnIdleCompose
import androidx.ui.test.waitForIdle
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert
@@ -307,7 +307,7 @@
val boxSize = 100.ipx
val offset = 150.ipx
- val position = Array(3) { Ref<PxPosition>() }
+ val position = Array(3) { Ref<Offset>() }
composeTestRule.setContent {
ConstraintLayout(Modifier.fillMaxSize()) {
@@ -350,15 +350,23 @@
runOnIdleCompose {
assertEquals(
- PxPosition((displayWidth - boxSize) / 2, (displayHeight - boxSize) / 2),
+ Offset(
+ ((displayWidth - boxSize) / 2).value.toFloat(),
+ ((displayHeight - boxSize) / 2).value.toFloat()),
position[0].value
)
assertEquals(
- PxPosition(displayWidth / 2 + offset, (displayHeight - boxSize) / 2 - boxSize),
+ Offset(
+ (displayWidth / 2 + offset).value.toFloat(),
+ ((displayHeight - boxSize) / 2 - boxSize).value.toFloat()
+ ),
position[1].value
)
assertEquals(
- PxPosition(offset, displayHeight - boxSize - offset),
+ Offset(
+ offset.value.toFloat(),
+ (displayHeight - boxSize - offset).value.toFloat()
+ ),
position[2].value
)
}
@@ -369,7 +377,7 @@
val boxSize = 100.ipx
val offset = 150.ipx
- val position = Array(3) { Ref<PxPosition>() }
+ val position = Array(3) { Ref<Offset>() }
composeTestRule.setContent {
ConstraintLayout(
@@ -410,15 +418,24 @@
runOnIdleCompose {
assertEquals(
- PxPosition((displayWidth - boxSize) / 2, (displayHeight - boxSize) / 2),
+ Offset(
+ (displayWidth - boxSize).value / 2f,
+ (displayHeight - boxSize).value / 2f
+ ),
position[0].value
)
assertEquals(
- PxPosition(displayWidth / 2 + offset, (displayHeight - boxSize) / 2 - boxSize),
+ Offset(
+ (displayWidth / 2f + offset).value.toFloat(),
+ ((displayHeight - boxSize) / 2 - boxSize).value.toFloat()
+ ),
position[1].value
)
assertEquals(
- PxPosition(offset, displayHeight - boxSize - offset),
+ Offset(
+ offset.value.toFloat(),
+ (displayHeight - boxSize - offset).value.toFloat()
+ ),
position[2].value
)
}
@@ -429,7 +446,7 @@
val boxSize = 100.ipx
val offset = 150.ipx
- val position = Array(3) { Ref<PxPosition>() }
+ val position = Array(3) { Ref<Offset>() }
composeTestRule.setContent {
ConstraintLayout(Modifier.rtl.fillMaxSize()) {
@@ -472,18 +489,24 @@
runOnIdleCompose {
assertEquals(
- PxPosition((displayWidth - boxSize) / 2, (displayHeight - boxSize) / 2),
+ Offset(
+ (displayWidth - boxSize).value / 2f,
+ (displayHeight - boxSize).value / 2f
+ ),
position[0].value
)
assertEquals(
- PxPosition(
- displayWidth / 2 - offset - boxSize,
- (displayHeight - boxSize) / 2 - boxSize
+ Offset(
+ (displayWidth / 2 - offset - boxSize).value.toFloat(),
+ ((displayHeight - boxSize) / 2 - boxSize).value.toFloat()
),
position[1].value
)
assertEquals(
- PxPosition(displayWidth - offset - boxSize, displayHeight - boxSize - offset),
+ Offset(
+ (displayWidth - offset - boxSize).value.toFloat(),
+ (displayHeight - boxSize - offset).value.toFloat()
+ ),
position[2].value
)
}
@@ -818,7 +841,7 @@
val size = 200.ipx.toDp()
val offset = 50.ipx.toDp()
- val position = Array(2) { PxPosition(0f, 0f) }
+ val position = Array(2) { Offset(0f, 0f) }
composeTestRule.setContent {
ConstraintLayout(Modifier.size(size)) {
val box = createRef()
@@ -857,8 +880,8 @@
}
runOnIdleCompose {
- Assert.assertEquals(PxPosition(60f, 60f), position[0])
- Assert.assertEquals(PxPosition(61f, 61f), position[1])
+ Assert.assertEquals(Offset(60f, 60f), position[0])
+ Assert.assertEquals(Offset(61f, 61f), position[1])
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
index fb4f23b..f9662aa 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ContainerTest.kt
@@ -34,7 +34,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -80,7 +80,7 @@
val positionedLatch = CountDownLatch(2)
val containerSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack {
Container(
@@ -92,7 +92,7 @@
) {
EmptyBox(width = sizeDp, height = sizeDp,
modifier = Modifier.onPositioned { coordinates ->
- childPosition.value = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition.value = coordinates.localToGlobal(Offset(0f, 0f))
positionedLatch.countDown()
}
)
@@ -106,7 +106,7 @@
IntPxSize(size + totalPadding, size + totalPadding),
containerSize.value
)
- assertEquals(PxPosition(padding, padding), childPosition.value)
+ assertEquals(Offset(padding.value.toFloat(), padding.value.toFloat()), childPosition.value)
}
@Test
@@ -175,7 +175,7 @@
val alignSize = Ref<IntPxSize>()
val containerSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Container(
alignment = Alignment.TopStart,
@@ -196,7 +196,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
- childPosition.value = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition.value = coordinates.localToGlobal(Offset(0f, 0f))
positionedLatch.countDown()
})
}
@@ -207,7 +207,7 @@
assertEquals(alignSize.value, containerSize.value)
assertEquals(IntPxSize(size, size), childSize.value)
assertEquals(
- PxPosition(
+ Offset(
(containerSize.value!!.width.value.toFloat() / 2 - size.value.toFloat() / 2)
.roundToInt().toFloat(),
(containerSize.value!!.height.value.toFloat() / 2 - size.value.toFloat() / 2)
@@ -228,7 +228,7 @@
val positionedLatch = CountDownLatch(2)
val containerSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack {
val constraints = DpConstraints(minWidth = sizeDp * 2, minHeight = sizeDp * 2)
@@ -244,7 +244,7 @@
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize.value = coordinates.size
childPosition.value =
- coordinates.localToGlobal(PxPosition(0f, 0f))
+ coordinates.localToGlobal(Offset(0f, 0f))
positionedLatch.countDown()
})
}
@@ -258,7 +258,7 @@
containerSize.value
)
assertEquals(IntPxSize(size, size), childSize.value)
- assertEquals(PxPosition(size, size), childPosition.value)
+ assertEquals(Offset(size.value.toFloat(), size.value.toFloat()), childPosition.value)
}
@Test
@@ -348,9 +348,12 @@
(containerSize.toIntPx() - padding.toIntPx() * 2 - childSize.toIntPx()) / 2
val childPosition = childCoordinates!!.parentCoordinates!!.childToLocal(
childCoordinates!!,
- PxPosition.Origin
+ Offset.Zero
)
- assertEquals(PxPosition(centeringOffset, centeringOffset), childPosition)
+ assertEquals(
+ Offset(centeringOffset.value.toFloat(), centeringOffset.value.toFloat()),
+ childPosition
+ )
assertEquals(IntPxSize(childSize.toIntPx(), childSize.toIntPx()), childCoordinates!!.size)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
index bfff53f..d353ebc 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/FlowTest.kt
@@ -31,7 +31,7 @@
import androidx.ui.layout.Stack
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
@@ -55,7 +55,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -95,7 +95,7 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = size * (i / 5)),
+ Offset(x = (size * (i % 5)).value.toFloat(), y = (size * (i / 5)).value.toFloat()),
childPosition[i].value
)
}
@@ -111,7 +111,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -150,7 +150,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = size * (i / 5)),
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -166,7 +169,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -207,7 +210,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = size * (i / 5)),
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -223,7 +229,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -267,7 +273,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = (flowWidth - size * 5) / 2 + size * (i % 5), y = size * (i / 5)),
+ Offset(
+ x = ((flowWidth - size * 5) / 2 + size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -283,7 +292,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -326,7 +335,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = size * (i / 5)),
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -342,7 +354,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -386,7 +398,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = flowWidth - size * 5 + size * (i % 5), y = size * (i / 5)),
+ Offset(
+ x = (flowWidth - size * 5 + size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -402,7 +417,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -445,10 +460,11 @@
IntPxSize(width = size, height = size),
childSize[i].value
)
+ val x = (flowWidth - size * 5) * (i % 5 + 1) / 6 + size * (i % 5)
assertEquals(
- PxPosition(
- x = (flowWidth - size * 5) * (i % 5 + 1) / 6 + size * (i % 5),
- y = size * (i / 5)
+ Offset(
+ x = x.value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -465,7 +481,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -509,9 +525,9 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = (flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5),
- y = size * (i / 5)
+ Offset(
+ x = ((flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -528,7 +544,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -572,9 +588,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = (flowWidth - size * 5) * (i % 5 + 0.5f) / 5 + size * (i % 5),
- y = size * (i / 5)
+ Offset(
+ x = ((flowWidth - size * 5) * (i % 5 + 0.5f) / 5 + size * (i % 5))
+ .value.toFloat(),
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -591,7 +608,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -636,13 +653,13 @@
childSize[i].value
)
assertEquals(
- PxPosition(
+ Offset(
x = if (i < 10) {
- (flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- (flowWidth - size * 5) / 2 + size * (i % 5)
+ ((flowWidth - size * 5) / 2 + size * (i % 5)).value.toFloat()
},
- y = size * (i / 5)
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -659,7 +676,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -704,13 +721,13 @@
childSize[i].value
)
assertEquals(
- PxPosition(
+ Offset(
x = if (i < 10) {
- (flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- size * (i % 5)
+ (size * (i % 5)).value.toFloat()
},
- y = size * (i / 5)
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -727,7 +744,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -772,13 +789,13 @@
childSize[i].value
)
assertEquals(
- PxPosition(
+ Offset(
x = if (i < 10) {
- (flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowWidth - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- (flowWidth - size * 5) + size * (i % 5)
+ ((flowWidth - size * 5) + size * (i % 5)).value.toFloat()
},
- y = size * (i / 5)
+ y = (size * (i / 5)).value.toFloat()
),
childPosition[i].value
)
@@ -797,7 +814,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -838,7 +855,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = (size + spacing) * (i % 3), y = size * (i / 3)),
+ Offset(
+ x = ((size + spacing) * (i % 3)).value.toFloat(),
+ y = (size * (i / 3)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -854,7 +874,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -899,9 +919,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i % 5),
- y = size * 2 * (i / 5) + if (i % 2 == 0) size / 2 else IntPx.Zero
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * 2 * (i / 5) + if (i % 2 == 0) size / 2 else IntPx.Zero)
+ .value.toFloat()
),
childPosition[i].value
)
@@ -918,7 +939,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -963,7 +984,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = size * 2 * (i / 5)),
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * 2 * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -979,7 +1003,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1024,9 +1048,9 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i % 5),
- y = size * 2 * (i / 5) + if (i % 2 == 0) size else IntPx.Zero
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = (size * 2 * (i / 5) + if (i % 2 == 0) size else IntPx.Zero).value.toFloat()
),
childPosition[i].value
)
@@ -1045,7 +1069,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1086,7 +1110,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i % 5), y = (size + spacing) * (i / 5)),
+ Offset(
+ x = (size * (i % 5)).value.toFloat(),
+ y = ((size + spacing) * (i / 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1102,7 +1129,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1141,7 +1168,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1157,7 +1187,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1196,7 +1226,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1212,7 +1245,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1251,7 +1284,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1267,7 +1303,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1309,7 +1345,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = (flowHeight - size * 5) / 2 + size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = ((flowHeight - size * 5) / 2 + size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1325,7 +1364,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1367,7 +1406,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1383,7 +1425,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1427,7 +1469,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 5), y = flowHeight - size * 5 + size * (i % 5)),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = (flowHeight - size * 5 + size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1443,7 +1488,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1484,10 +1529,11 @@
IntPxSize(width = size, height = size),
childSize[i].value
)
+ val y = (flowHeight - size * 5) * (i % 5 + 1) / 6 + size * (i % 5)
assertEquals(
- PxPosition(
- x = size * (i / 5),
- y = (flowHeight - size * 5) * (i % 5 + 1) / 6 + size * (i % 5)
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = y.value.toFloat()
),
childPosition[i].value
)
@@ -1504,7 +1550,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1546,9 +1592,9 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i / 5),
- y = (flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = ((flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
),
childPosition[i].value
)
@@ -1565,7 +1611,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1607,9 +1653,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i / 5),
- y = (flowHeight - size * 5) * (i % 5 + 0.5f) / 5 + size * (i % 5)
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
+ y = ((flowHeight - size * 5) * (i % 5 + 0.5f) / 5 + size * (i % 5))
+ .value.toFloat()
),
childPosition[i].value
)
@@ -1626,7 +1673,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1669,12 +1716,12 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i / 5),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
y = if (i < 10) {
- (flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- (flowHeight - size * 5) / 2 + size * (i % 5)
+ ((flowHeight - size * 5) / 2 + size * (i % 5)).value.toFloat()
}
),
childPosition[i].value
@@ -1692,7 +1739,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1735,12 +1782,12 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i / 5),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
y = if (i < 10) {
- (flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- size * (i % 5)
+ (size * (i % 5)).value.toFloat()
}
),
childPosition[i].value
@@ -1758,7 +1805,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1801,12 +1848,12 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * (i / 5),
+ Offset(
+ x = (size * (i / 5)).value.toFloat(),
y = if (i < 10) {
- (flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)
+ ((flowHeight - size * 5) * (i % 5) / 4 + size * (i % 5)).value.toFloat()
} else {
- (flowHeight - size * 5) + size * (i % 5)
+ ((flowHeight - size * 5) + size * (i % 5)).value.toFloat()
}
),
childPosition[i].value
@@ -1826,7 +1873,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1865,7 +1912,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * (i / 3), y = (size + spacing) * (i % 3)),
+ Offset(
+ x = (size * (i / 3)).value.toFloat(),
+ y = ((size + spacing) * (i % 3)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -1881,7 +1931,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1925,9 +1975,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(
- x = size * 2 * (i / 5) + if (i % 2 == 0) size / 2 else IntPx.Zero,
- y = size * (i % 5)
+ Offset(
+ x = (size * 2 * (i / 5) + if (i % 2 == 0) size / 2 else IntPx.Zero)
+ .value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
),
childPosition[i].value
)
@@ -1944,7 +1995,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -1985,7 +2036,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = size * 2 * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = (size * 2 * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
@@ -2001,7 +2055,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -2044,10 +2098,11 @@
),
childSize[i].value
)
+ val x = (size * 2 * (i / 5) + if (i % 2 == 0) size else IntPx.Zero)
assertEquals(
- PxPosition(
- x = size * 2 * (i / 5) + if (i % 2 == 0) size else IntPx.Zero,
- y = size * (i % 5)
+ Offset(
+ x = x.value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
),
childPosition[i].value
)
@@ -2066,7 +2121,7 @@
val flowSize = Ref<IntPxSize>()
val childSize = Array(numberOfSquares) { Ref<IntPxSize>() }
- val childPosition = Array(numberOfSquares) { Ref<PxPosition>() }
+ val childPosition = Array(numberOfSquares) { Ref<Offset>() }
val positionedLatch = CountDownLatch(numberOfSquares + 1)
show {
@@ -2105,7 +2160,10 @@
childSize[i].value
)
assertEquals(
- PxPosition(x = (size + spacing) * (i / 5), y = size * (i % 5)),
+ Offset(
+ x = ((size + spacing) * (i / 5)).value.toFloat(),
+ y = (size * (i % 5)).value.toFloat()
+ ),
childPosition[i].value
)
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
index 1016f91..5a21d6c 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/IntrinsicTest.kt
@@ -32,7 +32,7 @@
import androidx.ui.layout.preferredWidth
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -52,7 +52,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicWidthSize.value = coordinates.size
@@ -73,7 +73,7 @@
assertEquals(IntPxSize(10.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(10.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -81,7 +81,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicHeightSize.value = coordinates.size
@@ -102,7 +102,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 40.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 40.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -110,7 +110,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicWidthSize.value = coordinates.size
@@ -131,7 +131,7 @@
assertEquals(IntPxSize(30.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(30.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -139,7 +139,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicHeightSize.value = coordinates.size
@@ -160,7 +160,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 60.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 60.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -168,7 +168,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack {
ConstrainedBox(
@@ -193,7 +193,7 @@
assertEquals(IntPxSize(5.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(5.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -201,7 +201,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack {
ConstrainedBox(
@@ -226,7 +226,7 @@
assertEquals(IntPxSize(15.dp.toIntPx(), 50.dp.toIntPx()), minIntrinsicWidthSize.value)
assertEquals(IntPxSize(15.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -234,7 +234,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicHeightSize.value = coordinates.size
@@ -257,7 +257,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 35.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 35.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -265,7 +265,7 @@
val positionedLatch = CountDownLatch(2)
val minIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
minIntrinsicHeightSize.value = coordinates.size
@@ -288,7 +288,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 45.dp.toIntPx()), minIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 45.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -296,7 +296,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicWidthSize.value = coordinates.size
@@ -319,7 +319,7 @@
assertEquals(IntPxSize(25.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(25.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -327,7 +327,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicWidthSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicWidthSize.value = coordinates.size
@@ -350,7 +350,7 @@
assertEquals(IntPxSize(35.dp.toIntPx(), 50.dp.toIntPx()), maxIntrinsicWidthSize.value)
assertEquals(IntPxSize(35.dp.toIntPx(), 50.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -358,7 +358,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicHeightSize.value = coordinates.size
@@ -381,7 +381,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 55.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 55.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -389,7 +389,7 @@
val positionedLatch = CountDownLatch(2)
val maxIntrinsicHeightSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack(modifier = Modifier.onChildPositioned { coordinates: LayoutCoordinates ->
maxIntrinsicHeightSize.value = coordinates.size
@@ -412,7 +412,7 @@
assertEquals(IntPxSize(20.dp.toIntPx(), 65.dp.toIntPx()), maxIntrinsicHeightSize.value)
assertEquals(IntPxSize(20.dp.toIntPx(), 65.dp.toIntPx()), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
index be85819..262e106 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
@@ -38,7 +38,7 @@
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -59,9 +59,9 @@
val positionedLatch = CountDownLatch(2)
val alignSize = Ref<IntPxSize>()
- val alignPosition = Ref<PxPosition>()
+ val alignPosition = Ref<Offset>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Container(Modifier.saveLayoutInfo(alignSize, alignPosition, positionedLatch)) {
Container(
@@ -79,10 +79,10 @@
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
- assertEquals(PxPosition(0f, 0f), alignPosition.value)
+ assertEquals(Offset(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, size), childSize.value)
assertEquals(
- PxPosition(root.width - size.value.toFloat(), root.height - size.value.toFloat()),
+ Offset(root.width - size.value.toFloat(), root.height - size.value.toFloat()),
childPosition.value
)
}
@@ -94,9 +94,9 @@
val positionedLatch = CountDownLatch(2)
val alignSize = Ref<IntPxSize>()
- val alignPosition = Ref<PxPosition>()
+ val alignPosition = Ref<Offset>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Container(
Modifier.saveLayoutInfo(
@@ -120,9 +120,9 @@
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
- assertEquals(PxPosition(0f, 0f), alignPosition.value)
+ assertEquals(Offset(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, root.height.ipx), childSize.value)
- assertEquals(PxPosition(root.width - size.value.toFloat(), 0f), childPosition.value)
+ assertEquals(Offset(root.width - size.value.toFloat(), 0f), childPosition.value)
}
@Test
@@ -132,7 +132,7 @@
val positionedLatch = CountDownLatch(3)
val childSize = Array(3) { Ref<IntPxSize>() }
- val childPosition = Array(3) { Ref<PxPosition>() }
+ val childPosition = Array(3) { Ref<Offset>() }
show {
Stack(Modifier.rtl) {
Stack(Modifier.fillMaxSize().wrapContentSize(Alignment.TopStart)) {
@@ -164,15 +164,18 @@
waitForDraw(root)
assertEquals(
- PxPosition(root.width.ipx - size, 0.ipx),
+ Offset((root.width.ipx - size).value.toFloat(), 0f),
childPosition[0].value
)
assertEquals(
- PxPosition(root.width.ipx - size, (root.height.ipx - size) / 2),
+ Offset(
+ (root.width.ipx - size).value.toFloat(),
+ ((root.height.ipx - size) / 2).value.toFloat()
+ ),
childPosition[1].value
)
assertEquals(
- PxPosition(0.ipx, root.height.ipx - size),
+ Offset(0f, (root.height.ipx - size).value.toFloat()),
childPosition[2].value
)
}
@@ -204,9 +207,9 @@
val positionedLatch = CountDownLatch(2)
val alignSize = Ref<IntPxSize>()
- val alignPosition = Ref<PxPosition>()
+ val alignPosition = Ref<Offset>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Layout(
children = {
@@ -235,9 +238,9 @@
waitForDraw(root)
assertEquals(IntPxSize(size, size), alignSize.value)
- assertEquals(PxPosition(0f, 0f), alignPosition.value)
+ assertEquals(Offset(0f, 0f), alignPosition.value)
assertEquals(IntPxSize(size, size), childSize.value)
- assertEquals(PxPosition(0f, 0f), childPosition.value)
+ assertEquals(Offset(0f, 0f), childPosition.value)
}
@Test
@@ -250,7 +253,7 @@
val positionedLatch = CountDownLatch(2)
val wrapSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Container(Modifier.wrapContentSize(Alignment.TopStart)) {
Layout(
@@ -274,7 +277,7 @@
).enforce(incomingConstraints)
val placeable = measurable.measure(constraints)
layout(placeable.width, placeable.height) {
- placeable.place(PxPosition.Origin)
+ placeable.place(Offset.Zero)
}
}
)
@@ -285,7 +288,10 @@
assertEquals(IntPxSize(doubleSize, doubleSize), wrapSize.value)
assertEquals(IntPxSize(size, size), childSize.value)
assertEquals(
- PxPosition((doubleSize - size) / 2, (doubleSize - size) / 2),
+ Offset(
+ ((doubleSize - size) / 2).value.toFloat(),
+ ((doubleSize - size) / 2).value.toFloat()
+ ),
childPosition.value
)
}
@@ -391,9 +397,9 @@
val positionedLatch = CountDownLatch(2)
val alignSize = Ref<IntPxSize>()
- val alignPosition = Ref<PxPosition>()
+ val alignPosition = Ref<Offset>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Layout(
children = {
@@ -424,9 +430,9 @@
assertEquals(IntPxSize(childSizeIpx, childSizeIpx), childSize.value)
assertEquals(
- PxPosition(
- alignSize.value!!.width - childSizeIpx,
- alignSize.value!!.height - childSizeIpx
+ Offset(
+ (alignSize.value!!.width - childSizeIpx).value.toFloat(),
+ (alignSize.value!!.height - childSizeIpx).value.toFloat()
),
childPosition.value
)
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
index 04a71bf..9c6e443b 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAspectRatioTest.kt
@@ -25,7 +25,7 @@
import androidx.ui.layout.aspectRatio
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -91,7 +91,7 @@
private fun getSize(aspectRatio: Float, childContraints: Constraints): IntPxSize {
val positionedLatch = CountDownLatch(1)
val size = Ref<IntPxSize>()
- val position = Ref<PxPosition>()
+ val position = Ref<Offset>()
show {
Layout(@Composable {
Container(
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
index 77c1683..9cfbee9 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
@@ -41,7 +41,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
@@ -250,7 +250,7 @@
val drawLatch = CountDownLatch(3)
val childSize = Array(3) { IntPxSize(0.ipx, 0.ipx) }
- val childPosition = Array(3) { PxPosition(0f, 0f) }
+ val childPosition = Array(3) { Offset(0f, 0f) }
// ltr: P1 S P2 | S P3 | P1 S
// rtl: S P1 | P3 S | P2 S P1
@@ -261,7 +261,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -272,7 +272,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -283,7 +283,7 @@
.preferredSize(sizeDp, sizeDp)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[2] = coordinates.size
- childPosition[2] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[2] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -296,17 +296,20 @@
val rootWidth = root.width.ipx
// S P1 | P3 S | P2 S P1
- assertEquals(PxPosition(rootWidth - padding1 - size, 0.ipx), childPosition[0])
+ assertEquals(Offset((rootWidth - padding1 - size).value.toFloat(), 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[0])
assertEquals(
- PxPosition(rootWidth - padding1 - padding2 - size * 2, 0.ipx),
+ Offset((rootWidth - padding1 - padding2 - size * 2).value.toFloat(), 0f),
childPosition[1]
)
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(rootWidth - size * 3 - padding1 * 2 - padding2 - padding3, 0.ipx),
+ Offset(
+ (rootWidth - size * 3 - padding1 * 2 - padding2 - padding3).value.toFloat(),
+ 0f
+ ),
childPosition[2]
)
assertEquals(IntPxSize(size, size), childSize[2])
@@ -318,7 +321,7 @@
val size = 300.ipx
val paddingDp = padding.toDp()
val latch = CountDownLatch(1)
- val resultPosition = Ref<PxPosition>()
+ val resultPosition = Ref<Offset>()
val resultSize = Ref<IntPxSize>()
show {
@@ -349,7 +352,7 @@
resultSize.value?.toPxSize()
)
assertEquals(
- PxPosition(rootWidth - size + padding, 0.ipx),
+ Offset((rootWidth - size + padding).value.toFloat(), 0f),
resultPosition.value
)
}
@@ -364,7 +367,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1f, -1f)
+ var childPosition = Offset(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -374,7 +377,7 @@
val children = @Composable {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -393,7 +396,7 @@
val left = ((root.width.ipx - size) / 2) + paddingPx
val top = ((root.height.ipx - size) / 2) + paddingPx
assertEquals(
- PxPosition(left.value.toFloat(), top.value.toFloat()),
+ Offset(left.value.toFloat(), top.value.toFloat()),
childPosition
)
}
@@ -410,7 +413,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1f, -1f)
+ var childPosition = Offset(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -420,7 +423,7 @@
val children = @Composable {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -448,7 +451,7 @@
val viewLeft = ((root.width.ipx - size) / 2) + paddingLeft
val viewTop = ((root.height.ipx - size) / 2) + paddingTop
assertEquals(
- PxPosition(viewLeft.value.toFloat(), viewTop.value.toFloat()),
+ Offset(viewLeft.value.toFloat(), viewTop.value.toFloat()),
childPosition
)
}
@@ -463,7 +466,7 @@
val drawLatch = CountDownLatch(1)
var childSize = IntPxSize(-1.ipx, -1.ipx)
- var childPosition = PxPosition(-1f, -1f)
+ var childPosition = Offset(-1f, -1f)
show {
Stack(Modifier.fillMaxSize()) {
ConstrainedBox(
@@ -473,7 +476,7 @@
paddingContainer {
Container(Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize = coordinates.size
- childPosition = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}) {
}
@@ -489,7 +492,7 @@
assertEquals(IntPxSize(0.ipx, 0.ipx), childSize)
val left = ((root.width.ipx - size) / 2) + paddingPx
val top = ((root.height.ipx - size) / 2) + paddingPx
- assertEquals(PxPosition(left.value.toFloat(), top.value.toFloat()), childPosition)
+ assertEquals(Offset(left.value.toFloat(), top.value.toFloat()), childPosition)
}
/**
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
index 577a6f6..4206678 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutSizeTest.kt
@@ -52,7 +52,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
@@ -75,7 +75,7 @@
val positionedLatch = CountDownLatch(6)
val size = MutableList(6) { Ref<IntPxSize>() }
- val position = MutableList(6) { Ref<PxPosition>() }
+ val position = MutableList(6) { Ref<Offset>() }
show {
Stack {
Column {
@@ -122,22 +122,22 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[0].value)
- assertEquals(PxPosition.Origin, position[0].value)
+ assertEquals(Offset.Zero, position[0].value)
assertEquals(IntPxSize(0.ipx, sizeIpx), size[1].value)
- assertEquals(PxPosition(0.ipx, sizeIpx), position[1].value)
+ assertEquals(Offset(0f, sizeIpx.value.toFloat()), position[1].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[2].value)
- assertEquals(PxPosition(0.ipx, sizeIpx * 2), position[2].value)
+ assertEquals(Offset(0f, (sizeIpx * 2).value.toFloat()), position[2].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[3].value)
- assertEquals(PxPosition(0.ipx, sizeIpx * 3), position[3].value)
+ assertEquals(Offset(0f, (sizeIpx * 3).value.toFloat()), position[3].value)
assertEquals(IntPxSize((sizeDp * 2).toIntPx(), sizeIpx), size[4].value)
- assertEquals(PxPosition(0.ipx, sizeIpx * 4), position[4].value)
+ assertEquals(Offset(0f, (sizeIpx * 4).value.toFloat()), position[4].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[5].value)
- assertEquals(PxPosition(0.ipx, sizeIpx * 5), position[5].value)
+ assertEquals(Offset(0f, (sizeIpx * 5).value.toFloat()), position[5].value)
}
@Test
@@ -147,7 +147,7 @@
val positionedLatch = CountDownLatch(6)
val size = MutableList(6) { Ref<IntPxSize>() }
- val position = MutableList(6) { Ref<PxPosition>() }
+ val position = MutableList(6) { Ref<Offset>() }
show {
Stack {
Row {
@@ -194,22 +194,22 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[0].value)
- assertEquals(PxPosition.Origin, position[0].value)
+ assertEquals(Offset.Zero, position[0].value)
assertEquals(IntPxSize(sizeIpx, 0.ipx), size[1].value)
- assertEquals(PxPosition(sizeIpx, 0.ipx), position[1].value)
+ assertEquals(Offset(sizeIpx.value.toFloat(), 0f), position[1].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[2].value)
- assertEquals(PxPosition(sizeIpx * 2, 0.ipx), position[2].value)
+ assertEquals(Offset((sizeIpx * 2).value.toFloat(), 0f), position[2].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[3].value)
- assertEquals(PxPosition(sizeIpx * 3, 0.ipx), position[3].value)
+ assertEquals(Offset((sizeIpx * 3).value.toFloat(), 0f), position[3].value)
assertEquals(IntPxSize(sizeIpx, (sizeDp * 2).toIntPx()), size[4].value)
- assertEquals(PxPosition(sizeIpx * 4, 0.ipx), position[4].value)
+ assertEquals(Offset((sizeIpx * 4).value.toFloat(), 0f), position[4].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[5].value)
- assertEquals(PxPosition(sizeIpx * 5, 0.ipx), position[5].value)
+ assertEquals(Offset((sizeIpx * 5).value.toFloat(), 0f), position[5].value)
}
@Test
@@ -219,7 +219,7 @@
val positionedLatch = CountDownLatch(5)
val size = MutableList(5) { Ref<IntPxSize>() }
- val position = MutableList(5) { Ref<PxPosition>() }
+ val position = MutableList(5) { Ref<Offset>() }
show {
Stack {
Row {
@@ -261,19 +261,19 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[0].value)
- assertEquals(PxPosition.Origin, position[0].value)
+ assertEquals(Offset.Zero, position[0].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[1].value)
- assertEquals(PxPosition(sizeIpx, 0.ipx), position[1].value)
+ assertEquals(Offset(sizeIpx.value.toFloat(), 0f), position[1].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[2].value)
- assertEquals(PxPosition(sizeIpx * 2, 0.ipx), position[2].value)
+ assertEquals(Offset((sizeIpx * 2).value.toFloat(), 0f), position[2].value)
assertEquals(IntPxSize((sizeDp * 2).toIntPx(), (sizeDp * 2).toIntPx()), size[3].value)
- assertEquals(PxPosition(sizeIpx * 3, 0.ipx), position[3].value)
+ assertEquals(Offset((sizeIpx * 3).value.toFloat(), 0f), position[3].value)
assertEquals(IntPxSize(sizeIpx, sizeIpx), size[4].value)
- assertEquals(PxPosition((sizeDp * 5).toIntPx(), 0.ipx), position[4].value)
+ assertEquals(Offset((sizeDp * 5).toIntPx().value.toFloat(), 0f), position[4].value)
}
@Test
@@ -284,7 +284,7 @@
val positionedLatch = CountDownLatch(2)
val constrainedBoxSize = Ref<IntPxSize>()
val childSize = Ref<IntPxSize>()
- val childPosition = Ref<PxPosition>()
+ val childPosition = Ref<Offset>()
show {
Stack {
Container(width = sizeDp, height = sizeDp) {
@@ -312,7 +312,7 @@
assertEquals(IntPxSize(size, size), constrainedBoxSize.value)
assertEquals(IntPxSize(size, size), childSize.value)
- assertEquals(PxPosition.Origin, childPosition.value)
+ assertEquals(Offset.Zero, childPosition.value)
}
@Test
@@ -322,7 +322,7 @@
val positionedLatch = CountDownLatch(4)
val size = MutableList(4) { Ref<IntPxSize>() }
- val position = MutableList(4) { Ref<PxPosition>() }
+ val position = MutableList(4) { Ref<Offset>() }
show {
Stack {
Row {
@@ -386,7 +386,7 @@
val positionedLatch = CountDownLatch(1)
val boxSize = Ref<IntPxSize>()
- val boxPosition = Ref<PxPosition>()
+ val boxPosition = Ref<Offset>()
show {
Box(Modifier.wrapContentSize(Alignment.TopStart)
.size(sizeDp * 2)
@@ -397,7 +397,12 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(sizeIpx, sizeIpx), boxSize.value)
- assertEquals(PxPosition(sizeIpx / 2, sizeIpx / 2), boxPosition.value)
+ assertEquals(
+ Offset(
+ (sizeIpx / 2).value.toFloat(),
+ (sizeIpx / 2).value.toFloat()),
+ boxPosition.value
+ )
}
@Test
@@ -407,7 +412,7 @@
val positionedLatch = CountDownLatch(1)
val boxSize = Ref<IntPxSize>()
- val boxPosition = Ref<PxPosition>()
+ val boxPosition = Ref<Offset>()
show {
Box(Modifier.wrapContentSize(Alignment.TopStart)
.size(sizeDp)
@@ -418,7 +423,10 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(sizeIpx * 2, sizeIpx * 2), boxSize.value)
- assertEquals(PxPosition(-sizeIpx / 2, -sizeIpx / 2), boxPosition.value)
+ assertEquals(
+ Offset((-sizeIpx / 2).value.toFloat(), (-sizeIpx / 2).value.toFloat()),
+ boxPosition.value
+ )
}
@Test
@@ -1014,7 +1022,7 @@
val positionedLatch = CountDownLatch(1)
val size = Ref<IntPxSize>()
- val position = Ref<PxPosition>()
+ val position = Ref<Offset>()
show {
Layout(@Composable {
Stack {
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
index b869216..951123c 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
@@ -47,7 +47,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
@@ -139,11 +139,11 @@
internal fun Modifier.saveLayoutInfo(
size: Ref<IntPxSize>,
- position: Ref<PxPosition>,
+ position: Ref<Offset>,
positionedLatch: CountDownLatch
): Modifier = this.onPositioned { coordinates ->
size.value = IntPxSize(coordinates.size.width, coordinates.size.height)
- position.value = coordinates.localToGlobal(PxPosition(0f, 0f))
+ position.value = coordinates.localToGlobal(Offset(0f, 0f))
positionedLatch.countDown()
}
@@ -265,11 +265,11 @@
}
}
- internal fun assertEquals(expected: PxPosition?, actual: PxPosition?) {
+ internal fun assertEquals(expected: Offset?, actual: Offset?) {
assertNotNull("Null expected position", expected)
- expected as PxPosition
+ expected as Offset
assertNotNull("Null actual position", actual)
- actual as PxPosition
+ actual as Offset
assertEquals(
"Expected x ${expected.x} but obtained ${actual.x}",
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
index 8a4efab..50b867d 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/OnPositionedTest.kt
@@ -37,7 +37,7 @@
import androidx.ui.layout.fillMaxSize
import androidx.ui.layout.padding
import androidx.ui.unit.Dp
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.min
@@ -144,10 +144,10 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
// global position
- val gPos = childCoordinates!!.localToGlobal(PxPosition.Origin).x
+ val gPos = childCoordinates!!.localToGlobal(Offset.Zero).x
assertThat(gPos).isEqualTo((firstPaddingPx + secondPaddingPx + thirdPaddingPx))
// Position in grandparent Px(value=50.0)
- val gpPos = gpCoordinates!!.childToLocal(childCoordinates!!, PxPosition.Origin).x
+ val gpPos = gpCoordinates!!.childToLocal(childCoordinates!!, Offset.Zero).x
assertThat(gpPos).isEqualTo((secondPaddingPx + thirdPaddingPx))
// local position
assertThat(childCoordinates!!.positionInParent.x).isEqualTo(thirdPaddingPx)
@@ -183,10 +183,10 @@
@Test
fun globalCoordinatesAreInActivityCoordinates() = with(density) {
val padding = 30
- val localPosition = PxPosition.Origin
- val globalPosition = PxPosition(padding.ipx, padding.ipx)
- var realGlobalPosition: PxPosition? = null
- var realLocalPosition: PxPosition? = null
+ val localPosition = Offset.Zero
+ val globalPosition = Offset(padding.toFloat(), padding.toFloat())
+ var realGlobalPosition: Offset? = null
+ var realLocalPosition: Offset? = null
val positionedLatch = CountDownLatch(1)
activityTestRule.runOnUiThread(object : Runnable {
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
index 74d92bc..3bd019a 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
@@ -50,7 +50,7 @@
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.isFinite
@@ -78,7 +78,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
+ val childPosition = arrayOf(Offset(-1f, -1f), Offset(-1f, -1f))
show {
Container(alignment = Alignment.TopStart) {
Row {
@@ -87,7 +87,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -98,7 +98,7 @@
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -116,8 +116,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, (sizeDp.toPx() * 2).roundToInt().ipx),
childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(size.value.toFloat(), 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(size.value.toFloat(), 0f), childPosition[1])
}
@Test
@@ -128,7 +128,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Container(alignment = Alignment.TopStart) {
Row {
@@ -136,7 +136,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -148,7 +148,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -172,8 +172,8 @@
IntPxSize((rootWidth * 2f / 3f).roundToInt().ipx, childrenHeight),
childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition((rootWidth / 3f).roundToInt().toFloat(), 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset((rootWidth / 3f).roundToInt().toFloat(), 0f), childPosition[1])
}
@Test
@@ -185,7 +185,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Container(alignment = Alignment.TopStart) {
Row {
@@ -193,7 +193,7 @@
Modifier.weight(1f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -205,7 +205,7 @@
Modifier.weight(2f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -222,8 +222,8 @@
assertEquals(IntPxSize(childrenWidth, childrenHeight), childSize[0])
assertEquals(IntPxSize(childrenWidth, childrenHeight * 2), childSize[1])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(childrenWidth.value.toFloat(), 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(childrenWidth.value.toFloat(), 0f), childPosition[1])
}
@Test
@@ -233,7 +233,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
+ val childPosition = arrayOf(Offset(-1f, -1f), Offset(-1f, -1f))
show {
Container(alignment = Alignment.TopStart) {
Column {
@@ -242,7 +242,7 @@
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -252,7 +252,7 @@
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -270,8 +270,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, (sizeDp.toPx() * 2).roundToInt().ipx),
childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(0f, size.value.toFloat()), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, size.value.toFloat()), childPosition[1])
}
@Test
@@ -282,7 +282,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Container(alignment = Alignment.TopStart) {
Column {
@@ -290,7 +290,7 @@
Modifier.weight(1f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -302,7 +302,7 @@
Modifier.weight(2f)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -324,8 +324,8 @@
assertEquals(
IntPxSize(childrenWidth, (rootHeight * 2f / 3f).roundToInt().ipx), childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(0f, (rootHeight / 3f).roundToInt().toFloat()), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, (rootHeight / 3f).roundToInt().toFloat()), childPosition[1])
}
@Test
@@ -337,7 +337,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Container(alignment = Alignment.TopStart) {
Column {
@@ -345,7 +345,7 @@
Modifier.weight(1f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -356,7 +356,7 @@
Modifier.weight(2f, fill = false)
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
},
width = width,
@@ -375,8 +375,8 @@
assertEquals(
IntPxSize(childrenWidth, childrenHeight), childSize[1]
)
- assertEquals(PxPosition(0.0f, 0.0f), childPosition[0])
- assertEquals(PxPosition(0.0f, childrenHeight.value.toFloat()), childPosition[1])
+ assertEquals(Offset(0.0f, 0.0f), childPosition[0])
+ assertEquals(Offset(0.0f, childrenHeight.value.toFloat()), childPosition[1])
}
@Test
@@ -593,7 +593,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
+ val childPosition = arrayOf(Offset(-1f, -1f), Offset(-1f, -1f))
show {
Row {
Container(
@@ -602,7 +602,7 @@
modifier = Modifier.fillMaxHeight()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -614,7 +614,7 @@
modifier = Modifier.fillMaxHeight()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -631,8 +631,8 @@
IntPxSize((sizeDp.toPx() * 2).roundToInt().ipx, root.height.ipx),
childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(size.value.toFloat(), 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(size.value.toFloat(), 0f), childPosition[1])
}
@Test
@@ -642,7 +642,7 @@
val drawLatch = CountDownLatch(3)
val childSize = arrayOfNulls<IntPxSize>(3)
- val childPosition = arrayOfNulls<PxPosition>(3)
+ val childPosition = arrayOfNulls<Offset>(3)
show {
Row(Modifier.fillMaxHeight(), verticalGravity = Alignment.CenterVertically) {
Container(
@@ -686,11 +686,11 @@
val rootHeight = root.height
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(
+ Offset(
size.value.toFloat(),
((rootHeight - size.value.toFloat()) / 2f).roundToInt().toFloat()
),
@@ -698,7 +698,7 @@
)
assertEquals(IntPxSize(size, size), childSize[2])
- assertEquals(PxPosition((size.value.toFloat() * 2),
+ assertEquals(Offset((size.value.toFloat() * 2),
(rootHeight - size.value.toFloat())),
childPosition[2])
}
@@ -710,7 +710,7 @@
val drawLatch = CountDownLatch(3)
val childSize = arrayOfNulls<IntPxSize>(3)
- val childPosition = arrayOfNulls<PxPosition>(3)
+ val childPosition = arrayOfNulls<Offset>(3)
show {
Row(Modifier.fillMaxHeight()) {
Container(
@@ -755,11 +755,11 @@
val rootHeight = root.height
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(
+ Offset(
size.value.toFloat(),
((rootHeight - size.value.toFloat()) / 2f).roundToInt().toFloat()
),
@@ -768,7 +768,7 @@
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition((size.value.toFloat() * 2), (rootHeight - size.value.toFloat())),
+ Offset((size.value.toFloat() * 2), (rootHeight - size.value.toFloat())),
childPosition[2])
}
@@ -783,7 +783,7 @@
val drawLatch = CountDownLatch(4)
val childSize = arrayOfNulls<IntPxSize>(4)
- val childPosition = arrayOfNulls<PxPosition>(4)
+ val childPosition = arrayOfNulls<Offset>(4)
show {
Row(Modifier.fillMaxHeight()) {
BaselineTestLayout(
@@ -837,11 +837,11 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(
+ Offset(
size.value.toFloat(),
(baseline1.value.toFloat() - (size.value.toFloat() / 2).roundToInt())
),
@@ -850,13 +850,13 @@
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition((size.value.toFloat() * 2), (baseline1 - baseline2).value.toFloat()),
+ Offset((size.value.toFloat() * 2), (baseline1 - baseline2).value.toFloat()),
childPosition[2]
)
assertEquals(IntPxSize(size, size), childSize[3])
assertEquals(
- PxPosition((size.value.toFloat() * 3), 0f),
+ Offset((size.value.toFloat() * 3), 0f),
childPosition[3]
)
}
@@ -870,7 +870,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Row(Modifier.fillMaxHeight()) {
BaselineTestLayout(
@@ -901,11 +901,11 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(size, childSize[1]!!.height)
assertEquals(
- PxPosition(size.value.toFloat(), (baseline - size / 2).value.toFloat()),
+ Offset(size.value.toFloat(), (baseline - size / 2).value.toFloat()),
childPosition[1]
)
}
@@ -919,7 +919,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOf(IntPxSize(-1.ipx, -1.ipx), IntPxSize(-1.ipx, -1.ipx))
- val childPosition = arrayOf(PxPosition(-1f, -1f), PxPosition(-1f, -1f))
+ val childPosition = arrayOf(Offset(-1f, -1f), Offset(-1f, -1f))
show {
Column {
Container(
@@ -928,7 +928,7 @@
modifier = Modifier.fillMaxWidth()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[0] = coordinates.size
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -940,7 +940,7 @@
modifier = Modifier.fillMaxWidth()
.onPositioned { coordinates: LayoutCoordinates ->
childSize[1] = coordinates.size
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -957,8 +957,8 @@
IntPxSize(root.width.ipx, (sizeDp * 2).toIntPx()),
childSize[1]
)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(0f, size.value.toFloat()), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, size.value.toFloat()), childPosition[1])
}
@Test
@@ -968,7 +968,7 @@
val drawLatch = CountDownLatch(3)
val childSize = arrayOfNulls<IntPxSize>(3)
- val childPosition = arrayOfNulls<PxPosition>(3)
+ val childPosition = arrayOfNulls<Offset>(3)
show {
Column(Modifier.fillMaxWidth()) {
Container(
@@ -1013,11 +1013,11 @@
val rootWidth = root.width
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(
+ Offset(
((rootWidth - size.value.toFloat()) / 2).roundToInt().toFloat(),
size.value.toFloat()
),
@@ -1026,7 +1026,7 @@
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition((rootWidth - size.value.toFloat()), size.value.toFloat() * 2),
+ Offset((rootWidth - size.value.toFloat()), size.value.toFloat() * 2),
childPosition[2]
)
}
@@ -1038,7 +1038,7 @@
val drawLatch = CountDownLatch(3)
val childSize = arrayOfNulls<IntPxSize>(3)
- val childPosition = arrayOfNulls<PxPosition>(3)
+ val childPosition = arrayOfNulls<Offset>(3)
show {
Column(Modifier.fillMaxWidth(), horizontalGravity = Alignment.CenterHorizontally) {
Container(
@@ -1082,11 +1082,11 @@
val rootWidth = root.width
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
assertEquals(
- PxPosition(
+ Offset(
((rootWidth - size.value.toFloat()) / 2).roundToInt().toFloat(),
size.value.toFloat()
),
@@ -1095,7 +1095,7 @@
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition((rootWidth - size.value.toFloat()), size.value.toFloat() * 2),
+ Offset((rootWidth - size.value.toFloat()), size.value.toFloat() * 2),
childPosition[2]
)
}
@@ -1109,7 +1109,7 @@
val drawLatch = CountDownLatch(4)
val childSize = arrayOfNulls<IntPxSize>(4)
- val childPosition = arrayOfNulls<PxPosition>(4)
+ val childPosition = arrayOfNulls<Offset>(4)
show {
Column(Modifier.fillMaxWidth()) {
Container(
@@ -1163,14 +1163,14 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(IntPxSize(size, size), childSize[1])
- assertEquals(PxPosition(size.value.toFloat(), size.value.toFloat()), childPosition[1])
+ assertEquals(Offset(size.value.toFloat(), size.value.toFloat()), childPosition[1])
assertEquals(IntPxSize(size, size), childSize[2])
assertEquals(
- PxPosition(
+ Offset(
(size - firstBaseline1Dp.toIntPx()).value.toFloat(),
size.value.toFloat() * 2
),
@@ -1179,7 +1179,7 @@
assertEquals(IntPxSize(size, size), childSize[3])
assertEquals(
- PxPosition(
+ Offset(
(size - firstBaseline2Dp.toIntPx()).value.toFloat(),
size.value.toFloat() * 3
),
@@ -1196,7 +1196,7 @@
val drawLatch = CountDownLatch(2)
val childSize = arrayOfNulls<IntPxSize>(2)
- val childPosition = arrayOfNulls<PxPosition>(2)
+ val childPosition = arrayOfNulls<Offset>(2)
show {
Column(Modifier.fillMaxWidth()) {
BaselineTestLayout(
@@ -1227,11 +1227,11 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(size, size), childSize[0])
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(size, childSize[1]!!.width)
assertEquals(
- PxPosition((baseline - (size / 2)).value.toFloat(), size.value.toFloat()),
+ Offset((baseline - (size / 2)).value.toFloat(), size.value.toFloat()),
childPosition[1]
)
}
@@ -2142,7 +2142,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2175,9 +2175,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(size.value.toFloat(), 0f), childPosition[1])
- assertEquals(PxPosition(size.value.toFloat() * 2, 0f), childPosition[2])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(size.value.toFloat(), 0f), childPosition[1])
+ assertEquals(Offset(size.value.toFloat() * 2, 0f), childPosition[2])
}
@Test
@@ -2187,7 +2187,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2218,9 +2218,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition((root.width - size.value.toFloat() * 3), 0f), childPosition[0])
- assertEquals(PxPosition((root.width - size.value.toFloat() * 2), 0f), childPosition[1])
- assertEquals(PxPosition((root.width - size.value.toFloat()), 0f), childPosition[2])
+ assertEquals(Offset((root.width - size.value.toFloat() * 3), 0f), childPosition[0])
+ assertEquals(Offset((root.width - size.value.toFloat() * 2), 0f), childPosition[1])
+ assertEquals(Offset((root.width - size.value.toFloat()), 0f), childPosition[2])
}
@Test
@@ -2230,7 +2230,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2262,13 +2262,13 @@
waitForDraw(root)
val extraSpace = root.width - size.value * 3
- assertEquals(PxPosition((extraSpace / 2f).roundToInt().toFloat(), 0f), childPosition[0])
+ assertEquals(Offset((extraSpace / 2f).roundToInt().toFloat(), 0f), childPosition[0])
assertEquals(
- PxPosition(((extraSpace / 2f) + size.value.toFloat()).roundToInt().toFloat(), 0f),
+ Offset(((extraSpace / 2f) + size.value.toFloat()).roundToInt().toFloat(), 0f),
childPosition[1]
)
assertEquals(
- PxPosition(
+ Offset(
((extraSpace / 2f) + size.value.toFloat() * 2).roundToInt().toFloat(),
0f
),
@@ -2283,7 +2283,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2316,14 +2316,14 @@
val gap = (root.width - size.value.toFloat() * 3f) / 4f
assertEquals(
- PxPosition(gap.roundToInt().toFloat(), 0f), childPosition[0]
+ Offset(gap.roundToInt().toFloat(), 0f), childPosition[0]
)
assertEquals(
- PxPosition((size.value.toFloat() + gap * 2f).roundToInt().toFloat(), 0f),
+ Offset((size.value.toFloat() + gap * 2f).roundToInt().toFloat(), 0f),
childPosition[1]
)
assertEquals(
- PxPosition((size.value.toFloat() * 2f + gap * 3f).roundToInt().toFloat(), 0f),
+ Offset((size.value.toFloat() * 2f + gap * 3f).roundToInt().toFloat(), 0f),
childPosition[2]
)
}
@@ -2335,7 +2335,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2367,13 +2367,13 @@
waitForDraw(root)
val gap = (root.width - size.value.toFloat() * 3) / 2
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(
- PxPosition((gap + size.value.toFloat()).roundToInt().toFloat(), 0f),
+ Offset((gap + size.value.toFloat()).roundToInt().toFloat(), 0f),
childPosition[1]
)
assertEquals(
- PxPosition((gap * 2 + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
+ Offset((gap * 2 + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
childPosition[2]
)
}
@@ -2385,7 +2385,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2420,13 +2420,13 @@
waitForDraw(root)
val gap = (root.width.toFloat() - size.value * 3) / 3
- assertEquals(PxPosition((gap / 2f).roundToInt().toFloat(), 0f), childPosition[0])
+ assertEquals(Offset((gap / 2f).roundToInt().toFloat(), 0f), childPosition[0])
assertEquals(
- PxPosition(((gap * 3 / 2) + size.value.toFloat()).roundToInt().toFloat(), 0f),
+ Offset(((gap * 3 / 2) + size.value.toFloat()).roundToInt().toFloat(), 0f),
childPosition[1]
)
assertEquals(
- PxPosition(((gap * 5 / 2) + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
+ Offset(((gap * 5 / 2) + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
childPosition[2]
)
}
@@ -2438,7 +2438,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition.Origin, PxPosition.Origin, PxPosition.Origin
+ Offset.Zero, Offset.Zero, Offset.Zero
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2470,13 +2470,13 @@
waitForDraw(root)
val step = (root.width - size.value.toFloat() * 3) / 3
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(
- PxPosition((step + size.value.toFloat()).roundToInt().toFloat(), 0f),
+ Offset((step + size.value.toFloat()).roundToInt().toFloat(), 0f),
childPosition[1]
)
assertEquals(
- PxPosition((step * 3 + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
+ Offset((step * 3 + size.value.toFloat() * 2).roundToInt().toFloat(), 0f),
childPosition[2]
)
}
@@ -2490,7 +2490,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2521,9 +2521,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(0f, size.value.toFloat()), childPosition[1])
- assertEquals(PxPosition(0f, size.value.toFloat() * 2), childPosition[2])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, size.value.toFloat()), childPosition[1])
+ assertEquals(Offset(0f, size.value.toFloat() * 2), childPosition[2])
}
@Test
@@ -2533,7 +2533,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2564,9 +2564,9 @@
val root = findOwnerView()
waitForDraw(root)
- assertEquals(PxPosition(0f, (root.height - size.value.toFloat() * 3)), childPosition[0])
- assertEquals(PxPosition(0f, (root.height - size.value.toFloat() * 2)), childPosition[1])
- assertEquals(PxPosition(0f, (root.height - size.value.toFloat())), childPosition[2])
+ assertEquals(Offset(0f, (root.height - size.value.toFloat() * 3)), childPosition[0])
+ assertEquals(Offset(0f, (root.height - size.value.toFloat() * 2)), childPosition[1])
+ assertEquals(Offset(0f, (root.height - size.value.toFloat())), childPosition[2])
}
@Test
@@ -2576,7 +2576,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2609,15 +2609,15 @@
val extraSpace = root.height - size.value * 3f
assertEquals(
- PxPosition(0f, (extraSpace / 2).roundToInt().toFloat()),
+ Offset(0f, (extraSpace / 2).roundToInt().toFloat()),
childPosition[0]
)
assertEquals(
- PxPosition(0f, ((extraSpace / 2) + size.value.toFloat()).roundToInt().toFloat()),
+ Offset(0f, ((extraSpace / 2) + size.value.toFloat()).roundToInt().toFloat()),
childPosition[1]
)
assertEquals(
- PxPosition(
+ Offset(
0f,
((extraSpace / 2) + size.value.toFloat() * 2f).roundToInt().toFloat()
),
@@ -2632,7 +2632,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2664,25 +2664,25 @@
waitForDraw(root)
val gap = (root.height - size.value.toFloat() * 3) / 4
- assertEquals(PxPosition(0f, gap.roundToInt().toFloat()), childPosition[0])
+ assertEquals(Offset(0f, gap.roundToInt().toFloat()), childPosition[0])
assertEquals(
- PxPosition(0f, (size.value.toFloat() + gap * 2).roundToInt().toFloat()),
+ Offset(0f, (size.value.toFloat() + gap * 2).roundToInt().toFloat()),
childPosition[1]
)
assertEquals(
- PxPosition(0f, (size.value.toFloat() * 2 + gap * 3f).roundToInt().toFloat()),
+ Offset(0f, (size.value.toFloat() * 2 + gap * 3f).roundToInt().toFloat()),
childPosition[2]
)
}
private fun calculateChildPositions(
- childPosition: Array<PxPosition>,
+ childPosition: Array<Offset>,
parentLayoutCoordinates: LayoutCoordinates?,
childLayoutCoordinates: Array<LayoutCoordinates?>
) {
for (i in childPosition.indices) {
childPosition[i] = parentLayoutCoordinates!!
- .childToLocal(childLayoutCoordinates[i]!!, PxPosition(0f, 0f))
+ .childToLocal(childLayoutCoordinates[i]!!, Offset(0f, 0f))
}
}
@@ -2693,7 +2693,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2725,13 +2725,13 @@
waitForDraw(root)
val gap = (root.height - size.value.toFloat() * 3f) / 2f
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(
- PxPosition(0f, (gap + size.value.toFloat()).roundToInt().toFloat()),
+ Offset(0f, (gap + size.value.toFloat()).roundToInt().toFloat()),
childPosition[1]
)
assertEquals(
- PxPosition(0f, (gap * 2 + size.value.toFloat() * 2).roundToInt().toFloat()),
+ Offset(0f, (gap * 2 + size.value.toFloat() * 2).roundToInt().toFloat()),
childPosition[2]
)
}
@@ -2743,7 +2743,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition(-1f, -1f), PxPosition(-1f, -1f), PxPosition(-1f, -1f)
+ Offset(-1f, -1f), Offset(-1f, -1f), Offset(-1f, -1f)
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2775,13 +2775,13 @@
waitForDraw(root)
val gap = (root.height - size.value.toFloat() * 3f) / 3f
- assertEquals(PxPosition(0f, (gap / 2f).roundToInt().toFloat()), childPosition[0])
+ assertEquals(Offset(0f, (gap / 2f).roundToInt().toFloat()), childPosition[0])
assertEquals(
- PxPosition(0f, ((gap * 3f / 2f) + size.value.toFloat()).roundToInt().toFloat()),
+ Offset(0f, ((gap * 3f / 2f) + size.value.toFloat()).roundToInt().toFloat()),
childPosition[1]
)
assertEquals(
- PxPosition(0f, ((gap * 5f / 2f) + size.value.toFloat() * 2f).roundToInt().toFloat()),
+ Offset(0f, ((gap * 5f / 2f) + size.value.toFloat() * 2f).roundToInt().toFloat()),
childPosition[2]
)
}
@@ -2793,7 +2793,7 @@
val drawLatch = CountDownLatch(4)
val childPosition = arrayOf(
- PxPosition.Origin, PxPosition.Origin, PxPosition.Origin
+ Offset.Zero, Offset.Zero, Offset.Zero
)
val childLayoutCoordinates = arrayOfNulls<LayoutCoordinates?>(childPosition.size)
var parentLayoutCoordinates: LayoutCoordinates? = null
@@ -2825,13 +2825,13 @@
waitForDraw(root)
val step = (root.height - size.value.toFloat() * 3f) / 3f
- assertEquals(PxPosition(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, 0f), childPosition[0])
assertEquals(
- PxPosition(0f, (step + size.value.toFloat()).roundToInt().toFloat()),
+ Offset(0f, (step + size.value.toFloat()).roundToInt().toFloat()),
childPosition[1]
)
assertEquals(
- PxPosition(0f, (step * 3 + size.value.toFloat() * 2).roundToInt().toFloat()),
+ Offset(0f, (step * 3 + size.value.toFloat() * 2).roundToInt().toFloat()),
childPosition[2]
)
}
@@ -3477,7 +3477,7 @@
fun testRelativeToSiblingsModifiersChain_leftMostWins() = with(density) {
val positionedLatch = CountDownLatch(1)
val containerSize = Ref<IntPxSize>()
- val containerPosition = Ref<PxPosition>()
+ val containerPosition = Ref<Offset>()
val size = 40.dp
show {
@@ -3506,7 +3506,7 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertNotNull(containerSize)
- assertEquals(PxPosition(size.toPx(), size.toPx()), containerPosition.value)
+ assertEquals(Offset(size.toPx(), size.toPx()), containerPosition.value)
}
// endregion
@@ -3517,12 +3517,12 @@
val size = sizeDp.toIntPx()
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Row(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3531,7 +3531,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3544,9 +3544,9 @@
waitForDraw(root)
val rootWidth = root.width
- assertEquals(PxPosition((rootWidth - size.value.toFloat()), 0f), childPosition[0])
+ assertEquals(Offset((rootWidth - size.value.toFloat()), 0f), childPosition[0])
assertEquals(
- PxPosition((rootWidth - (sizeDp.toPx() * 3f).roundToInt()).toFloat(), 0f),
+ Offset((rootWidth - (sizeDp.toPx() * 3f).roundToInt()).toFloat(), 0f),
childPosition[1]
)
}
@@ -3556,7 +3556,7 @@
val sizeDp = 35.dp
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Row(
Modifier.fillMaxWidth().rtl,
@@ -3564,7 +3564,7 @@
) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3573,7 +3573,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3584,13 +3584,13 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
assertEquals(
- PxPosition(
+ Offset(
(sizeDp.toPx() * 2).roundToInt().toFloat(),
0f
),
childPosition[0]
)
- assertEquals(PxPosition(0f, 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[1])
}
@Test
@@ -3598,7 +3598,7 @@
val sizeDp = 35.dp
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Row(
Modifier.fillMaxWidth().rtl,
@@ -3608,7 +3608,7 @@
width = sizeDp,
height = sizeDp,
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3618,7 +3618,7 @@
width = (sizeDp * 2),
height = (sizeDp * 2),
modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3631,10 +3631,10 @@
waitForDraw(root)
assertEquals(
- PxPosition((sizeDp.toPx() * 2).roundToInt().toFloat(), 0f),
+ Offset((sizeDp.toPx() * 2).roundToInt().toFloat(), 0f),
childPosition[0]
)
- assertEquals(PxPosition(0f, 0f), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[1])
}
@Test
@@ -3643,12 +3643,12 @@
val size = sizeDp.toIntPx()
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Column(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp).onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3657,7 +3657,7 @@
Container(
Modifier.preferredSize(sizeDp * 2)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3670,9 +3670,9 @@
waitForDraw(root)
val rootWidth = root.width
- assertEquals(PxPosition((rootWidth - size.value.toFloat()), 0f), childPosition[0])
+ assertEquals(Offset((rootWidth - size.value.toFloat()), 0f), childPosition[0])
assertEquals(
- PxPosition(
+ Offset(
(rootWidth - (sizeDp * 2f).toPx()).roundToInt().toFloat(),
size.value.toFloat()
),
@@ -3686,14 +3686,14 @@
val size = sizeDp.toIntPx()
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Column(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp)
.gravity(Alignment.End)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3703,7 +3703,7 @@
Modifier.preferredSize(sizeDp * 2)
.gravity(Alignment.End)
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3713,8 +3713,8 @@
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- assertEquals(PxPosition(0f, 0f), childPosition[0])
- assertEquals(PxPosition(0f, size.value.toFloat()), childPosition[1])
+ assertEquals(Offset(0f, 0f), childPosition[0])
+ assertEquals(Offset(0f, size.value.toFloat()), childPosition[1])
}
@Test
@@ -3723,14 +3723,14 @@
val size = sizeDp.toIntPx()
val drawLatch = CountDownLatch(2)
- val childPosition = arrayOf(PxPosition.Origin, PxPosition.Origin)
+ val childPosition = arrayOf(Offset.Zero, Offset.Zero)
show {
Column(Modifier.fillMaxWidth().rtl) {
Container(
Modifier.preferredSize(sizeDp)
.alignWithSiblings { it.width }
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[0] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[0] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3740,7 +3740,7 @@
Modifier.preferredSize(sizeDp)
.alignWithSiblings { it.width / 2 }
.onPositioned { coordinates: LayoutCoordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0f, 0f))
+ childPosition[1] = coordinates.localToGlobal(Offset(0f, 0f))
drawLatch.countDown()
}
) {
@@ -3753,9 +3753,9 @@
waitForDraw(root)
val rootWidth = root.width
- assertEquals(PxPosition((rootWidth - size.value.toFloat()), 0f), childPosition[0])
+ assertEquals(Offset((rootWidth - size.value.toFloat()), 0f), childPosition[0])
assertEquals(
- PxPosition((rootWidth - size.value.toFloat() * 1.5f).roundToInt().toFloat(),
+ Offset((rootWidth - size.value.toFloat() * 1.5f).roundToInt().toFloat(),
size.value.toFloat()),
childPosition[1]
)
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
index 9ca5cd3..f90759d 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/StackTest.kt
@@ -33,7 +33,7 @@
import androidx.ui.layout.wrapContentSize
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -43,6 +43,7 @@
import org.junit.runners.JUnit4
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
+import kotlin.math.roundToInt
@SmallTest
@RunWith(JUnit4::class)
@@ -55,9 +56,9 @@
val positionedLatch = CountDownLatch(3)
val stackSize = Ref<IntPxSize>()
val alignedChildSize = Ref<IntPxSize>()
- val alignedChildPosition = Ref<PxPosition>()
+ val alignedChildPosition = Ref<Offset>()
val positionedChildSize = Ref<IntPxSize>()
- val positionedChildPosition = Ref<PxPosition>()
+ val positionedChildPosition = Ref<Offset>()
show {
Container(alignment = Alignment.TopStart) {
Stack {
@@ -90,9 +91,12 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), alignedChildSize.value)
- assertEquals(PxPosition(0f, 0f), alignedChildPosition.value)
+ assertEquals(Offset(0f, 0f), alignedChildPosition.value)
assertEquals(IntPxSize(30.dp.toIntPx(), 30.dp.toIntPx()), positionedChildSize.value)
- assertEquals(PxPosition(10.dp.toIntPx(), 10.dp.toIntPx()), positionedChildPosition.value)
+ assertEquals(
+ Offset(10.dp.toPx().roundToInt().toFloat(), 10.dp.toPx().roundToInt().toFloat()),
+ positionedChildPosition.value
+ )
}
@Test
@@ -105,7 +109,7 @@
val positionedLatch = CountDownLatch(3)
val stackSize = Ref<IntPxSize>()
val childSize = arrayOf(Ref<IntPxSize>(), Ref<IntPxSize>())
- val childPosition = arrayOf(Ref<PxPosition>(), Ref<PxPosition>())
+ val childPosition = arrayOf(Ref<Offset>(), Ref<Offset>())
show {
Container(alignment = Alignment.TopStart) {
Stack(Modifier.onPositioned { coordinates: LayoutCoordinates ->
@@ -141,9 +145,12 @@
assertEquals(IntPxSize(doubleSize, doubleSize), stackSize.value)
assertEquals(IntPxSize(size, size), childSize[0].value)
- assertEquals(PxPosition(size, size), childPosition[0].value)
+ assertEquals(
+ Offset(size.value.toFloat(), size.value.toFloat()),
+ childPosition[0].value
+ )
assertEquals(IntPxSize(doubleSize, doubleSize), childSize[1].value)
- assertEquals(PxPosition(0f, 0f), childPosition[1].value)
+ assertEquals(Offset(0f, 0f), childPosition[1].value)
}
@Test
@@ -157,7 +164,7 @@
val positionedLatch = CountDownLatch(6)
val stackSize = Ref<IntPxSize>()
val childSize = Array(5) { Ref<IntPxSize>() }
- val childPosition = Array(5) { Ref<PxPosition>() }
+ val childPosition = Array(5) { Ref<Offset>() }
show {
Container(alignment = Alignment.TopStart) {
Stack(Modifier.onPositioned { coordinates: LayoutCoordinates ->
@@ -213,15 +220,15 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), childSize[0].value)
- assertEquals(PxPosition(0f, 0f), childPosition[0].value)
+ assertEquals(Offset(0f, 0f), childPosition[0].value)
assertEquals(IntPxSize(size - inset, size - inset), childSize[1].value)
- assertEquals(PxPosition(inset, inset), childPosition[1].value)
+ assertEquals(Offset(inset.value.toFloat(), inset.value.toFloat()), childPosition[1].value)
assertEquals(IntPxSize(size - inset, size - inset), childSize[2].value)
- assertEquals(PxPosition(0f, 0f), childPosition[2].value)
+ assertEquals(Offset(0f, 0f), childPosition[2].value)
assertEquals(IntPxSize(size - inset * 2, size), childSize[3].value)
- assertEquals(PxPosition(inset, 0.ipx), childPosition[3].value)
+ assertEquals(Offset(inset.value.toFloat(), 0f), childPosition[3].value)
assertEquals(IntPxSize(size, size - inset * 2), childSize[4].value)
- assertEquals(PxPosition(0.ipx, inset), childPosition[4].value)
+ assertEquals(Offset(0f, inset.value.toFloat()), childPosition[4].value)
}
@Test
@@ -234,7 +241,7 @@
val positionedLatch = CountDownLatch(10)
val stackSize = Ref<IntPxSize>()
val childSize = Array(9) { Ref<IntPxSize>() }
- val childPosition = Array(9) { Ref<PxPosition>() }
+ val childPosition = Array(9) { Ref<Offset>() }
show {
Stack(Modifier.wrapContentSize(Alignment.TopStart)) {
Stack(
@@ -305,27 +312,30 @@
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
assertEquals(IntPxSize(tripleSize, tripleSize), stackSize.value)
- assertEquals(PxPosition((size * 2).value.toFloat(), 0f), childPosition[0].value)
- assertEquals(PxPosition(size, 0.ipx), childPosition[1].value)
- assertEquals(PxPosition(0.ipx, 0.ipx), childPosition[2].value)
+ assertEquals(Offset((size * 2).value.toFloat(), 0f), childPosition[0].value)
+ assertEquals(Offset(size.value.toFloat(), 0f), childPosition[1].value)
+ assertEquals(Offset(0f, 0f), childPosition[2].value)
assertEquals(
- PxPosition(
+ Offset(
(size * 2).value.toFloat(),
size.value.toFloat()
),
childPosition[3].value
)
- assertEquals(PxPosition(size, size), childPosition[4].value)
- assertEquals(PxPosition(0.ipx, size), childPosition[5].value)
+ assertEquals(Offset(size.value.toFloat(), size.value.toFloat()), childPosition[4].value)
+ assertEquals(Offset(0f, size.value.toFloat()), childPosition[5].value)
assertEquals(
- PxPosition(
+ Offset(
(size * 2).value.toFloat(),
(size * 2).value.toFloat()
),
childPosition[6].value
)
- assertEquals(PxPosition(size, size * 2), childPosition[7].value)
- assertEquals(PxPosition(0.ipx, size * 2), childPosition[8].value)
+ assertEquals(
+ Offset(size.value.toFloat(), (size * 2).value.toFloat()),
+ childPosition[7].value
+ )
+ assertEquals(Offset(0f, (size * 2).value.toFloat()), childPosition[8].value)
}
@Test
@@ -338,7 +348,7 @@
val positionedLatch = CountDownLatch(3)
val stackSize = Ref<IntPxSize>()
val childSize = Array(2) { Ref<IntPxSize>() }
- val childPosition = Array(2) { Ref<PxPosition>() }
+ val childPosition = Array(2) { Ref<Offset>() }
show {
Container(alignment = Alignment.TopStart) {
Container(
@@ -370,9 +380,15 @@
assertEquals(IntPxSize(size, size), stackSize.value)
assertEquals(IntPxSize(size, size), childSize[0].value)
- assertEquals(PxPosition(0f, 0f), childPosition[0].value)
+ assertEquals(Offset(0f, 0f), childPosition[0].value)
assertEquals(IntPxSize(halfSize, halfSize), childSize[1].value)
- assertEquals(PxPosition(size - halfSize, size - halfSize), childPosition[1].value)
+ assertEquals(
+ Offset(
+ (size - halfSize).value.toFloat(),
+ (size - halfSize).value.toFloat()
+ ),
+ childPosition[1].value
+ )
}
@Test
diff --git a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
index 23d1bfd..9ca4548 100644
--- a/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
+++ b/ui/ui-material/integration-tests/material-demos/src/main/java/androidx/ui/material/demos/ColorPickerDemo.kt
@@ -69,7 +69,6 @@
import androidx.ui.material.TopAppBar
import androidx.ui.text.style.TextAlign
import androidx.ui.unit.Dp
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import java.util.Locale
@@ -97,7 +96,7 @@
.aspectRatio(1f)
) {
val diameter = constraints.maxWidth.value
- var position by state { PxPosition.Origin }
+ var position by state { Offset.Zero }
val colorWheel = remember(diameter) { ColorWheel(diameter) }
var isDragging by state { false }
@@ -136,17 +135,17 @@
*/
@Composable
private fun SimplePointerInput(
- position: PxPosition,
- onPositionChange: (PxPosition) -> Unit,
+ position: Offset,
+ onPositionChange: (Offset) -> Unit,
onDragStateChange: (Boolean) -> Unit
): Modifier {
val observer = object : DragObserver {
- override fun onStart(downPosition: PxPosition) {
+ override fun onStart(downPosition: Offset) {
onDragStateChange(true)
onPositionChange(downPosition)
}
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
onPositionChange(position + dragDistance)
return dragDistance
}
@@ -155,7 +154,7 @@
onDragStateChange(false)
}
- override fun onStop(velocity: PxPosition) {
+ override fun onStop(velocity: Offset) {
onDragStateChange(false)
}
}
@@ -167,7 +166,7 @@
* Magnifier displayed on top of [position] with the currently selected [color].
*/
@Composable
-private fun Magnifier(visible: Boolean, position: PxPosition, color: Color) {
+private fun Magnifier(visible: Boolean, position: Offset, color: Color) {
val offset = with(DensityAmbient.current) {
Modifier.offset(
position.x.toDp() - MagnifierWidth / 2,
@@ -340,7 +339,7 @@
* @return the matching color for [position] inside [ColorWheel], or `null` if there is no color
* or the color is partially transparent.
*/
-private fun ColorWheel.colorForPosition(position: PxPosition): Color {
+private fun ColorWheel.colorForPosition(position: Offset): Color {
val x = position.x.toInt().coerceAtLeast(0)
val y = position.y.toInt().coerceAtLeast(0)
with(image.toPixelMap()) {
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
index ce92791..e8c9f31 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ButtonTest.kt
@@ -56,7 +56,7 @@
import androidx.ui.test.findByText
import androidx.ui.test.runOnIdleCompose
import androidx.ui.unit.Dp
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.center
import androidx.ui.unit.dp
@@ -549,8 +549,8 @@
}
runOnIdleCompose {
- val topLeft = childCoordinates!!.localToGlobal(PxPosition.Origin).x -
- parentCoordinates!!.localToGlobal(PxPosition.Origin).x
+ val topLeft = childCoordinates!!.localToGlobal(Offset.Zero).x -
+ parentCoordinates!!.localToGlobal(Offset.Zero).x
val currentPadding = with(composeTestRule.density) {
padding.toIntPx().value.toFloat()
}
@@ -559,7 +559,7 @@
}
}
-fun assertWithinOnePixel(expected: PxPosition, actual: PxPosition) {
+fun assertWithinOnePixel(expected: Offset, actual: Offset) {
assertWithinOnePixel(expected.x, actual.x)
assertWithinOnePixel(expected.y, actual.y)
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
index c5fb2a0..55bd392 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/DrawerTest.kt
@@ -36,7 +36,7 @@
import androidx.ui.test.sendClick
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.height
import androidx.ui.unit.width
@@ -59,11 +59,11 @@
@Test
fun modalDrawer_testOffset_whenOpened() {
- var position: PxPosition? = null
+ var position: Offset? = null
composeTestRule.setMaterialContent {
ModalDrawerLayout(DrawerState.Opened, {}, drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
- position = coords.localToGlobal(PxPosition.Origin)
+ position = coords.localToGlobal(Offset.Zero)
})
}, bodyContent = emptyContent())
}
@@ -74,11 +74,11 @@
@Test
fun modalDrawer_testOffset_whenClosed() {
- var position: PxPosition? = null
+ var position: Offset? = null
composeTestRule.setMaterialContent {
ModalDrawerLayout(DrawerState.Closed, {}, drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
- position = coords.localToGlobal(PxPosition.Origin)
+ position = coords.localToGlobal(Offset.Zero)
})
}, bodyContent = emptyContent())
}
@@ -108,11 +108,11 @@
@Test
fun bottomDrawer_testOffset_whenOpened() {
- var position: PxPosition? = null
+ var position: Offset? = null
composeTestRule.setMaterialContent {
BottomDrawerLayout(DrawerState.Opened, {}, drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
- position = coords.localToGlobal(PxPosition.Origin)
+ position = coords.localToGlobal(Offset.Zero)
})
}, bodyContent = emptyContent())
}
@@ -128,11 +128,11 @@
@Test
fun bottomDrawer_testOffset_whenClosed() {
- var position: PxPosition? = null
+ var position: Offset? = null
composeTestRule.setMaterialContent {
BottomDrawerLayout(DrawerState.Closed, {}, drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { coords: LayoutCoordinates ->
- position = coords.localToGlobal(PxPosition.Origin)
+ position = coords.localToGlobal(Offset.Zero)
})
}, bodyContent = emptyContent())
}
@@ -154,7 +154,7 @@
drawerContent = {
Box(
Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
- val pos = info.localToGlobal(PxPosition.Origin)
+ val pos = info.localToGlobal(Offset.Zero)
if (pos.x == 0.0f) {
// If fully opened, mark the openedLatch if present
openedLatch?.countDown()
@@ -227,7 +227,7 @@
findByTag("Drawer").doGesture {
val left = 1.0f
val centerY = (globalBounds.height / 2)
- sendClick(PxPosition(left, centerY))
+ sendClick(Offset(left, centerY))
}
runOnIdleCompose {
@@ -248,7 +248,7 @@
BottomDrawerLayout(drawerState.value, { drawerState.value = it },
drawerContent = {
Box(Modifier.fillMaxSize().onPositioned { info: LayoutCoordinates ->
- val pos = info.localToGlobal(PxPosition.Origin)
+ val pos = info.localToGlobal(Offset.Zero)
if (pos.y.roundToInt() == openedHeight?.value) {
// If fully opened, mark the openedLatch if present
openedLatch?.countDown()
@@ -326,7 +326,7 @@
val bounds = globalBounds
val centerX = bounds.width / 2
val bottom = bounds.height - 1.0f
- sendClick(PxPosition(centerX, bottom))
+ sendClick(Offset(centerX, bottom))
}
assertThat(drawerClicks).isEqualTo(1)
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
index 697adf4..d68c5ff 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/FilledTextFieldTest.kt
@@ -56,7 +56,7 @@
import androidx.ui.text.FirstBaseline
import androidx.ui.text.SoftwareKeyboardController
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import androidx.ui.unit.sp
@@ -160,7 +160,7 @@
// Click on (2, 2) which is Surface area and outside input area
findByTag("textField").doGesture {
- sendClick(PxPosition(2.ipx, 2.ipx))
+ sendClick(Offset(2f, 2f))
}
testRule.runOnIdleComposeWithDensity {
@@ -171,7 +171,7 @@
@Test
fun testLabelPosition_initial_withDefaultHeight() {
val labelSize = Ref<IntPxSize>()
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -211,7 +211,7 @@
fun testLabelPosition_initial_withCustomHeight() {
val height = 80.dp
val labelSize = Ref<IntPxSize>()
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -246,7 +246,7 @@
@Test
fun testLabelPosition_whenFocused() {
val labelSize = Ref<IntPxSize>()
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
val baseline = Ref<Float>()
testRule.setMaterialContent {
Box {
@@ -287,7 +287,7 @@
@Test
fun testLabelPosition_whenInput() {
val labelSize = Ref<IntPxSize>()
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
val baseline = Ref<Float>()
testRule.setMaterialContent {
Box {
@@ -324,7 +324,7 @@
@Test
fun testPlaceholderPosition_withLabel() {
val placeholderSize = Ref<IntPxSize>()
- val placeholderPosition = Ref<PxPosition>()
+ val placeholderPosition = Ref<Offset>()
val placeholderBaseline = Ref<Float>()
testRule.setMaterialContent {
Box {
@@ -366,7 +366,7 @@
@Test
fun testPlaceholderPosition_whenNoLabel() {
val placeholderSize = Ref<IntPxSize>()
- val placeholderPosition = Ref<PxPosition>()
+ val placeholderPosition = Ref<Offset>()
val placeholderBaseline = Ref<Float>()
val height = 60.dp
testRule.setMaterialContent {
@@ -409,7 +409,7 @@
@Test
fun testNoPlaceholder_whenInputNotEmpty() {
val placeholderSize = Ref<IntPxSize>()
- val placeholderPosition = Ref<PxPosition>()
+ val placeholderPosition = Ref<Offset>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -462,9 +462,9 @@
val textFieldHeight = 60.dp
val textFieldWidth = 300.dp
val size = 30.dp
- val leadingPosition = Ref<PxPosition>()
+ val leadingPosition = Ref<Offset>()
val leadingSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingSize = Ref<IntPxSize>()
testRule.setMaterialContent {
@@ -511,7 +511,7 @@
fun testLabelPositionX_initial_withTrailingAndLeading() {
val height = 60.dp
val iconSize = 30.dp
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
testRule.setMaterialContent {
Box {
FilledTextField(
@@ -540,7 +540,7 @@
@Test
fun testLabelPositionX_initial_withEmptyTrailingAndLeading() {
val height = 60.dp
- val labelPosition = Ref<PxPosition>()
+ val labelPosition = Ref<Offset>()
testRule.setMaterialContent {
Box {
FilledTextField(
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
index d35fb91..5584105 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ListItemTest.kt
@@ -29,7 +29,7 @@
import androidx.ui.test.createComposeRule
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import com.google.common.truth.Truth.assertThat
@@ -187,9 +187,9 @@
val expectedLeftPadding = 16.dp
val expectedRightPadding = 16.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -224,9 +224,9 @@
val expectedLeftPadding = 16.dp
val expectedTextLeftPadding = 32.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textSize = Ref<IntPxSize>()
- val iconPosition = Ref<PxPosition>()
+ val iconPosition = Ref<Offset>()
val iconSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -261,13 +261,13 @@
val expectedTextBaseline = 28.dp
val expectedSecondaryTextBaselineOffset = 20.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
- val secondaryTextPosition = Ref<PxPosition>()
+ val secondaryTextPosition = Ref<Offset>()
val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingBaseline = Ref<Float>()
val trailingSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
@@ -325,13 +325,13 @@
val expectedTextBaseline = 32.dp
val expectedSecondaryTextBaselineOffset = 20.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
- val secondaryTextPosition = Ref<PxPosition>()
+ val secondaryTextPosition = Ref<Offset>()
val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
- val iconPosition = Ref<PxPosition>()
+ val iconPosition = Ref<Offset>()
val iconSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -391,15 +391,15 @@
val expectedSecondaryTextBaselineOffset = 20.dp
val expectedRightPadding = 16.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
- val secondaryTextPosition = Ref<PxPosition>()
+ val secondaryTextPosition = Ref<Offset>()
val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
- val iconPosition = Ref<PxPosition>()
+ val iconPosition = Ref<Offset>()
val iconSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -469,15 +469,15 @@
val expectedSecondaryTextBaselineOffset = 20.dp
val expectedRightPadding = 16.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
- val secondaryTextPosition = Ref<PxPosition>()
+ val secondaryTextPosition = Ref<Offset>()
val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
- val iconPosition = Ref<PxPosition>()
+ val iconPosition = Ref<Offset>()
val iconSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingSize = Ref<IntPxSize>()
composeTestRule.setMaterialContent {
Box {
@@ -547,18 +547,18 @@
val expectedSecondaryTextBaselineOffset = 20.dp
val expectedRightPadding = 16.dp
- val textPosition = Ref<PxPosition>()
+ val textPosition = Ref<Offset>()
val textBaseline = Ref<Float>()
val textSize = Ref<IntPxSize>()
- val overlineTextPosition = Ref<PxPosition>()
+ val overlineTextPosition = Ref<Offset>()
val overlineTextBaseline = Ref<Float>()
val overlineTextSize = Ref<IntPxSize>()
- val secondaryTextPosition = Ref<PxPosition>()
+ val secondaryTextPosition = Ref<Offset>()
val secondaryTextBaseline = Ref<Float>()
val secondaryTextSize = Ref<IntPxSize>()
- val iconPosition = Ref<PxPosition>()
+ val iconPosition = Ref<Offset>()
val iconSize = Ref<IntPxSize>()
- val trailingPosition = Ref<PxPosition>()
+ val trailingPosition = Ref<Offset>()
val trailingSize = Ref<IntPxSize>()
val trailingBaseline = Ref<Float>()
composeTestRule.setMaterialContent {
@@ -654,11 +654,11 @@
private fun Dp.toIntPx() = (this.value * composeTestRule.density.density).roundToInt()
private fun saveLayout(
- coords: Ref<PxPosition>,
+ coords: Ref<Offset>,
size: Ref<IntPxSize>,
baseline: Ref<Float> = Ref()
): Modifier = Modifier.onPositioned { coordinates: LayoutCoordinates ->
- coords.value = coordinates.localToGlobal(PxPosition.Origin)
+ coords.value = coordinates.localToGlobal(Offset.Zero)
baseline.value = coordinates[FirstBaseline]?.value?.toFloat()?.let {
it + coords.value!!.y
}
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
index 764241e..8a5678a 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ScaffoldTest.kt
@@ -52,7 +52,7 @@
import androidx.ui.test.sendSwipeLeft
import androidx.ui.test.sendSwipeRight
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.toPxSize
import androidx.ui.unit.toSize
@@ -88,8 +88,8 @@
@Test
fun scaffold_onlyContent_stackSlot() {
- lateinit var child1: PxPosition
- lateinit var child2: PxPosition
+ var child1: Offset = Offset.Zero
+ var child2: Offset = Offset.Zero
composeTestRule.setMaterialContent {
Scaffold {
Text("One",
@@ -106,15 +106,15 @@
@Test
fun scaffold_AppbarAndContent_inColumn() {
- lateinit var appbarPosition: PxPosition
+ var appbarPosition: Offset = Offset.Zero
lateinit var appbarSize: IntPxSize
- lateinit var contentPosition: PxPosition
+ var contentPosition: Offset = Offset.Zero
composeTestRule.setMaterialContent {
Scaffold(
topBar = {
Box(Modifier
.onPositioned { positioned: LayoutCoordinates ->
- appbarPosition = positioned.localToGlobal(PxPosition.Origin)
+ appbarPosition = positioned.localToGlobal(Offset.Zero)
appbarSize = positioned.size
}
.fillMaxWidth()
@@ -124,7 +124,7 @@
}
) {
Box(Modifier
- .onPositioned { contentPosition = it.localToGlobal(PxPosition.Origin) }
+ .onPositioned { contentPosition = it.localToGlobal(Offset.Zero) }
.fillMaxWidth()
.preferredHeight(50.dp)
.drawBackground(Color.Blue)
@@ -137,9 +137,9 @@
@Test
fun scaffold_bottomBarAndContent_inStack() {
- lateinit var appbarPosition: PxPosition
+ var appbarPosition: Offset = Offset.Zero
lateinit var appbarSize: IntPxSize
- lateinit var contentPosition: PxPosition
+ var contentPosition: Offset = Offset.Zero
lateinit var contentSize: IntPxSize
composeTestRule.setMaterialContent {
Scaffold(
@@ -174,7 +174,7 @@
@Test
@Ignore("unignore once animation sync is ready (b/147291885)")
fun scaffold_drawer_gestures() {
- lateinit var drawerChildPosition: PxPosition
+ var drawerChildPosition: Offset = Offset.Zero
val scaffoldState = ScaffoldState(isDrawerGesturesEnabled = false)
composeTestRule.setMaterialContent {
Semantics(properties = { testTag = scaffoldTag }) {
@@ -227,7 +227,7 @@
@Test
@Ignore("unignore once animation sync is ready (b/147291885)")
fun scaffold_drawer_manualControl() {
- lateinit var drawerChildPosition: PxPosition
+ var drawerChildPosition: Offset = Offset.Zero
val scaffoldState = ScaffoldState()
composeTestRule.setMaterialContent {
Semantics(properties = { testTag = scaffoldTag }) {
@@ -266,9 +266,9 @@
@Test
fun scaffold_centerDockedFab_position() {
- lateinit var fabPosition: PxPosition
+ var fabPosition: Offset = Offset.Zero
lateinit var fabSize: IntPxSize
- lateinit var bottomBarPosition: PxPosition
+ var bottomBarPosition: Offset = Offset.Zero
composeTestRule.setContent {
Scaffold(
floatingActionButton = {
@@ -304,9 +304,9 @@
@Test
fun scaffold_endDockedFab_position() {
- lateinit var fabPosition: PxPosition
+ var fabPosition: Offset = Offset.Zero
lateinit var fabSize: IntPxSize
- lateinit var bottomBarPosition: PxPosition
+ var bottomBarPosition: Offset = Offset.Zero
composeTestRule.setContent {
Scaffold(
floatingActionButton = {
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
index 246686d..b84cefa 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/SnackbarTest.kt
@@ -42,7 +42,7 @@
import androidx.ui.test.findByTag
import androidx.ui.test.findByText
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import com.google.common.truth.Truth.assertThat
@@ -164,7 +164,7 @@
) {
with(composeTestRule.density) {
val buttonTextPos =
- localSnackCoords.childToLocal(localButtonTextCoords, PxPosition.Origin)
+ localSnackCoords.childToLocal(localButtonTextCoords, Offset.Zero)
assertThat(localTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(localButtonTextCoords[FirstBaseline]).isNotEqualTo(IntPx.Zero)
assertThat(
@@ -246,7 +246,7 @@
if (localTextCoords != null && localButtonCoords != null && localSnackCoords != null) {
with(composeTestRule.density) {
val buttonPositionInSnack =
- localSnackCoords.childToLocal(localButtonCoords, PxPosition.Origin)
+ localSnackCoords.childToLocal(localButtonCoords, Offset.Zero)
val buttonCenter =
buttonPositionInSnack.y.roundToInt() +
(localButtonCoords.size.height / 2).value.toFloat()
@@ -303,9 +303,9 @@
if (localTextCoords != null && localButtonCoords != null && localSnackCoords != null) {
with(composeTestRule.density) {
val buttonPositionInSnack =
- localSnackCoords.childToLocal(localButtonCoords, PxPosition.Origin)
+ localSnackCoords.childToLocal(localButtonCoords, Offset.Zero)
val textPositionInSnack =
- localSnackCoords.childToLocal(localTextCoords, PxPosition.Origin)
+ localSnackCoords.childToLocal(localTextCoords, Offset.Zero)
assertThat(
textPositionInSnack.y.roundToInt().ipx + localTextCoords[FirstBaseline]!!
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
index 9bc5a04..043f69e 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/TabTest.kt
@@ -45,7 +45,7 @@
import androidx.ui.test.findAll
import androidx.ui.test.isInMutuallyExclusiveGroup
import androidx.ui.test.runOnIdleCompose
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
@@ -145,11 +145,11 @@
val tabRowWidth = tabRowCoords.size.width
val tabRowHeight = tabRowCoords.size.height
- val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
+ val indicatorPositionX = indicatorCoords.localToGlobal(Offset.Zero).x
val expectedPositionX = 0.dp.toPx()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
- val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
+ val indicatorPositionY = indicatorCoords.localToGlobal(Offset.Zero).y
val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
@@ -163,11 +163,11 @@
// should be in the middle of the TabRow
runOnIdleCompose {
with(composeTestRule.density) {
- val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
+ val indicatorPositionX = indicatorCoords.localToGlobal(Offset.Zero).x
val expectedPositionX = (tabRowWidth / 2).value.toFloat()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
- val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
+ val indicatorPositionY = indicatorCoords.localToGlobal(Offset.Zero).y
val expectedPositionY =
(tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
@@ -213,7 +213,7 @@
val tabRowHeight = tabRowCoords.size.height
- val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
+ val textPositionY = textCoords.localToGlobal(Offset.Zero).y
val baselinePositionY = textPositionY + textBaseline
val expectedPositionY = (tabRowHeight.value.toFloat() - expectedBaselineDistance)
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
@@ -259,7 +259,7 @@
val tabRowHeight = tabRowCoords.size.height
- val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
+ val textPositionY = textCoords.localToGlobal(Offset.Zero).y
val baselinePositionY = textPositionY + textBaseline
val expectedPositionY = (tabRowHeight.value.toFloat() - expectedBaselineDistance)
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
@@ -304,7 +304,7 @@
val tabRowHeight = tabRowCoords.size.height
- val textPositionY = textCoords.localToGlobal(PxPosition.Origin).y
+ val textPositionY = textCoords.localToGlobal(Offset.Zero).y
val baselinePositionY = textPositionY + textBaseline
val expectedPositionY = (tabRowHeight.value.toFloat() - expectedBaselineDistance)
assertThat(baselinePositionY).isEqualTo(expectedPositionY)
@@ -355,12 +355,12 @@
val tabRowHeight = tabRowCoords.size.height
// Indicator should be placed in the bottom left of the first tab
- val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
+ val indicatorPositionX = indicatorCoords.localToGlobal(Offset.Zero).x
// Tabs in a scrollable tab row are offset 52.dp from each end
val expectedPositionX = scrollableTabRowOffset.toIntPx().value.toFloat()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
- val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
+ val indicatorPositionY = indicatorCoords.localToGlobal(Offset.Zero).y
val expectedPositionY = (tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
@@ -373,12 +373,12 @@
// Indicator should now be placed in the bottom left of the second tab, so its x coordinate
// should be in the middle of the TabRow
composeTestRule.runOnIdleComposeWithDensity {
- val indicatorPositionX = indicatorCoords.localToGlobal(PxPosition.Origin).x
+ val indicatorPositionX = indicatorCoords.localToGlobal(Offset.Zero).x
val expectedPositionX =
(scrollableTabRowOffset + minimumTabWidth).toIntPx().value.toFloat()
assertThat(indicatorPositionX).isEqualTo(expectedPositionX)
- val indicatorPositionY = indicatorCoords.localToGlobal(PxPosition.Origin).y
+ val indicatorPositionY = indicatorCoords.localToGlobal(Offset.Zero).y
val expectedPositionY =
(tabRowHeight - indicatorHeight.toIntPx()).value.toFloat()
assertThat(indicatorPositionY).isEqualTo(expectedPositionY)
diff --git a/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt b/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
index d1c07c5..d52810d 100644
--- a/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
+++ b/ui/ui-material/src/androidTest/java/androidx/ui/material/ripple/RippleIndicationTest.kt
@@ -36,6 +36,7 @@
import androidx.ui.foundation.InteractionState
import androidx.ui.foundation.indication
import androidx.ui.foundation.shape.corner.RoundedCornerShape
+import androidx.ui.geometry.Offset
import androidx.ui.graphics.Color
import androidx.ui.graphics.compositeOver
import androidx.ui.layout.fillMaxSize
@@ -53,7 +54,6 @@
import androidx.ui.test.findByTag
import androidx.ui.test.runOnUiThread
import androidx.ui.test.waitForIdle
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.dp
import com.google.common.truth.Truth
import org.junit.Rule
@@ -526,7 +526,7 @@
}
runOnUiThread {
- interactionState.addInteraction(Interaction.Pressed, PxPosition(10f, 10f))
+ interactionState.addInteraction(Interaction.Pressed, Offset(10f, 10f))
}
with(findByTag(Tag)) {
@@ -582,7 +582,7 @@
// Start ripple
runOnUiThread {
if (interaction is Interaction.Pressed) {
- interactionState.addInteraction(interaction, PxPosition(10f, 10f))
+ interactionState.addInteraction(interaction, Offset(10f, 10f))
} else {
interactionState.addInteraction(interaction)
}
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
index 24e3fe8..f0fb32e 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/RadioButton.kt
@@ -240,8 +240,8 @@
radioStroke: Stroke
) {
// TODO(malkov): currently Radio gravity is always CENTER but we need to be flexible
- val centerW = center.dx
- val centerH = center.dy
+ val centerW = center.x
+ val centerH = center.y
val center = Offset(centerW, centerH)
if (gapWidth == 0.0f) {
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
index 8fbf853..d3cde72 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Slider.kt
@@ -43,6 +43,7 @@
import androidx.ui.foundation.indication
import androidx.ui.foundation.shape.corner.CircleShape
import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import androidx.ui.graphics.Color
import androidx.ui.graphics.PointMode
import androidx.ui.graphics.StrokeCap
@@ -233,8 +234,8 @@
val activeTickColor = MaterialTheme.colors.onPrimary.copy(alpha = TickColorAlpha)
val inactiveTickColor = color.copy(alpha = TickColorAlpha)
Canvas(modifier) {
- val sliderStart = Offset(thumbPx, center.dy)
- val sliderMax = Offset(size.width - thumbPx, center.dy)
+ val sliderStart = Offset(thumbPx, center.y)
+ val sliderMax = Offset(size.width - thumbPx, center.y)
drawLine(
color.copy(alpha = InactiveTrackColorAlpha),
sliderStart,
@@ -242,15 +243,15 @@
trackStroke
)
val sliderValue = Offset(
- sliderStart.dx + (sliderMax.dx - sliderStart.dx) * positionFraction,
- center.dy
+ sliderStart.x + (sliderMax.x - sliderStart.x) * positionFraction,
+ center.y
)
drawLine(color, sliderStart, sliderValue, trackStroke)
tickFractions.groupBy { it > positionFraction }.forEach { (afterFraction, list) ->
drawPoints(
list.map {
- Offset(Offset.lerp(sliderStart, sliderMax, it).dx, center.dy)
+ Offset(lerp(sliderStart, sliderMax, it).x, center.y)
},
PointMode.points,
if (afterFraction) inactiveTickColor else activeTickColor,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt b/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
index 77860f3..c6425e1 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/Switch.kt
@@ -117,8 +117,8 @@
val strokeRadius = stroke.width / 2
drawLine(
trackColor,
- Offset(strokeRadius, center.dy),
- Offset(trackWidth - strokeRadius, center.dy),
+ Offset(strokeRadius, center.y),
+ Offset(trackWidth - strokeRadius, center.y),
stroke
)
}
@@ -126,7 +126,7 @@
private fun DrawScope.drawThumb(position: Float, thumbDiameter: Float, thumbColor: Color) {
val thumbRadius = thumbDiameter / 2
val x = position + thumbRadius
- drawCircle(thumbColor, thumbRadius, Offset(x, center.dy))
+ drawCircle(thumbColor, thumbRadius, Offset(x, center.y))
}
private const val CheckedTrackOpacity = 0.54f
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
index 529aecc..6b15052 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/Ripple.kt
@@ -46,7 +46,7 @@
import androidx.ui.unit.Density
import androidx.ui.unit.Dp
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.center
import androidx.ui.unit.ipx
@@ -122,7 +122,7 @@
}
fun handleStart(
- touchPosition: PxPosition,
+ touchPosition: Offset,
density: Density,
bounded: Boolean,
radius: Dp?,
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleAnimation.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleAnimation.kt
index bda49ba..fac6d35 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleAnimation.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleAnimation.kt
@@ -33,14 +33,12 @@
import androidx.ui.graphics.drawscope.DrawScope
import androidx.ui.graphics.drawscope.clipRect
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.center
import androidx.ui.unit.dp
-import androidx.ui.unit.getDistance
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
-import androidx.ui.unit.toOffset
import kotlin.math.max
/**
@@ -67,7 +65,7 @@
*/
internal class RippleAnimation(
size: PxSize,
- startPosition: PxPosition,
+ startPosition: Offset,
radius: Float,
private val clipped: Boolean,
clock: AnimationClockObservable,
@@ -120,7 +118,7 @@
animation[RippleTransition.Alpha]
}
- val centerOffset = animation[RippleTransition.Center].toOffset()
+ val centerOffset = animation[RippleTransition.Center]
val radius = animation[RippleTransition.Radius]
val modulatedColor = color.copy(alpha = color.alpha * alpha)
@@ -159,8 +157,8 @@
fun definition(
startRadius: Float,
endRadius: Float,
- startCenter: PxPosition,
- endCenter: PxPosition
+ startCenter: Offset,
+ endCenter: Offset
) = transitionDefinition {
state(State.Initial) {
this[Alpha] = 0f
@@ -220,7 +218,7 @@
*/
internal fun Density.getRippleEndRadius(bounded: Boolean, size: PxSize): Float {
val radiusCoveringBounds =
- (PxPosition(size.width, size.height).getDistance() / 2f)
+ (Offset(size.width, size.height).getDistance() / 2f)
return if (bounded) {
radiusCoveringBounds + BoundedRippleExtraRadius.toPx()
} else {
diff --git a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
index 8a75394..ea273c3 100644
--- a/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
+++ b/ui/ui-material/src/main/java/androidx/ui/material/ripple/RippleIndication.kt
@@ -41,7 +41,7 @@
import androidx.ui.graphics.useOrElse
import androidx.ui.material.MaterialTheme
import androidx.ui.unit.Dp
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.PxSize
import androidx.ui.unit.center
import androidx.ui.util.fastForEach
@@ -150,7 +150,7 @@
private val stateLayer = StateLayer(clock, bounded, rippleOpacity)
private val ripples = modelListOf<RippleAnimation>()
- private var currentPressPosition: PxPosition? = null
+ private var currentPressPosition: Offset? = null
private var currentRipple: RippleAnimation? = null
override fun ContentDrawScope.drawIndication(interactionState: InteractionState) {
@@ -173,7 +173,7 @@
drawRipples(color.value)
}
- private fun ContentDrawScope.addRipple(targetRadius: Float, pressPosition: PxPosition) {
+ private fun ContentDrawScope.addRipple(targetRadius: Float, pressPosition: Offset) {
currentRipple?.finish()
val pxSize = PxSize(size.width, size.height)
val position = if (bounded) pressPosition else pxSize.center()
diff --git a/ui/ui-test/api/0.1.0-dev14.txt b/ui/ui-test/api/0.1.0-dev14.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/0.1.0-dev14.txt
+++ b/ui/ui-test/api/0.1.0-dev14.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/api/current.txt b/ui/ui-test/api/current.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/current.txt
+++ b/ui/ui-test/api/current.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-test/api/public_plus_experimental_0.1.0-dev14.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/api/public_plus_experimental_current.txt b/ui/ui-test/api/public_plus_experimental_current.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/public_plus_experimental_current.txt
+++ b/ui/ui-test/api/public_plus_experimental_current.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/api/restricted_0.1.0-dev14.txt b/ui/ui-test/api/restricted_0.1.0-dev14.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-test/api/restricted_0.1.0-dev14.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/api/restricted_current.txt b/ui/ui-test/api/restricted_current.txt
index 1fd1a3a..362e0bd 100644
--- a/ui/ui-test/api/restricted_current.txt
+++ b/ui/ui-test/api/restricted_current.txt
@@ -57,7 +57,7 @@
method public static void assertShape-t2RoSCg(android.graphics.Bitmap, androidx.ui.unit.Density density, androidx.ui.graphics.Shape shape, long shapeColor, long backgroundColor, androidx.ui.graphics.Shape backgroundShape = androidx.ui.graphics.RectangleShapeKt.RectangleShape, float sizeX = width.toFloat(), float sizeY = height.toFloat(), float shapeSizeX = sizeX, float shapeSizeY = sizeY, float centerX = width / 2.0, float centerY = height / 2.0, float shapeOverlapPixelCount = 1.0f);
method public static android.graphics.Bitmap captureToBitmap(androidx.ui.test.SemanticsNodeInteraction);
method public static android.graphics.Bitmap captureToBitmap(android.view.View);
- method public static boolean contains-m3TnucA(androidx.ui.graphics.Path, long offset);
+ method public static boolean contains(androidx.ui.graphics.Path, androidx.ui.geometry.Offset offset);
}
public final class CollectedSizes {
@@ -199,30 +199,30 @@
}
public final class GestureScopeKt {
- method public static androidx.ui.unit.PxPosition getCenter(androidx.ui.test.BaseGestureScope);
+ method public static androidx.ui.geometry.Offset getCenter(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.PxBounds getGlobalBounds(androidx.ui.test.BaseGestureScope);
method public static androidx.ui.unit.IntPxSize getSize(androidx.ui.test.BaseGestureScope);
- method public static androidx.ui.unit.PxPosition localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.unit.PxPosition position);
- method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
+ method public static androidx.ui.geometry.Offset localToGlobal(androidx.ui.test.BaseGestureScope, androidx.ui.geometry.Offset position);
+ method public static void movePointerBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void movePointerTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
method public static void sendCancel(androidx.ui.test.PartialGestureScope);
- method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition position = center);
+ method public static void sendClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDoubleClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendDown(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendLongClick(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset position = center);
method public static void sendMove(androidx.ui.test.PartialGestureScope);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition delta);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.unit.PxPosition position);
- method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.unit.PxPosition position);
- method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start0, androidx.ui.unit.PxPosition end0, androidx.ui.unit.PxPosition start1, androidx.ui.unit.PxPosition end1, androidx.ui.unit.Duration duration = 400.milliseconds);
- method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveBy(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset delta);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, int pointerId, androidx.ui.geometry.Offset position);
+ method public static void sendMoveTo(androidx.ui.test.PartialGestureScope, androidx.ui.geometry.Offset position);
+ method public static void sendPinch(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start0, androidx.ui.geometry.Offset end0, androidx.ui.geometry.Offset start1, androidx.ui.geometry.Offset end1, androidx.ui.unit.Duration duration = 400.milliseconds);
+ method public static void sendSwipe(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendSwipeDown(androidx.ui.test.GestureScope);
method public static void sendSwipeLeft(androidx.ui.test.GestureScope);
method public static void sendSwipeRight(androidx.ui.test.GestureScope);
method public static void sendSwipeUp(androidx.ui.test.GestureScope);
- method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
+ method public static void sendSwipeWithVelocity(androidx.ui.test.GestureScope, androidx.ui.geometry.Offset start, androidx.ui.geometry.Offset end, @FloatRange(from=0.0) float endVelocity, androidx.ui.unit.Duration duration = 200.milliseconds);
method public static void sendUp(androidx.ui.test.PartialGestureScope, int pointerId = 0);
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
index 65a8f4a..a8eb8f3 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/LayoutCoordinatesHelperTest.kt
@@ -27,7 +27,7 @@
import androidx.ui.layout.Column
import androidx.ui.layout.preferredSize
import androidx.ui.layout.preferredWidth
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.dp
import androidx.ui.unit.ipx
import org.junit.Assert.assertEquals
@@ -69,8 +69,8 @@
assertTrue(latch.await(1, TimeUnit.SECONDS))
assertEquals(
- PxPosition.Origin,
- parentCoordinates!!.childToLocal(childCoordinates!!, PxPosition.Origin)
+ Offset.Zero,
+ parentCoordinates!!.childToLocal(childCoordinates!!, Offset.Zero)
)
}
@@ -104,8 +104,8 @@
assertTrue(latch.await(1, TimeUnit.SECONDS))
assertEquals(
- PxPosition(5f, 0f),
- parentCoordinates!!.childToLocal(childCoordinates!!, PxPosition.Origin)
+ Offset(5f, 0f),
+ parentCoordinates!!.childToLocal(childCoordinates!!, Offset.Zero)
)
}
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
index fb07256..dfb2ab0 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendClickTest.kt
@@ -34,7 +34,7 @@
import androidx.ui.test.sendClick
import androidx.ui.test.util.ClickableTestBox
import androidx.ui.test.util.RecordingFilter
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -45,7 +45,7 @@
@RunWith(Parameterized::class)
class SendClickTest(private val config: TestConfig) {
data class TestConfig(
- val position: PxPosition?,
+ val position: Offset?,
val activityClass: Class<out ComponentActivity>
)
@@ -59,8 +59,8 @@
return mutableListOf<TestConfig>().apply {
for (x in listOf(0.0f, squareSize - 1.0f)) {
for (y in listOf(0.0f, squareSize - 1.0f)) {
- add(TestConfig(PxPosition(x, y), ComponentActivity::class.java))
- add(TestConfig(PxPosition(x, y), ActivityWithActionBar::class.java))
+ add(TestConfig(Offset(x, y), ComponentActivity::class.java))
+ add(TestConfig(Offset(x, y), ActivityWithActionBar::class.java))
}
}
add(TestConfig(null, ComponentActivity::class.java))
@@ -71,7 +71,7 @@
private data class ClickData(
val componentIndex: Int,
- val position: PxPosition
+ val position: Offset
)
private class ClickRecorder(
@@ -95,7 +95,7 @@
private val recordedClicks = mutableListOf<ClickData>()
private val expectedClickPosition =
- config.position ?: PxPosition(squareSize / 2, squareSize / 2)
+ config.position ?: Offset(squareSize / 2, squareSize / 2)
@Test
fun testClick() {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
index 4531879..fff7ddc 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendDoubleClickTest.kt
@@ -28,7 +28,7 @@
import androidx.ui.test.util.ClickableTestBox
import androidx.ui.test.util.ClickableTestBox.defaultSize
import androidx.ui.test.util.ClickableTestBox.defaultTag
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -39,7 +39,7 @@
@MediumTest
@RunWith(Parameterized::class)
class SendDoubleClickTest(private val config: TestConfig) {
- data class TestConfig(val position: PxPosition?)
+ data class TestConfig(val position: Offset?)
companion object {
@JvmStatic
@@ -48,7 +48,7 @@
return mutableListOf<TestConfig>().apply {
for (x in listOf(1.0f, 33.0f, 99.0f)) {
for (y in listOf(1.0f, 33.0f, 99.0f)) {
- add(TestConfig(PxPosition(x, y)))
+ add(TestConfig(Offset(x, y)))
}
}
add(TestConfig(null))
@@ -64,11 +64,11 @@
disableDispatchInRealTime = true
)
- private val recordedDoubleClicks = mutableListOf<PxPosition>()
+ private val recordedDoubleClicks = mutableListOf<Offset>()
private val expectedClickPosition =
- config.position ?: PxPosition(defaultSize / 2, defaultSize / 2)
+ config.position ?: Offset(defaultSize / 2, defaultSize / 2)
- private fun recordDoubleClick(position: PxPosition) {
+ private fun recordDoubleClick(position: Offset) {
recordedDoubleClicks.add(position)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
index 4cb42d1..def81a7 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendLongClickTest.kt
@@ -31,7 +31,7 @@
import androidx.ui.test.util.ClickableTestBox.defaultSize
import androidx.ui.test.util.ClickableTestBox.defaultTag
import androidx.ui.test.util.isAlmostEqualTo
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
import org.junit.Test
@@ -46,7 +46,7 @@
@MediumTest
@RunWith(Parameterized::class)
class SendLongClickTest(private val config: TestConfig) {
- data class TestConfig(val position: PxPosition?)
+ data class TestConfig(val position: Offset?)
companion object {
@JvmStatic
@@ -55,7 +55,7 @@
return mutableListOf<TestConfig>().apply {
for (x in listOf(1.0f, defaultSize / 4)) {
for (y in listOf(1.0f, defaultSize / 3)) {
- add(TestConfig(PxPosition(x, y)))
+ add(TestConfig(Offset(x, y)))
}
}
add(TestConfig(null))
@@ -66,11 +66,11 @@
@get:Rule
val composeTestRule = createComposeRule(disableTransitions = true)
- private val recordedLongClicks = mutableListOf<PxPosition>()
+ private val recordedLongClicks = mutableListOf<Offset>()
private val expectedClickPosition =
- config.position ?: PxPosition(defaultSize / 2, defaultSize / 2)
+ config.position ?: Offset(defaultSize / 2, defaultSize / 2)
- private fun recordLongPress(position: PxPosition) {
+ private fun recordLongPress(position: Offset) {
recordedLongClicks.add(position)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
index 08ad767..8b1a4e0 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendPinchTest.kt
@@ -30,7 +30,7 @@
import androidx.ui.test.util.MultiPointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.isMonotonicBetween
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -60,10 +60,10 @@
}
}
- val start0 = PxPosition(40f, 50f)
- val end0 = PxPosition(8f, 50f)
- val start1 = PxPosition(60f, 50f)
- val end1 = PxPosition(92f, 50f)
+ val start0 = Offset(40f, 50f)
+ val end0 = Offset(8f, 50f)
+ val start1 = Offset(60f, 50f)
+ val end1 = Offset(92f, 50f)
val duration = 400.milliseconds
findByTag(TAG).doGesture {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
index 97d662f..4575b06 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/gesturescope/SendSwipeVelocityTest.kt
@@ -37,8 +37,7 @@
import androidx.ui.test.util.isMonotonicBetween
import androidx.ui.test.util.recordedDuration
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
-import androidx.ui.unit.getDistance
+import androidx.ui.geometry.Offset
import androidx.ui.unit.inMilliseconds
import com.google.common.truth.Truth.assertThat
import org.junit.Rule
@@ -61,11 +60,11 @@
val eventPeriod: Long
)
- enum class Direction(val from: PxPosition, val to: PxPosition) {
- LeftToRight(PxPosition(boxStart, boxMiddle), PxPosition(boxEnd, boxMiddle)),
- RightToLeft(PxPosition(boxEnd, boxMiddle), PxPosition(boxStart, boxMiddle)),
- TopToBottom(PxPosition(boxMiddle, boxStart), PxPosition(boxMiddle, boxEnd)),
- BottomToTop(PxPosition(boxMiddle, boxEnd), PxPosition(boxMiddle, boxStart))
+ enum class Direction(val from: Offset, val to: Offset) {
+ LeftToRight(Offset(boxStart, boxMiddle), Offset(boxEnd, boxMiddle)),
+ RightToLeft(Offset(boxEnd, boxMiddle), Offset(boxStart, boxMiddle)),
+ TopToBottom(Offset(boxMiddle, boxStart), Offset(boxMiddle, boxEnd)),
+ BottomToTop(Offset(boxMiddle, boxEnd), Offset(boxMiddle, boxStart))
}
companion object {
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/Common.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/Common.kt
index 268a078..bcd8bb5 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/Common.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/Common.kt
@@ -16,17 +16,17 @@
package androidx.ui.test.inputdispatcher
+import androidx.ui.geometry.Offset
import androidx.ui.test.InputDispatcher
import androidx.ui.test.android.AndroidInputDispatcher
-import androidx.ui.unit.PxPosition
import com.google.common.truth.Truth.assertThat
-internal fun AndroidInputDispatcher.sendDownAndCheck(pointerId: Int, position: PxPosition) {
+internal fun AndroidInputDispatcher.sendDownAndCheck(pointerId: Int, position: Offset) {
sendDown(pointerId, position)
assertThat(getCurrentPosition(pointerId)).isEqualTo(position)
}
-internal fun AndroidInputDispatcher.movePointerAndCheck(pointerId: Int, position: PxPosition) {
+internal fun AndroidInputDispatcher.movePointerAndCheck(pointerId: Int, position: Offset) {
movePointer(pointerId, position)
assertThat(getCurrentPosition(pointerId)).isEqualTo(position)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/DelayTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/DelayTest.kt
index b6bc3ae..7319164 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/DelayTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/DelayTest.kt
@@ -23,7 +23,7 @@
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -55,7 +55,7 @@
}
companion object {
- private val anyPosition = PxPosition.Origin
+ private val anyPosition = Offset.Zero
@JvmStatic
@Parameterized.Parameters(name = "{0}")
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
index 5a7bc27..c7a6aba 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendCancelTest.kt
@@ -20,13 +20,13 @@
import android.view.MotionEvent.ACTION_DOWN
import android.view.MotionEvent.ACTION_POINTER_DOWN
import androidx.test.filters.SmallTest
+import androidx.ui.geometry.Offset
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verifyEvent
import androidx.ui.test.util.verifyPointer
-import androidx.ui.unit.PxPosition
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -44,8 +44,8 @@
private const val pointer2 = 22
// positions (used with corresponding pointerId: pointerX with positionX_Y)
- private val position1_1 = PxPosition(11f, 11f)
- private val position2_1 = PxPosition(21f, 21f)
+ private val position1_1 = Offset(11f, 11f)
+ private val position2_1 = Offset(21f, 21f)
}
private val dispatcherRule = AndroidInputDispatcher.TestRule(disableDispatchInRealTime = true)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
index ca02532..7b876bf 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendClickTest.kt
@@ -22,7 +22,7 @@
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -60,7 +60,7 @@
@get:Rule
val inputDispatcherRule: TestRule = dispatcherRule
- private val position = PxPosition(config.x, config.y)
+ private val position = Offset(config.x, config.y)
private val recorder = MotionEventRecorder()
private val subject = AndroidInputDispatcher(recorder::recordEvent)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
index 9158540..81b0ea2 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendDownTest.kt
@@ -21,13 +21,13 @@
import android.view.MotionEvent.ACTION_POINTER_DOWN
import android.view.MotionEvent.ACTION_POINTER_UP
import androidx.test.filters.SmallTest
+import androidx.ui.geometry.Offset
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verifyEvent
import androidx.ui.test.util.verifyPointer
-import androidx.ui.unit.PxPosition
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -47,13 +47,13 @@
private const val pointer4 = 44
// Positions (mostly used with corresponding pointerId: pointerX with positionX)
- private val position1 = PxPosition(1f, 1f)
- private val position2 = PxPosition(2f, 2f)
- private val position3 = PxPosition(3f, 3f)
- private val position4 = PxPosition(4f, 4f)
+ private val position1 = Offset(1f, 1f)
+ private val position2 = Offset(2f, 2f)
+ private val position3 = Offset(3f, 3f)
+ private val position4 = Offset(4f, 4f)
// Single alternative for pointer1
- private val position1_2 = PxPosition(12f, 12f)
+ private val position1_2 = Offset(12f, 12f)
}
private val dispatcherRule = AndroidInputDispatcher.TestRule(disableDispatchInRealTime = true)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
index e4a9484..c3c573f 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendMoveTest.kt
@@ -28,7 +28,7 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verifyEvent
import androidx.ui.test.util.verifyPointer
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -47,14 +47,14 @@
private const val pointer3 = 33
// positions (used with corresponding pointerId: pointerX with positionX_Y)
- private val position1_1 = PxPosition(11f, 11f)
- private val position2_1 = PxPosition(21f, 21f)
- private val position3_1 = PxPosition(31f, 31f)
+ private val position1_1 = Offset(11f, 11f)
+ private val position2_1 = Offset(21f, 21f)
+ private val position3_1 = Offset(31f, 31f)
- private val position1_2 = PxPosition(12f, 12f)
- private val position2_2 = PxPosition(22f, 22f)
+ private val position1_2 = Offset(12f, 12f)
+ private val position2_2 = Offset(22f, 22f)
- private val position1_3 = PxPosition(13f, 13f)
+ private val position1_3 = Offset(13f, 13f)
}
private val dispatcherRule = AndroidInputDispatcher.TestRule(disableDispatchInRealTime = true)
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
index ffd3ead..f7b4ead 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeLineTest.kt
@@ -25,8 +25,8 @@
import androidx.ui.test.util.moveEvents
import androidx.ui.test.util.splitsDurationEquallyInto
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.milliseconds
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -49,8 +49,8 @@
)
companion object {
- private val start = PxPosition(5f, 7f)
- private val end = PxPosition(23f, 29f)
+ private val start = Offset(5f, 7f)
+ private val end = Offset(23f, 29f)
@JvmStatic
@Parameterized.Parameters(name = "{0}")
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt
index a3441dc..b69b16a 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithDurationTest.kt
@@ -20,12 +20,12 @@
import android.view.MotionEvent.ACTION_MOVE
import android.view.MotionEvent.ACTION_UP
import androidx.test.filters.SmallTest
+import androidx.ui.geometry.Offset
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.verify
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -53,7 +53,7 @@
companion object {
private val curve = { t: Long ->
- PxPosition(t.toFloat(), (-t).toFloat())
+ Offset(t.toFloat(), (-t).toFloat())
}
@JvmStatic
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt
index 8e7d131..3b2432c 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesAndEventPeriodTest.kt
@@ -19,6 +19,7 @@
import android.view.MotionEvent.ACTION_DOWN
import android.view.MotionEvent.ACTION_UP
import androidx.test.filters.SmallTest
+import androidx.ui.geometry.Offset
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.util.MotionEventRecorder
import androidx.ui.test.util.assertHasValidEventTimes
@@ -29,7 +30,6 @@
import androidx.ui.test.util.splitsDurationEquallyInto
import androidx.ui.test.util.verify
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import com.google.common.truth.Truth.assertThat
import org.junit.After
@@ -65,7 +65,7 @@
companion object {
private val curve = { t: Long ->
- PxPosition(t.toFloat(), (-t).toFloat())
+ Offset(t.toFloat(), (-t).toFloat())
}
@JvmStatic
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt
index 15646c9..13379bc 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendSwipeWithKeyTimesTest.kt
@@ -25,7 +25,6 @@
import androidx.ui.test.util.assertHasValidEventTimes
import androidx.ui.test.util.verify
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
@@ -55,7 +54,7 @@
companion object {
private val curve = { t: Long ->
- PxPosition(t.toFloat(), (-t).toFloat())
+ androidx.ui.geometry.Offset(t.toFloat(), (-t).toFloat())
}
@JvmStatic
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
index ad3bd69..95f1e95 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/inputdispatcher/SendUpTest.kt
@@ -27,7 +27,7 @@
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verifyEvent
import androidx.ui.test.util.verifyPointer
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.After
import org.junit.Rule
@@ -45,8 +45,8 @@
private const val pointer2 = 22
// positions (used with corresponding pointerId: pointerX with positionX_Y)
- private val position1_1 = PxPosition(11f, 11f)
- private val position2_1 = PxPosition(21f, 21f)
+ private val position1_1 = Offset(11f, 11f)
+ private val position2_1 = Offset(21f, 21f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
index 25fe407..40c0df0 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendCancelTest.kt
@@ -29,7 +29,7 @@
import androidx.ui.test.util.MultiPointerInputRecorder
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.expectError
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -42,8 +42,8 @@
@MediumTest
class SendCancelTest {
companion object {
- private val downPosition1 = PxPosition(10f, 10f)
- private val downPosition2 = PxPosition(20f, 20f)
+ private val downPosition1 = Offset(10f, 10f)
+ private val downPosition2 = Offset(20f, 20f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
index b4aa5d1..3ae7a1b 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendDownTest.kt
@@ -28,7 +28,7 @@
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -41,8 +41,8 @@
@MediumTest
class SendDownTest {
companion object {
- private val position1 = PxPosition(5f, 5f)
- private val position2 = PxPosition(7f, 7f)
+ private val position1 = Offset(5f, 5f)
+ private val position2 = Offset(7f, 7f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
index 32bf84b..20894e8 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveByTest.kt
@@ -33,7 +33,7 @@
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
import org.junit.Before
@@ -47,10 +47,10 @@
@MediumTest
class SendMoveByTest {
companion object {
- private val downPosition1 = PxPosition(10f, 10f)
- private val downPosition2 = PxPosition(20f, 20f)
- private val delta1 = PxPosition(11f, 11f)
- private val delta2 = PxPosition(21f, 21f)
+ private val downPosition1 = Offset(10f, 10f)
+ private val downPosition2 = Offset(20f, 20f)
+ private val delta1 = Offset(11f, 11f)
+ private val delta2 = Offset(21f, 21f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveTest.kt
index 8c3fb88..4d7b032 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveTest.kt
@@ -26,7 +26,7 @@
import androidx.ui.test.sendUp
import androidx.ui.test.util.ClickableTestBox
import androidx.ui.test.util.expectError
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -38,7 +38,7 @@
@MediumTest
class SendMoveTest() {
companion object {
- private val downPosition1 = PxPosition(10f, 10f)
+ private val downPosition1 = Offset(10f, 10f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
index 91baaca..c71d822 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendMoveToTest.kt
@@ -33,7 +33,7 @@
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.milliseconds
import com.google.common.truth.Truth.assertThat
import org.junit.Before
@@ -47,10 +47,10 @@
@MediumTest
class SendMoveToTest() {
companion object {
- private val downPosition1 = PxPosition(10f, 10f)
- private val downPosition2 = PxPosition(20f, 20f)
- private val moveToPosition1 = PxPosition(11f, 11f)
- private val moveToPosition2 = PxPosition(21f, 21f)
+ private val downPosition1 = Offset(10f, 10f)
+ private val downPosition2 = Offset(20f, 20f)
+ private val moveToPosition1 = Offset(11f, 11f)
+ private val moveToPosition2 = Offset(21f, 21f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
index dc99005..38cdceb 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/partialgesturescope/SendUpTest.kt
@@ -31,7 +31,7 @@
import androidx.ui.test.util.assertTimestampsAreIncreasing
import androidx.ui.test.util.expectError
import androidx.ui.test.util.verify
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -44,8 +44,8 @@
@MediumTest
class SendUpTest {
companion object {
- private val downPosition1 = PxPosition(10f, 10f)
- private val downPosition2 = PxPosition(20f, 20f)
+ private val downPosition1 = Offset(10f, 10f)
+ private val downPosition2 = Offset(20f, 20f)
}
@get:Rule
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
index 3764a54..8a47c046 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/MotionEvents.kt
@@ -17,7 +17,7 @@
package androidx.ui.test.util
import android.view.MotionEvent
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import kotlin.math.abs
@@ -54,7 +54,7 @@
}
internal fun MotionEvent.verify(
- curve: (Long) -> PxPosition,
+ curve: (Long) -> Offset,
expectedAction: Int,
expectedRelativeTime: Long
) {
@@ -65,7 +65,7 @@
}
internal fun MotionEvent.verify(
- expectedPosition: PxPosition,
+ expectedPosition: Offset,
expectedAction: Int,
expectedRelativeTime: Long
) {
@@ -87,7 +87,7 @@
internal fun MotionEvent.verifyPointer(
expectedPointerId: Int,
- expectedPosition: PxPosition
+ expectedPosition: Offset
) {
var index = -1
for (i in 0 until pointerCount) {
@@ -111,7 +111,7 @@
/**
* Checks that the coordinates are progressing in a monotonous direction
*/
-fun List<MotionEvent>.isMonotonicBetween(start: PxPosition, end: PxPosition) {
+fun List<MotionEvent>.isMonotonicBetween(start: Offset, end: Offset) {
map { it.x }.isMonotonicBetween(start.x, end.x, 1e-6f)
map { it.y }.isMonotonicBetween(start.y, end.y, 1e-6f)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
index 2837bf5..52acf8b 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/PointerInputs.kt
@@ -23,9 +23,9 @@
import androidx.ui.core.gesture.util.VelocityTracker
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.pointerinput.PointerInputModifier
+import androidx.ui.geometry.Offset
import androidx.ui.unit.Duration
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
import androidx.ui.unit.Uptime
import com.google.common.truth.Truth.assertThat
@@ -125,7 +125,7 @@
expectedTimestamp: Uptime?,
expectedId: PointerId?,
expectedDown: Boolean,
- expectedPosition: PxPosition
+ expectedPosition: Offset
) {
if (expectedTimestamp != null) {
assertThat(timestamp).isEqualTo(expectedTimestamp)
@@ -140,7 +140,7 @@
/**
* Checks that the coordinates are progressing in a monotonous direction
*/
-fun List<DataPoint>.isMonotonicBetween(start: PxPosition, end: PxPosition) {
+fun List<DataPoint>.isMonotonicBetween(start: Offset, end: Offset) {
map { it.x }.isMonotonicBetween(start.x, end.x, 1e-3f)
map { it.y }.isMonotonicBetween(start.y, end.y, 1e-3f)
}
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
index ab6d5b3..1cc2dea 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/util/Truth.kt
@@ -16,7 +16,7 @@
package androidx.ui.test.util
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.collect.Ordering
import com.google.common.truth.FloatSubject
import com.google.common.truth.Truth.assertThat
@@ -31,10 +31,10 @@
}
/**
- * Verifies that the [PxPosition] is equal to the given position with some tolerance. The default
+ * Verifies that the [Offset] is equal to the given position with some tolerance. The default
* tolerance is 0.001.
*/
-fun PxPosition.isAlmostEqualTo(position: PxPosition, tolerance: Float = 1e-3f) {
+fun Offset.isAlmostEqualTo(position: Offset, tolerance: Float = 1e-3f) {
assertThat(x).isAlmostEqualTo(position.x, tolerance)
assertThat(y).isAlmostEqualTo(position.y, tolerance)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
index 1f1ceb8..b3a4257 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/Actions.kt
@@ -20,7 +20,7 @@
import androidx.ui.semantics.AccessibilityAction
import androidx.ui.semantics.SemanticsActions
import androidx.ui.semantics.SemanticsPropertyKey
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* Performs a click action on the given component.
@@ -66,7 +66,7 @@
"No Layout Node found!"
)
- val position = layoutNode.coordinates.localToGlobal(PxPosition(0.0f, 0.0f))
+ val position = layoutNode.coordinates.localToGlobal(Offset(0.0f, 0.0f))
runOnUiThread {
scrollableSemanticsNode.config[SemanticsActions.ScrollTo].action(
@@ -113,7 +113,7 @@
*
* Example usage:
* ```
- * val position = PxPosition(10.px, 10.px)
+ * val position = Offset(10f, 10f)
* findByTag("myWidget")
* .doPartialGesture { sendDown(position) }
* .assertHasClickAction()
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt b/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
index 8d65ad2..2cd3a56 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/BitmapHelpers.kt
@@ -129,10 +129,10 @@
fun Path.contains(offset: Offset): Boolean {
val path = android.graphics.Path()
path.addRect(
- offset.dx - 0.01f,
- offset.dy - 0.01f,
- offset.dx + 0.01f,
- offset.dy + 0.01f,
+ offset.x - 0.01f,
+ offset.y - 0.01f,
+ offset.x + 0.01f,
+ offset.y + 0.01f,
android.graphics.Path.Direction.CW
)
if (path.op(asAndroidPath(), android.graphics.Path.Op.INTERSECT)) {
@@ -281,14 +281,14 @@
val centerY = shapeSizeY / 2f
val d = delta
val x = when {
- offset.dx > centerX -> offset.dx - d
- offset.dx < centerX -> offset.dx + d
- else -> offset.dx
+ offset.x > centerX -> offset.x - d
+ offset.x < centerX -> offset.x + d
+ else -> offset.x
}
val y = when {
- offset.dy > centerY -> offset.dy - d
- offset.dy < centerY -> offset.dy + d
- else -> offset.dy
+ offset.y > centerY -> offset.y - d
+ offset.y < centerY -> offset.y + d
+ else -> offset.y
}
return Offset(x, y)
}
@@ -303,14 +303,14 @@
val centerY = shapeSizeY / 2f
val d = delta
val x = when {
- offset.dx > centerX -> offset.dx + d
- offset.dx < centerX -> offset.dx - d
- else -> offset.dx
+ offset.x > centerX -> offset.x + d
+ offset.x < centerX -> offset.x - d
+ else -> offset.x
}
val y = when {
- offset.dy > centerY -> offset.dy + d
- offset.dy < centerY -> offset.dy - d
- else -> offset.dy
+ offset.y > centerY -> offset.y + d
+ offset.y < centerY -> offset.y - d
+ else -> offset.y
}
return Offset(x, y)
}
\ No newline at end of file
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
index 152f7d9..e62f3f8 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/GestureScope.kt
@@ -22,7 +22,8 @@
import androidx.ui.unit.Duration
import androidx.ui.unit.IntPxSize
import androidx.ui.unit.PxBounds
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import androidx.ui.util.lerp
@@ -80,9 +81,9 @@
* Returns the center of the component we're interacting with, in the component's local
* coordinate system, where (0.px, 0.px) is the top left corner of the component.
*/
-val BaseGestureScope.center: PxPosition
+val BaseGestureScope.center: Offset
get() {
- return PxPosition(size.width / 2, size.height / 2)
+ return Offset(size.width.value / 2f, size.height.value / 2f)
}
/**
@@ -96,9 +97,9 @@
*
* @param position A position in local coordinates
*/
-fun BaseGestureScope.localToGlobal(position: PxPosition): PxPosition {
+fun BaseGestureScope.localToGlobal(position: Offset): Offset {
val bounds = globalBounds
- return position + PxPosition(bounds.left, bounds.top)
+ return position + Offset(bounds.left, bounds.top)
}
/**
@@ -130,7 +131,7 @@
* @param position The position where to click, in the component's local coordinate system. If
* omitted, the center position will be used.
*/
-fun GestureScope.sendClick(position: PxPosition = center) {
+fun GestureScope.sendClick(position: Offset = center) {
inputDispatcher.sendClick(localToGlobal(position))
}
@@ -145,7 +146,7 @@
* @param position The position of the long click, in the component's local coordinate system. If
* omitted, the center position will be used.
*/
-fun GestureScope.sendLongClick(position: PxPosition = center) {
+fun GestureScope.sendLongClick(position: Offset = center) {
// Keep down for 100ms more than needed, to allow the long press logic to trigger
sendSwipe(position, position, LongPressTimeout + 100.milliseconds)
}
@@ -160,7 +161,7 @@
* @param position The position of the double click, in the component's local coordinate system.
* If omitted, the center position will be used.
*/
-fun GestureScope.sendDoubleClick(position: PxPosition = center) {
+fun GestureScope.sendDoubleClick(position: Offset = center) {
val globalPosition = localToGlobal(position)
inputDispatcher.sendClick(globalPosition)
inputDispatcher.delay(doubleClickDelay)
@@ -180,8 +181,8 @@
* @param duration The duration of the gesture
*/
fun GestureScope.sendSwipe(
- start: PxPosition,
- end: PxPosition,
+ start: Offset,
+ end: Offset,
duration: Duration = 200.milliseconds
) {
val globalStart = localToGlobal(start)
@@ -192,7 +193,7 @@
/**
* Performs a pinch gesture on the associated component.
*
- * For each pair of start and end [PxPosition]s, the motion events are linearly interpolated. The
+ * For each pair of start and end [Offset]s, the motion events are linearly interpolated. The
* coordinates are in the component's local coordinate system where (0.px, 0.px) is the top left
* corner of the component. The default duration is 400 milliseconds.
*
@@ -203,10 +204,10 @@
* @param duration the duration of the gesture
*/
fun GestureScope.sendPinch(
- start0: PxPosition,
- end0: PxPosition,
- start1: PxPosition,
- end1: PxPosition,
+ start0: Offset,
+ end0: Offset,
+ start1: Offset,
+ end1: Offset,
duration: Duration = 400.milliseconds
) {
val globalStart0 = localToGlobal(start0)
@@ -216,9 +217,9 @@
val durationFloat = duration.inMilliseconds().toFloat()
inputDispatcher.sendSwipes(
- listOf<(Long) -> PxPosition>(
- { androidx.ui.unit.lerp(globalStart0, globalEnd0, it / durationFloat) },
- { androidx.ui.unit.lerp(globalStart1, globalEnd1, it / durationFloat) }
+ listOf<(Long) -> Offset>(
+ { lerp(globalStart0, globalEnd0, it / durationFloat) },
+ { lerp(globalStart1, globalEnd1, it / durationFloat) }
),
duration
)
@@ -243,8 +244,8 @@
* are generated, which happens with a duration of 25ms or more.
*/
fun GestureScope.sendSwipeWithVelocity(
- start: PxPosition,
- end: PxPosition,
+ start: Offset,
+ end: Offset,
@FloatRange(from = 0.0) endVelocity: Float,
duration: Duration = 200.milliseconds
) {
@@ -280,7 +281,7 @@
val fx = createFunctionForVelocity(durationMs, globalStart.x, globalEnd.x, vx)
val fy = createFunctionForVelocity(durationMs, globalStart.y, globalEnd.y, vy)
- inputDispatcher.sendSwipe({ t -> PxPosition(fx(t), fy(t)) }, duration)
+ inputDispatcher.sendSwipe({ t -> Offset(fx(t), fy(t)) }, duration)
}
/**
@@ -293,8 +294,8 @@
val x = center.x
val y0 = (size.height * (1 - edgeFuzzFactor)).value.toFloat()
val y1 = 0.0f
- val start = PxPosition(x, y0)
- val end = PxPosition(x, y1)
+ val start = Offset(x, y0)
+ val end = Offset(x, y1)
sendSwipe(start, end, 200.milliseconds)
}
@@ -308,8 +309,8 @@
val x = center.x
val y0 = (size.height * edgeFuzzFactor).value.toFloat()
val y1 = size.height.value.toFloat()
- val start = PxPosition(x, y0)
- val end = PxPosition(x, y1)
+ val start = Offset(x, y0)
+ val end = Offset(x, y1)
sendSwipe(start, end, 200.milliseconds)
}
@@ -323,8 +324,8 @@
val x0 = (size.width * (1 - edgeFuzzFactor)).value.toFloat()
val x1 = 0.0f
val y = center.y
- val start = PxPosition(x0, y)
- val end = PxPosition(x1, y)
+ val start = Offset(x0, y)
+ val end = Offset(x1, y)
sendSwipe(start, end, 200.milliseconds)
}
@@ -338,8 +339,8 @@
val x0 = (size.width * edgeFuzzFactor).value.toFloat()
val x1 = size.width.value.toFloat()
val y = center.y
- val start = PxPosition(x0, y)
- val end = PxPosition(x1, y)
+ val start = Offset(x0, y)
+ val end = Offset(x1, y)
sendSwipe(start, end, 200.milliseconds)
}
@@ -413,7 +414,7 @@
*
* Example usage:
* ```
- * val position = PxPosition(10.px, 10.px)
+ * val position = Offset(10.px, 10.px)
* findByTag("myWidget")
* .doPartialGesture { sendDown(position) }
* .assertIsDisplayed()
@@ -459,7 +460,7 @@
* @param pointerId The id of the pointer, can be any number not yet in use by another pointer
* @param position The position of the down event, in the component's local coordinate system
*/
-fun PartialGestureScope.sendDown(pointerId: Int, position: PxPosition) {
+fun PartialGestureScope.sendDown(pointerId: Int, position: Offset) {
val globalPosition = localToGlobal(position)
inputDispatcher.sendDown(pointerId, globalPosition)
}
@@ -475,7 +476,7 @@
*
* @param position The position of the down event, in the component's local coordinate system
*/
-fun PartialGestureScope.sendDown(position: PxPosition) {
+fun PartialGestureScope.sendDown(position: Offset) {
sendDown(0, position)
}
@@ -489,7 +490,7 @@
* @param pointerId The id of the pointer to move, as supplied in [sendDown]
* @param position The new position of the pointer, in the component's local coordinate system
*/
-fun PartialGestureScope.sendMoveTo(pointerId: Int, position: PxPosition) {
+fun PartialGestureScope.sendMoveTo(pointerId: Int, position: Offset) {
movePointerTo(pointerId, position)
sendMove()
}
@@ -503,7 +504,7 @@
*
* @param position The new position of the pointer, in the component's local coordinate system
*/
-fun PartialGestureScope.sendMoveTo(position: PxPosition) {
+fun PartialGestureScope.sendMoveTo(position: Offset) {
sendMoveTo(0, position)
}
@@ -518,7 +519,7 @@
* @param pointerId The id of the pointer to move, as supplied in [sendDown]
* @param position The new position of the pointer, in the component's local coordinate system
*/
-fun PartialGestureScope.movePointerTo(pointerId: Int, position: PxPosition) {
+fun PartialGestureScope.movePointerTo(pointerId: Int, position: Offset) {
val globalPosition = localToGlobal(position)
inputDispatcher.movePointer(pointerId, globalPosition)
}
@@ -531,10 +532,10 @@
*
* @param pointerId The id of the pointer to move, as supplied in [sendDown]
* @param delta The position for this move event, relative to the last sent position of the
- * pointer. For example, `delta = PxPosition(10.px, -10.px) will add 10.px to the pointer's last
+ * pointer. For example, `delta = Offset(10.px, -10.px) will add 10.px to the pointer's last
* x-position, and subtract 10.px from the pointer's last y-position.
*/
-fun PartialGestureScope.sendMoveBy(pointerId: Int, delta: PxPosition) {
+fun PartialGestureScope.sendMoveBy(pointerId: Int, delta: Offset) {
movePointerBy(pointerId, delta)
sendMove()
}
@@ -546,10 +547,10 @@
* If the pointer is not yet down, an [IllegalArgumentException] will be thrown.
*
* @param delta The position for this move event, relative to the last sent position of the
- * pointer. For example, `delta = PxPosition(10.px, -10.px) will add 10.px to the pointer's last
+ * pointer. For example, `delta = Offset(10.px, -10.px) will add 10.px to the pointer's last
* x-position, and subtract 10.px from the pointer's last y-position.
*/
-fun PartialGestureScope.sendMoveBy(delta: PxPosition) {
+fun PartialGestureScope.sendMoveBy(delta: Offset) {
sendMoveBy(0, delta)
}
@@ -561,13 +562,13 @@
*
* @param pointerId The id of the pointer to move, as supplied in [sendDown]
* @param delta The position for this move event, relative to the last sent position of the
- * pointer. For example, `delta = PxPosition(10.px, -10.px) will add 10.px to the pointer's last
+ * pointer. For example, `delta = Offset(10.px, -10.px) will add 10.px to the pointer's last
* x-position, and subtract 10.px from the pointer's last y-position.
*/
-fun PartialGestureScope.movePointerBy(pointerId: Int, delta: PxPosition) {
+fun PartialGestureScope.movePointerBy(pointerId: Int, delta: Offset) {
// Ignore currentPosition of null here, let movePointer generate the error
val globalPosition =
- (inputDispatcher.getCurrentPosition(pointerId) ?: PxPosition.Origin) + delta
+ (inputDispatcher.getCurrentPosition(pointerId) ?: Offset.Zero) + delta
inputDispatcher.movePointer(pointerId, globalPosition)
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/InputDispatcher.kt b/ui/ui-test/src/main/java/androidx/ui/test/InputDispatcher.kt
index 9b7606c..b0ce05a 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/InputDispatcher.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/InputDispatcher.kt
@@ -22,7 +22,8 @@
import androidx.ui.test.android.AndroidInputDispatcher
import androidx.ui.test.android.AndroidOwnerRegistry
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.lerp
import java.util.WeakHashMap
@@ -86,7 +87,7 @@
*
* @param position The coordinate of the click
*/
- fun sendClick(position: PxPosition) {
+ fun sendClick(position: Offset) {
sendDown(0, position)
sendMove()
sendUp(0)
@@ -100,7 +101,7 @@
* @param end The end position of the gesture
* @param duration The duration of the gesture
*/
- fun sendSwipe(start: PxPosition, end: PxPosition, duration: Duration) {
+ fun sendSwipe(start: Offset, end: Offset, duration: Duration) {
val durationFloat = duration.inMilliseconds().toFloat()
sendSwipe(
curve = { lerp(start, end, it / durationFloat) },
@@ -120,7 +121,7 @@
* be sampled
*/
fun sendSwipe(
- curve: (Long) -> PxPosition,
+ curve: (Long) -> Offset,
duration: Duration,
keyTimes: List<Long> = emptyList()
) {
@@ -140,7 +141,7 @@
* be sampled
*/
fun sendSwipes(
- curves: List<(Long) -> PxPosition>,
+ curves: List<(Long) -> Offset>,
duration: Duration,
keyTimes: List<Long> = emptyList()
)
@@ -167,7 +168,7 @@
* @return The current position of the pointer with the given [pointerId], or `null` if the
* pointer is not currently in use
*/
- fun getCurrentPosition(pointerId: Int): PxPosition?
+ fun getCurrentPosition(pointerId: Int): Offset?
/**
* Sends a down event at [position] for the pointer with the given [pointerId], starting a
@@ -202,7 +203,7 @@
* @see sendUp
* @see sendCancel
*/
- fun sendDown(pointerId: Int, position: PxPosition)
+ fun sendDown(pointerId: Int, position: Offset)
/**
* Updates the position of the pointer with the given [pointerId] to the given [position],
@@ -221,7 +222,7 @@
* @see sendUp
* @see sendCancel
*/
- fun movePointer(pointerId: Int, position: PxPosition)
+ fun movePointer(pointerId: Int, position: Offset)
/**
* Sends a move event 10 milliseconds after the previous injected event of this gesture,
@@ -288,8 +289,8 @@
val partialGesture: PartialGesture?
)
-internal class PartialGesture(val downTime: Long, startPosition: PxPosition, pointerId: Int) {
+internal class PartialGesture(val downTime: Long, startPosition: Offset, pointerId: Int) {
var lastEventTime: Long = downTime
- val lastPositions = SparseArrayCompat<PxPosition>().apply { put(pointerId, startPosition) }
+ val lastPositions = SparseArrayCompat<Offset>().apply { put(pointerId, startPosition) }
var hasPointerUpdates: Boolean = false
}
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
index 42c915a..59de9f6 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidInputDispatcher.kt
@@ -30,7 +30,7 @@
import androidx.ui.test.InputDispatcherState
import androidx.ui.test.PartialGesture
import androidx.ui.unit.Duration
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.inMilliseconds
import androidx.ui.unit.milliseconds
import androidx.ui.util.lerp
@@ -118,11 +118,11 @@
sleepUntil(nextDownTime)
}
- override fun getCurrentPosition(pointerId: Int): PxPosition? {
+ override fun getCurrentPosition(pointerId: Int): Offset? {
return partialGesture?.lastPositions?.get(pointerId)
}
- override fun sendDown(pointerId: Int, position: PxPosition) {
+ override fun sendDown(pointerId: Int, position: Offset) {
var gesture = partialGesture
// Check if this pointer is not already down
@@ -149,7 +149,7 @@
}
// Move 1 pointer and don't send a move event
- override fun movePointer(pointerId: Int, position: PxPosition) {
+ override fun movePointer(pointerId: Int, position: Offset) {
val gesture = partialGesture
// Check if this pointer is in the gesture
@@ -258,7 +258,7 @@
}
override fun sendSwipes(
- curves: List<(Long) -> PxPosition>,
+ curves: List<(Long) -> Offset>,
duration: Duration,
keyTimes: List<Long>
) {
@@ -314,7 +314,7 @@
* @param tN The end time of this segment of the swipe, in milliseconds relative to downTime
*/
private fun sendPartialSwipes(
- fs: List<(Long) -> PxPosition>,
+ fs: List<(Long) -> Offset>,
t0: Long,
tN: Long
) {
@@ -343,7 +343,7 @@
eventTime: Long,
action: Int,
actionIndex: Int,
- coordinates: List<PxPosition>,
+ coordinates: List<Offset>,
pointerIds: List<Int>
) {
sleepUntil(eventTime)
diff --git a/ui/ui-text-core/api/0.1.0-dev14.txt b/ui/ui-text-core/api/0.1.0-dev14.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/0.1.0-dev14.txt
+++ b/ui/ui-text-core/api/0.1.0-dev14.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/api/current.txt b/ui/ui-text-core/api/current.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/current.txt
+++ b/ui/ui-text-core/api/current.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-text-core/api/public_plus_experimental_0.1.0-dev14.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-text-core/api/public_plus_experimental_0.1.0-dev14.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/api/public_plus_experimental_current.txt b/ui/ui-text-core/api/public_plus_experimental_current.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/public_plus_experimental_current.txt
+++ b/ui/ui-text-core/api/public_plus_experimental_current.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/api/restricted_0.1.0-dev14.txt b/ui/ui-text-core/api/restricted_0.1.0-dev14.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-text-core/api/restricted_0.1.0-dev14.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/api/restricted_current.txt b/ui/ui-text-core/api/restricted_current.txt
index 30f064a..981c016 100644
--- a/ui/ui-text-core/api/restricted_current.txt
+++ b/ui/ui-text-core/api/restricted_current.txt
@@ -339,7 +339,7 @@
method public float getMaxIntrinsicWidth();
method public int getMaxLines();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -396,7 +396,7 @@
method public float getLineWidth(int lineIndex);
method public float getMaxIntrinsicWidth();
method public float getMinIntrinsicWidth();
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
@@ -578,7 +578,7 @@
method public int getLineForOffset(int offset);
method public int getLineStart(int lineIndex);
method public float getLineTop(int lineIndex);
- method public int getOffsetForPosition(androidx.ui.unit.PxPosition position);
+ method public int getOffsetForPosition(androidx.ui.geometry.Offset position);
method public androidx.ui.text.style.TextDirection getParagraphDirection(int offset);
method public androidx.ui.graphics.Path getPathForRange(int start, int end);
method public java.util.List<androidx.ui.geometry.Rect> getPlaceholderRects();
diff --git a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/MultiParagraphIntegrationTest.kt b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/MultiParagraphIntegrationTest.kt
index 1b09373..34e0e0a 100644
--- a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/MultiParagraphIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/MultiParagraphIntegrationTest.kt
@@ -29,7 +29,7 @@
import androidx.ui.text.style.TextDirectionAlgorithm
import androidx.ui.text.style.TextIndent
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.TextUnit
import androidx.ui.unit.em
import androidx.ui.unit.sp
@@ -224,7 +224,7 @@
val x = fontSizeInPx * col
val actualOffset = paragraph.getOffsetForPosition(
- PxPosition(x.toFloat(), y.toFloat())
+ Offset(x.toFloat(), y.toFloat())
)
assertWithMessage("getOffsetForPosition($x, $y) failed")
.that(actualOffset).isEqualTo(i)
diff --git a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/ParagraphIntegrationTest.kt b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/ParagraphIntegrationTest.kt
index 7eba737..c99024a 100644
--- a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/ParagraphIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/ParagraphIntegrationTest.kt
@@ -18,7 +18,6 @@
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
import androidx.test.platform.app.InstrumentationRegistry
-import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Color
@@ -41,7 +40,7 @@
import androidx.ui.text.style.TextGeometricTransform
import androidx.ui.text.style.TextIndent
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.em
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
@@ -226,7 +225,7 @@
// test positions that are 1, fontSize+1, 2fontSize+1 which maps to chars 0, 1, 2 ...
for (i in 0..text.length) {
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage("offset at index $i, position $position does not match")
.that(offset).isEqualTo(i)
@@ -248,7 +247,7 @@
// test positions that are 1, fontSize+1, 2fontSize+1 which maps to chars .., 2, 1, 0
for (i in 0..text.length) {
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage("offset at index $i, position $position does not match")
.that(offset).isEqualTo(text.length - i)
@@ -273,7 +272,7 @@
// test positions are 1, fontSize+1, 2fontSize+1 and always on the second line
// which maps to chars 3, 4, 5
for (i in 0..secondLine.length) {
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage(
"offset at index $i, position $position, second line does not match"
@@ -299,7 +298,7 @@
// test positions are 1, fontSize+1, 2fontSize+1 and always on the second line
// which maps to chars 5, 4, 3
for (i in 0..secondLine.length) {
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx * 1.5f))
val offset = paragraph.getOffsetForPosition(position)
assertWithMessage(
"offset at index $i, position $position, second line does not match"
@@ -321,12 +320,12 @@
)
// greater than width
- var position = PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx / 2))
+ var position = Offset((fontSizeInPx * text.length * 2), (fontSizeInPx / 2))
var offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isEqualTo(text.length)
// negative
- position = PxPosition((-1 * fontSizeInPx), (fontSizeInPx / 2))
+ position = Offset((-1 * fontSizeInPx), (fontSizeInPx / 2))
offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
}
@@ -345,12 +344,12 @@
)
// greater than height
- var position = PxPosition((fontSizeInPx / 2), (fontSizeInPx * text.length * 2))
+ var position = Offset((fontSizeInPx / 2), (fontSizeInPx * text.length * 2))
var offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
// negative
- position = PxPosition((fontSizeInPx / 2), (-1 * fontSizeInPx))
+ position = Offset((fontSizeInPx / 2), (-1 * fontSizeInPx))
offset = paragraph.getOffsetForPosition(position)
assertThat(offset).isZero()
}
@@ -2208,7 +2207,7 @@
)
// The position of the last character in display order.
- val position = PxPosition(("a.".length * fontSizeInPx + 1), (fontSizeInPx / 2))
+ val position = Offset(("a.".length * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(2)
}
@@ -2232,7 +2231,7 @@
)
// The position of the first character in display order.
- val position = PxPosition((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
+ val position = Offset((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(2)
}
@@ -2254,7 +2253,7 @@
for (i in 0..text.length) {
// The position of the i-th character in display order.
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(i)
}
@@ -2277,7 +2276,7 @@
for (i in text.indices) {
// The position of the i-th character in display order.
- val position = PxPosition((i * fontSizeInPx + 1), (fontSizeInPx / 2))
+ val position = Offset((i * fontSizeInPx + 1), (fontSizeInPx / 2))
val charIndex = paragraph.getOffsetForPosition(position)
assertThat(charIndex).isEqualTo(i)
}
@@ -2299,7 +2298,7 @@
)
// The first character in display order should be '.'
- val position = PxPosition((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
+ val position = Offset((fontSizeInPx / 2 + 1), (fontSizeInPx / 2))
val index = paragraph.getOffsetForPosition(position)
assertThat(index).isEqualTo(2)
}
@@ -3117,7 +3116,7 @@
// This position should point to the first character 'a' if indent is applied.
// Otherwise this position will point to the second character 'b'.
- val position = PxPosition((indentInPx + 1), (fontSizeInPx / 2))
+ val position = Offset((indentInPx + 1), (fontSizeInPx / 2))
// The offset corresponding to the position should be the first char 'a'.
assertThat(paragraph.getOffsetForPosition(position)).isZero()
}
diff --git a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/TextLayoutResultIntegrationTest.kt b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/TextLayoutResultIntegrationTest.kt
index 9052592..a10c47a 100644
--- a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/TextLayoutResultIntegrationTest.kt
+++ b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/TextLayoutResultIntegrationTest.kt
@@ -25,7 +25,7 @@
import androidx.ui.text.font.asFontFamily
import androidx.ui.text.matchers.isZero
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
@@ -133,7 +133,7 @@
)
val layoutResult = textDelegate.layout(Constraints(), layoutDirection)
- val selection = layoutResult.getOffsetForPosition(PxPosition.Origin)
+ val selection = layoutResult.getOffsetForPosition(Offset.Zero)
assertThat(selection).isZero()
}
@@ -159,7 +159,7 @@
val layoutResult = textDelegate.layout(Constraints(), layoutDirection)
val selection = layoutResult.getOffsetForPosition(
- position = PxPosition((fontSize.toPx() * characterIndex + 1), 0f)
+ position = Offset((fontSize.toPx() * characterIndex + 1), 0f)
)
assertThat(selection).isEqualTo(characterIndex)
diff --git a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/platform/AndroidParagraphTest.kt b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/platform/AndroidParagraphTest.kt
index 7e5abe6..ee50ea5 100644
--- a/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/platform/AndroidParagraphTest.kt
+++ b/ui/ui-text-core/src/androidAndroidTest/kotlin/androidx/ui/text/platform/AndroidParagraphTest.kt
@@ -638,8 +638,8 @@
assertThat(paragraph.charSequence)
.hasSpan(ShadowSpan::class, start = 0, end = text.length) {
return@hasSpan it.color == color.toArgb() &&
- it.offsetX == offset.dx &&
- it.offsetY == offset.dy &&
+ it.offsetX == offset.x &&
+ it.offsetY == offset.y &&
it.radius == radius
}
}
@@ -671,15 +671,15 @@
assertThat(paragraph.charSequence)
.hasSpan(ShadowSpan::class, start = 0, end = text.length) {
return@hasSpan it.color == color.toArgb() &&
- it.offsetX == offset.dx &&
- it.offsetY == offset.dy &&
+ it.offsetX == offset.x &&
+ it.offsetY == offset.y &&
it.radius == radius
}
assertThat(paragraph.charSequence)
.hasSpanOnTop(ShadowSpan::class, start = 0, end = "abc".length) {
return@hasSpanOnTop it.color == colorOverwrite.toArgb() &&
- it.offsetX == offsetOverwrite.dx &&
- it.offsetY == offsetOverwrite.dy &&
+ it.offsetX == offsetOverwrite.x &&
+ it.offsetY == offsetOverwrite.y &&
it.radius == radiusOverwrite
}
}
diff --git a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
index 261a210..e461889 100644
--- a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
+++ b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
@@ -46,7 +46,7 @@
import androidx.ui.text.style.TextAlign
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import java.util.Locale as JavaLocale
/**
@@ -207,7 +207,7 @@
internal val textPaint: TextPaint
get() = paragraphIntrinsics.textPaint
- override fun getOffsetForPosition(position: PxPosition): Int {
+ override fun getOffsetForPosition(position: Offset): Int {
val line = layout.getLineForVertical(position.y.toInt())
return layout.getOffsetForHorizontal(line, position.x)
}
diff --git a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphHelper.kt b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphHelper.kt
index 2617f0d..db229da 100644
--- a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphHelper.kt
+++ b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphHelper.kt
@@ -122,8 +122,8 @@
style.shadow?.let {
setShadowLayer(
it.blurRadius,
- it.offset.dx,
- it.offset.dy,
+ it.offset.x,
+ it.offset.y,
it.color.toArgb()
)
}
@@ -419,7 +419,7 @@
}
style.shadow?.let {
spannableString.setSpan(
- ShadowSpan(it.color.toArgb(), it.offset.dx, it.offset.dy, it.blurRadius),
+ ShadowSpan(it.color.toArgb(), it.offset.x, it.offset.y, it.blurRadius),
start,
end,
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE
diff --git a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/MultiParagraph.kt b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/MultiParagraph.kt
index ebe528c..61ac1fe 100644
--- a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/MultiParagraph.kt
+++ b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/MultiParagraph.kt
@@ -16,14 +16,13 @@
package androidx.ui.text
-import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
import androidx.ui.graphics.Canvas
import androidx.ui.graphics.Path
import androidx.ui.text.font.Font
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.util.fastForEach
import kotlin.math.max
@@ -266,7 +265,7 @@
}
/** Returns the character offset closest to the given graphical position. */
- fun getOffsetForPosition(position: PxPosition): Int {
+ fun getOffsetForPosition(position: Offset): Int {
val paragraphIndex = when {
position.y <= 0f -> 0
position.y >= height -> paragraphInfoList.lastIndex
@@ -694,11 +693,11 @@
}
/**
- * Convert a [PxPosition] relative to the parent [MultiParagraph] to the local [PxPosition]
+ * Convert a [Offset] relative to the parent [MultiParagraph] to the local [Offset]
* relative to the [paragraph].
*/
- fun PxPosition.toLocal(): PxPosition {
- return PxPosition(x = x, y = y - top)
+ fun Offset.toLocal(): Offset {
+ return Offset(x, y - top)
}
/**
@@ -706,7 +705,7 @@
* [MultiParagraph].
*/
fun Rect.toGlobal(): Rect {
- return shift(Offset(dx = 0f, dy = this@ParagraphInfo.top))
+ return shift(Offset(0f, this@ParagraphInfo.top))
}
/**
@@ -716,7 +715,7 @@
* Notice that this function changes the input value.
*/
fun Path.toGlobal(): Path {
- shift(Offset(dx = 0f, dy = top))
+ shift(Offset(0f, top))
return this
}
diff --git a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/Paragraph.kt b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/Paragraph.kt
index 63cf68c..8f03d73 100644
--- a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/Paragraph.kt
+++ b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/Paragraph.kt
@@ -22,7 +22,7 @@
import androidx.ui.text.platform.ActualParagraph
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
internal const val DefaultMaxLines = Int.MAX_VALUE
@@ -202,7 +202,7 @@
fun getBidiRunDirection(offset: Int): TextDirection
/** Returns the character offset closest to the given graphical position. */
- fun getOffsetForPosition(position: PxPosition): Int
+ fun getOffsetForPosition(position: Offset): Int
/**
* Returns the bounding box as Rect of the character for given character offset. Rect
diff --git a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/TextLayoutResult.kt b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/TextLayoutResult.kt
index 8df36d1..8705878 100644
--- a/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/TextLayoutResult.kt
+++ b/ui/ui-text-core/src/commonMain/kotlin/androidx/ui/text/TextLayoutResult.kt
@@ -25,7 +25,7 @@
import androidx.ui.text.style.TextOverflow
import androidx.ui.unit.Density
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* The data class which holds the set of parameters of the text layout computation.
@@ -235,7 +235,7 @@
* @param position a graphical position in this text layout
* @return a character offset that is closest to the given graphical position.
*/
- fun getOffsetForPosition(position: PxPosition): Int =
+ fun getOffsetForPosition(position: Offset): Int =
multiParagraph.getOffsetForPosition(position)
/**
diff --git a/ui/ui-text/api/0.1.0-dev14.txt b/ui/ui-text/api/0.1.0-dev14.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/0.1.0-dev14.txt
+++ b/ui/ui-text/api/0.1.0-dev14.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/api/current.txt b/ui/ui-text/api/current.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/current.txt
+++ b/ui/ui-text/api/current.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-text/api/public_plus_experimental_0.1.0-dev14.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-text/api/public_plus_experimental_0.1.0-dev14.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/api/public_plus_experimental_current.txt b/ui/ui-text/api/public_plus_experimental_current.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/public_plus_experimental_current.txt
+++ b/ui/ui-text/api/public_plus_experimental_current.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/api/restricted_0.1.0-dev14.txt b/ui/ui-text/api/restricted_0.1.0-dev14.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-text/api/restricted_0.1.0-dev14.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/api/restricted_current.txt b/ui/ui-text/api/restricted_current.txt
index c9a485d..360e16b 100644
--- a/ui/ui-text/api/restricted_current.txt
+++ b/ui/ui-text/api/restricted_current.txt
@@ -31,7 +31,7 @@
method public static void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public static void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public static int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public static void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public static void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
field public static final androidx.ui.text.TextFieldDelegate.Companion! Companion;
}
@@ -42,7 +42,7 @@
method public void notifyFocusedRect(androidx.ui.input.EditorValue value, androidx.ui.text.TextDelegate textDelegate, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.core.LayoutCoordinates layoutCoordinates, androidx.ui.input.TextInputService textInputService, int token, boolean hasFocus, androidx.ui.input.OffsetMap offsetMap);
method public void onBlur(androidx.ui.input.TextInputService? textInputService, int token, androidx.ui.input.EditProcessor editProcessor, boolean hasNextClient, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange);
method public int onFocus(androidx.ui.input.TextInputService? textInputService, androidx.ui.input.EditorValue value, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.KeyboardType keyboardType, androidx.ui.input.ImeAction imeAction, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, kotlin.jvm.functions.Function1<? super androidx.ui.input.ImeAction,kotlin.Unit> onImeActionPerformed);
- method public void onRelease(androidx.ui.unit.PxPosition position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
+ method public void onRelease(androidx.ui.geometry.Offset position, androidx.ui.text.TextLayoutResult textLayoutResult, androidx.ui.input.EditProcessor editProcessor, androidx.ui.input.OffsetMap offsetMap, kotlin.jvm.functions.Function1<? super androidx.ui.input.EditorValue,kotlin.Unit> onValueChange, androidx.ui.input.TextInputService? textInputService, int token, boolean hasFocus);
}
public final class TextFieldDelegateKt {
diff --git a/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt b/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
index da8b09f..ec4a427 100644
--- a/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
+++ b/ui/ui-text/src/androidTest/java/androidx/ui/text/selection/TextSelectionDelegateTest.kt
@@ -42,7 +42,7 @@
import androidx.ui.text.font.test.R
import androidx.ui.text.style.TextDirection
import androidx.ui.unit.Density
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.TextUnit
import androidx.ui.unit.sp
import com.google.common.truth.Truth.assertThat
@@ -122,7 +122,7 @@
)
// Assert.
- assertThat(coordinates).isEqualTo(PxPosition.Origin)
+ assertThat(coordinates).isEqualTo(Offset.Zero)
}
}
}
@@ -179,7 +179,7 @@
)
// Assert.
- assertThat(coordinates).isEqualTo(PxPosition.Origin)
+ assertThat(coordinates).isEqualTo(Offset.Zero)
}
}
}
@@ -232,7 +232,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * startOffset), fontSizeInPx)
+ Offset((fontSizeInPx * startOffset), fontSizeInPx)
)
}
}
@@ -286,7 +286,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * startOffset), fontSizeInPx)
+ Offset((fontSizeInPx * startOffset), fontSizeInPx)
)
}
}
@@ -340,7 +340,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
)
}
}
@@ -394,7 +394,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length - 1 - startOffset)), fontSizeInPx)
)
}
}
@@ -450,7 +450,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length)), fontSizeInPx)
)
}
}
@@ -506,7 +506,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (textLtr.length)), fontSizeInPx)
+ Offset((fontSizeInPx * (textLtr.length)), fontSizeInPx)
)
}
}
@@ -560,7 +560,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * endOffset), fontSizeInPx)
+ Offset((fontSizeInPx * endOffset), fontSizeInPx)
)
}
}
@@ -614,7 +614,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * endOffset), fontSizeInPx)
+ Offset((fontSizeInPx * endOffset), fontSizeInPx)
)
}
}
@@ -668,7 +668,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
)
}
}
@@ -722,7 +722,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length - 1 - endOffset)), fontSizeInPx)
)
}
}
@@ -778,7 +778,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (textLtr.length)), fontSizeInPx)
+ Offset((fontSizeInPx * (textLtr.length)), fontSizeInPx)
)
}
}
@@ -834,7 +834,7 @@
// Assert.
assertThat(coordinates).isEqualTo(
- PxPosition((fontSizeInPx * (text.length)), fontSizeInPx)
+ Offset((fontSizeInPx * (text.length)), fontSizeInPx)
)
}
}
@@ -1009,7 +1009,7 @@
density = defaultDensity
)
- val start = PxPosition((fontSizeInPx * 2), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * 2), (fontSizeInPx / 2))
val end = start
// Act.
@@ -1048,7 +1048,7 @@
density = defaultDensity
)
- val start = PxPosition((fontSizeInPx * 2), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * 2), (fontSizeInPx / 2))
val end = start
// Act.
@@ -1089,8 +1089,8 @@
val rawStartOffset = text.indexOf('e')
val rawEndOffset = text.indexOf('r')
- val start = PxPosition((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1132,8 +1132,8 @@
val rawStartOffset = text.indexOf('r')
val rawEndOffset = text.indexOf('e')
- val start = PxPosition((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * rawStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * rawEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1177,8 +1177,8 @@
// "llo wor" is selected.
val startOffset = text.indexOf("l")
val endOffset = text.indexOf("r") + 1
- val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1221,11 +1221,11 @@
// "\u05D1\u05D2 \u05D3" is selected.
val startOffset = text.indexOf("\u05D1")
val endOffset = text.indexOf("\u05D3") + 1
- val start = PxPosition(
+ val start = Offset(
(fontSizeInPx * (text.length - 1 - startOffset)),
(fontSizeInPx / 2)
)
- val end = PxPosition(
+ val end = Offset(
(fontSizeInPx * (text.length - 1 - endOffset)),
(fontSizeInPx / 2)
)
@@ -1273,11 +1273,11 @@
// "llo"+"\u05D0\u05D1\u05D2" is selected
val startOffset = text.indexOf("l")
val endOffset = text.indexOf("\u05D2") + 1
- val start = PxPosition(
+ val start = Offset(
(fontSizeInPx * startOffset),
(fontSizeInPx / 2)
)
- val end = PxPosition(
+ val end = Offset(
(fontSizeInPx * (textLtr.length + text.length - endOffset)),
(fontSizeInPx / 2)
)
@@ -1321,8 +1321,8 @@
// "llo wor" is selected.
val startOffset = text.indexOf("r") + 1
val endOffset = text.indexOf("l")
- val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
selectionCoordinates = Pair(start, end),
@@ -1362,11 +1362,11 @@
// "\u05D1\u05D2 \u05D3" is selected.
val startOffset = text.indexOf("\u05D3") + 1
val endOffset = text.indexOf("\u05D1")
- val start = PxPosition(
+ val start = Offset(
(fontSizeInPx * (text.length - 1 - startOffset)),
(fontSizeInPx / 2)
)
- val end = PxPosition(
+ val end = Offset(
(fontSizeInPx * (text.length - 1 - endOffset)),
(fontSizeInPx / 2)
)
@@ -1412,11 +1412,11 @@
// "llo"+"\u05D0\u05D1\u05D2" is selected
val startOffset = text.indexOf("\u05D2") + 1
val endOffset = text.indexOf("l")
- val start = PxPosition(
+ val start = Offset(
(fontSizeInPx * (textLtr.length + text.length - startOffset)),
(fontSizeInPx / 2)
)
- val end = PxPosition(
+ val end = Offset(
(fontSizeInPx * endOffset),
(fontSizeInPx / 2)
)
@@ -1475,8 +1475,8 @@
handlesCrossed = false
)
// "l" is selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1531,11 +1531,11 @@
handlesCrossed = false
)
// "\u05D1" is selected.
- val start = PxPosition(
+ val start = Offset(
(fontSizeInPx * (text.length - 1 - oldStartOffset)),
(fontSizeInPx / 2)
)
- val end = PxPosition(
+ val end = Offset(
(fontSizeInPx * (text.length - 1 - oldStartOffset)),
(fontSizeInPx / 2)
)
@@ -1593,8 +1593,8 @@
handlesCrossed = false
)
// The Space after "o" is selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1650,8 +1650,8 @@
handlesCrossed = true
)
// "l" is selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1707,8 +1707,8 @@
handlesCrossed = false
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1754,8 +1754,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1801,9 +1801,9 @@
handlesCrossed = false
)
// "d" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset) - (fontSizeInPx / 2),
+ val start = Offset((fontSizeInPx * oldEndOffset) - (fontSizeInPx / 2),
(fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset) - 1,
+ val end = Offset((fontSizeInPx * oldEndOffset) - 1,
(fontSizeInPx / 2))
// Act.
@@ -1850,8 +1850,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldEndOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1897,8 +1897,8 @@
handlesCrossed = true
)
// The space after "o" is selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -1954,8 +1954,8 @@
handlesCrossed = false
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2001,8 +2001,8 @@
handlesCrossed = true
)
// "e" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val start = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * oldStartOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2048,9 +2048,9 @@
handlesCrossed = false
)
// "h" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset),
+ val start = Offset((fontSizeInPx * oldStartOffset),
(fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset),
+ val end = Offset((fontSizeInPx * oldStartOffset),
(fontSizeInPx / 2))
// Act.
@@ -2097,9 +2097,9 @@
handlesCrossed = true
)
// "d" should be selected.
- val start = PxPosition((fontSizeInPx * oldStartOffset) - 1,
+ val start = Offset((fontSizeInPx * oldStartOffset) - 1,
(fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * oldStartOffset) - 1,
+ val end = Offset((fontSizeInPx * oldStartOffset) - 1,
(fontSizeInPx / 2))
// Act.
@@ -2130,8 +2130,8 @@
)
// "hello w" is selected.
val endOffset = text.indexOf("w") + 1
- val start = PxPosition(-50f, -50f)
- val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
+ val start = Offset(-50f, -50f)
+ val end = Offset((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2170,8 +2170,8 @@
)
// "o world" is selected.
val startOffset = text.indexOf("o")
- val start = PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
- val end = PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx * 2)
+ val start = Offset((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = Offset((fontSizeInPx * text.length * 2), (fontSizeInPx * 2)
)
// Act.
@@ -2212,8 +2212,8 @@
// "world" is selected.
val endOffset = text.indexOf("w")
val start =
- PxPosition((fontSizeInPx * text.length * 2), (fontSizeInPx * 2))
- val end = PxPosition((fontSizeInPx * endOffset), (fontSizeInPx / 2))
+ Offset((fontSizeInPx * text.length * 2), (fontSizeInPx * 2))
+ val end = Offset((fontSizeInPx * endOffset), (fontSizeInPx / 2))
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2254,8 +2254,8 @@
// "hell" is selected.
val startOffset = text.indexOf("o")
val start =
- PxPosition((fontSizeInPx * startOffset), (fontSizeInPx / 2))
- val end = PxPosition(-50f, -50f)
+ Offset((fontSizeInPx * startOffset), (fontSizeInPx / 2))
+ val end = Offset(-50f, -50f)
// Act.
val textSelectionInfo = getTextSelectionInfo(
@@ -2292,8 +2292,8 @@
fontSize = fontSize,
density = defaultDensity
)
- val start = PxPosition(-50f, -50f)
- val end = PxPosition(-20f, -20f)
+ val start = Offset(-50f, -50f)
+ val end = Offset(-20f, -20f)
// Act.
val textSelectionInfo = getTextSelectionInfo(
selectionCoordinates = Pair(start, end),
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
index bd7bcf8..c01ff02 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/CoreText.kt
@@ -44,7 +44,7 @@
import androidx.ui.text.style.TextOverflow
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.unit.min
@@ -209,7 +209,7 @@
maxHeight = floor(it.height).toInt().ipx
)
),
- PxPosition(it.left, it.top)
+ Offset(it.left, it.top)
)
}
}
@@ -299,7 +299,7 @@
/** The latest TextLayoutResult calculated in the measure block */
var layoutResult: TextLayoutResult? = null
/** The global position calculated during the last onPositioned callback */
- var previousGlobalPosition: PxPosition = PxPosition.Origin
+ var previousGlobalPosition: Offset = Offset.Zero
/** The paint used to draw highlight background for selected text. */
val selectionPaint: Paint = Paint().apply {
isAntiAlias = true
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt b/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
index 4dab6a0..6ea0dab 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/CoreTextField.kt
@@ -48,7 +48,7 @@
import androidx.ui.input.VisualTransformation
import androidx.ui.semantics.Semantics
import androidx.ui.semantics.onClick
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import kotlin.math.roundToInt
@@ -269,8 +269,8 @@
*/
@Composable
private fun TextInputEventObserver(
- onPress: (PxPosition) -> Unit,
- onRelease: (PxPosition) -> Unit,
+ onPress: (Offset) -> Unit,
+ onRelease: (Offset) -> Unit,
onFocus: () -> Unit,
onBlur: (hasNextClient: Boolean) -> Unit,
focusModifier: FocusModifier,
@@ -333,15 +333,15 @@
* Helper class for tracking dragging event.
*/
internal class DragEventTracker {
- private var origin = PxPosition.Origin
- private var distance = PxPosition.Origin
+ private var origin = Offset.Zero
+ private var distance = Offset.Zero
/**
* Restart the tracking from given origin.
*
* @param origin The origin of the drag gesture.
*/
- fun init(origin: PxPosition) {
+ fun init(origin: Offset) {
this.origin = origin
}
@@ -350,7 +350,7 @@
*
* @param distance The distance from the origin of the drag origin.
*/
- fun onDrag(distance: PxPosition) {
+ fun onDrag(distance: Offset) {
this.distance = distance
}
@@ -359,7 +359,7 @@
*
* @return The position of the current drag point.
*/
- fun getPosition(): PxPosition {
+ fun getPosition(): Offset {
return origin + distance
}
}
@@ -369,8 +369,8 @@
*/
@Composable
private fun Modifier.dragPositionGestureFilter(
- onPress: (PxPosition) -> Unit,
- onRelease: (PxPosition) -> Unit
+ onPress: (Offset) -> Unit,
+ onRelease: (Offset) -> Unit
): Modifier {
val tracker = state { DragEventTracker() }
// TODO(shepshapard): PressIndicator doesn't seem to be the right thing to use here. It
@@ -387,9 +387,9 @@
})
.dragGestureFilter(dragObserver = object :
DragObserver {
- override fun onDrag(dragDistance: PxPosition): PxPosition {
+ override fun onDrag(dragDistance: Offset): Offset {
tracker.value.onDrag(dragDistance)
- return PxPosition.Origin
+ return Offset.Zero
}
})
}
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
index e480ac7..997e5dc 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/TextFieldDelegate.kt
@@ -40,7 +40,7 @@
import androidx.ui.text.style.TextDirectionAlgorithm
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import kotlin.math.ceil
import kotlin.math.roundToInt
@@ -182,7 +182,7 @@
)
Rect(0f, 0f, 1.0f, lineHeightForEmptyText.value.toFloat())
}
- val globalLT = layoutCoordinates.localToRoot(PxPosition(bbox.left, bbox.top))
+ val globalLT = layoutCoordinates.localToRoot(Offset(bbox.left, bbox.top))
textInputService.notifyFocusedRect(
token,
@@ -225,7 +225,7 @@
*/
@JvmStatic
fun onRelease(
- position: PxPosition,
+ position: Offset,
textLayoutResult: TextLayoutResult,
editProcessor: EditProcessor,
offsetMap: OffsetMap,
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
index 11a5626..a29172f 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/SelectionMode.kt
@@ -17,7 +17,7 @@
package androidx.ui.text.selection
import androidx.ui.geometry.Rect
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
/**
* The enum class allows user to decide the selection mode.
@@ -31,8 +31,8 @@
Vertical {
override fun isSelected(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean {
// When the end of the selection is above the top of the composable, the composable is outside
// of the selection range.
@@ -55,8 +55,8 @@
override fun areHandlesCrossed(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean {
if (start.y >= bounds.top && start.y < bounds.bottom &&
end.y >= bounds.top && end.y < bounds.bottom
@@ -80,8 +80,8 @@
Horizontal {
override fun isSelected(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean {
// When the end of the selection is on the left of the composable, the composable is outside of
// the selection range.
@@ -104,8 +104,8 @@
override fun areHandlesCrossed(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean {
if (start.x >= bounds.left && start.x < bounds.right &&
end.x >= bounds.left && end.x < bounds.right
@@ -131,8 +131,8 @@
*/
internal abstract fun isSelected(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean
/**
@@ -146,7 +146,7 @@
*/
internal abstract fun areHandlesCrossed(
bounds: Rect,
- start: PxPosition,
- end: PxPosition
+ start: Offset,
+ end: Offset
): Boolean
}
diff --git a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
index 5702621..49d5857 100644
--- a/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
+++ b/ui/ui-text/src/main/java/androidx/ui/text/selection/TextSelectionDelegate.kt
@@ -19,12 +19,11 @@
import androidx.ui.core.LayoutCoordinates
import androidx.ui.core.selection.Selectable
import androidx.ui.core.selection.Selection
-import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
import androidx.ui.text.AnnotatedString
import androidx.ui.text.TextLayoutResult
import androidx.ui.text.TextRange
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import kotlin.math.max
internal class TextSelectionDelegate(
@@ -33,8 +32,8 @@
private val layoutResultCallback: () -> TextLayoutResult?
) : Selectable {
override fun getSelection(
- startPosition: PxPosition,
- endPosition: PxPosition,
+ startPosition: Offset,
+ endPosition: Offset,
containerLayoutCoordinates: LayoutCoordinates,
longPress: Boolean,
previousSelection: Selection?,
@@ -44,7 +43,7 @@
val textLayoutResult = layoutResultCallback() ?: return null
val relativePosition = containerLayoutCoordinates.childToLocal(
- layoutCoordinates, PxPosition.Origin
+ layoutCoordinates, Offset.Zero
)
val startPx = startPosition - relativePosition
val endPx = endPosition - relativePosition
@@ -67,16 +66,16 @@
}
}
- override fun getHandlePosition(selection: Selection, isStartHandle: Boolean): PxPosition {
+ override fun getHandlePosition(selection: Selection, isStartHandle: Boolean): Offset {
// Check if the selection handles's selectable is the current selectable.
if (isStartHandle && selection.start.selectable != this ||
!isStartHandle && selection.end.selectable != this) {
- return PxPosition.Origin
+ return Offset.Zero
}
- if (getLayoutCoordinates() == null) return PxPosition.Origin
+ if (getLayoutCoordinates() == null) return Offset.Zero
- val textLayoutResult = layoutResultCallback() ?: return PxPosition.Origin
+ val textLayoutResult = layoutResultCallback() ?: return Offset.Zero
return getSelectionHandleCoordinates(
textLayoutResult = textLayoutResult,
offset = if (isStartHandle) selection.start.offset else selection.end.offset,
@@ -125,7 +124,7 @@
*/
internal fun getTextSelectionInfo(
textLayoutResult: TextLayoutResult,
- selectionCoordinates: Pair<PxPosition, PxPosition>,
+ selectionCoordinates: Pair<Offset, Offset>,
selectable: Selectable,
wordBasedSelection: Boolean,
previousSelection: Selection? = null,
@@ -211,8 +210,8 @@
rawEndOffset: Int,
containsWholeSelectionStart: Boolean,
containsWholeSelectionEnd: Boolean,
- startPosition: PxPosition,
- endPosition: PxPosition,
+ startPosition: Offset,
+ endPosition: Offset,
bounds: Rect,
textLayoutResult: TextLayoutResult,
lastOffset: Int,
@@ -365,8 +364,8 @@
* crossed each other.
*/
private fun processCrossComposable(
- startPosition: PxPosition,
- endPosition: PxPosition,
+ startPosition: Offset,
+ endPosition: Offset,
rawStartOffset: Int,
rawEndOffset: Int,
lastOffset: Int,
@@ -511,7 +510,7 @@
offset: Int,
isStart: Boolean,
areHandlesCrossed: Boolean
-): PxPosition {
+): Offset {
val line = textLayoutResult.getLineForOffset(offset)
val offsetToCheck =
if (isStart && !areHandlesCrossed || !isStart && areHandlesCrossed) offset
@@ -525,5 +524,5 @@
)
val y = textLayoutResult.getLineBottom(line)
- return PxPosition(x, y)
+ return Offset(x, y)
}
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
index 80cabf9..e1980c0 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/DragEventTrackerTest.kt
@@ -16,7 +16,7 @@
package androidx.ui.text
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@@ -28,38 +28,38 @@
fun test_not_moving() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10f, 20f))
- assertEquals(PxPosition(10f, 20f), tracker.getPosition())
+ tracker.init(Offset(10f, 20f))
+ assertEquals(Offset(10f, 20f), tracker.getPosition())
}
@Test
fun test_drag_one_distance() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10f, 20f))
- tracker.onDrag(PxPosition(30f, 40f))
- assertEquals(PxPosition(40f, 60f), tracker.getPosition())
+ tracker.init(Offset(10f, 20f))
+ tracker.onDrag(Offset(30f, 40f))
+ assertEquals(Offset(40f, 60f), tracker.getPosition())
}
@Test
fun test_drag_two_distance() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10f, 20f))
- tracker.onDrag(PxPosition(30f, 40f))
- tracker.onDrag(PxPosition(50f, 60f))
- assertEquals(PxPosition(60f, 80f), tracker.getPosition())
+ tracker.init(Offset(10f, 20f))
+ tracker.onDrag(Offset(30f, 40f))
+ tracker.onDrag(Offset(50f, 60f))
+ assertEquals(Offset(60f, 80f), tracker.getPosition())
}
@Test
fun test_drag_twice() {
val tracker = DragEventTracker()
- tracker.init(PxPosition(10f, 20f))
- tracker.onDrag(PxPosition(30f, 40f))
+ tracker.init(Offset(10f, 20f))
+ tracker.onDrag(Offset(30f, 40f))
- tracker.init(PxPosition(50f, 60f))
- tracker.onDrag(PxPosition(70f, 80f))
- assertEquals(PxPosition(120f, 140f), tracker.getPosition())
+ tracker.init(Offset(50f, 60f))
+ tracker.onDrag(Offset(70f, 80f))
+ assertEquals(Offset(120f, 140f), tracker.getPosition())
}
}
\ No newline at end of file
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
index 6a70d3e..1f28e94 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/TextFieldDelegateTest.kt
@@ -37,7 +37,7 @@
import androidx.ui.text.style.TextDecoration
import androidx.ui.unit.Density
import androidx.ui.unit.IntPxSize
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import androidx.ui.unit.ipx
import com.google.common.truth.Truth.assertThat
import com.nhaarman.mockitokotlin2.any
@@ -110,7 +110,7 @@
@Test
fun test_on_release() {
- val position = PxPosition(100f, 200f)
+ val position = Offset(100f, 200f)
val offset = 10
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -145,7 +145,7 @@
@Test
fun test_on_release_do_not_place_cursor_if_focus_is_out() {
- val position = PxPosition(100f, 200f)
+ val position = Offset(100f, 200f)
val offset = 10
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -229,7 +229,7 @@
fun notify_focused_rect() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
- val dummyPoint = PxPosition(5f, 6f)
+ val dummyPoint = Offset(5f, 6f)
whenever(layoutCoordinates.localToRoot(any())).thenReturn(dummyPoint)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -267,7 +267,7 @@
fun notify_rect_tail() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
- val dummyPoint = PxPosition(5f, 6f)
+ val dummyPoint = Offset(5f, 6f)
whenever(layoutCoordinates.localToRoot(any())).thenReturn(dummyPoint)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(12, 12))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
@@ -314,7 +314,7 @@
@Test
fun check_notify_rect_uses_offset_map() {
val dummyRect = Rect(0f, 1f, 2f, 3f)
- val dummyPoint = PxPosition(5f, 6f)
+ val dummyPoint = Offset(5f, 6f)
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 3))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
whenever(textLayoutResult.getBoundingBox(any())).thenReturn(dummyRect)
@@ -336,7 +336,7 @@
@Test
fun check_on_release_uses_offset_map() {
- val position = PxPosition(100f, 200f)
+ val position = Offset(100f, 200f)
val offset = 10
val dummyEditorState = EditorValue(text = "Hello, World", selection = TextRange(1, 1))
val dummyInputSessionToken = 10 // We are not using this value in this test. Just dummy.
diff --git a/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt b/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
index f015172..93c6389 100644
--- a/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
+++ b/ui/ui-text/src/test/java/androidx/ui/text/selection/SelectionModeTest.kt
@@ -18,7 +18,7 @@
import androidx.test.filters.SmallTest
import androidx.ui.geometry.Rect
-import androidx.ui.unit.PxPosition
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,8 +46,8 @@
@Test
fun isSelected_Vertical_contains_start_return_true() {
- val start = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -56,8 +56,8 @@
@Test
fun isSelected_Vertical_contains_end_return_true() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -66,8 +66,8 @@
@Test
fun isSelected_Vertical_contains_start_and_end_return_true() {
- val start = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
- val end = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val start = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val end = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -76,8 +76,8 @@
@Test
fun isSelected_Vertical_smaller_than_top_return_false() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = largerThanRight, y = smallerThanTop)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = largerThanRight, y = smallerThanTop)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -86,8 +86,8 @@
@Test
fun isSelected_Vertical_larger_than_bottom_return_false() {
- val start = PxPosition(x = smallerThanLeft, y = largerThanBottom)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = smallerThanLeft, y = largerThanBottom)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -96,8 +96,8 @@
@Test
fun isSelected_Vertical_same_row_smaller_than_left_return_false() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = smallerThanLeft, y = betweenTopAndBottom)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = smallerThanLeft, y = betweenTopAndBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -106,8 +106,8 @@
@Test
fun isSelected_Vertical_same_row_larger_than_right_return_false() {
- val start = PxPosition(x = largerThanRight, y = betweenTopAndBottom)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = largerThanRight, y = betweenTopAndBottom)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Vertical.isSelected(bounds = bounds, start = start, end = end)
@@ -116,8 +116,8 @@
@Test
fun isSelected_Horizontal_contains_start_return_true() {
- val start = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -126,8 +126,8 @@
@Test
fun isSelected_Horizontal_contains_end_return_true() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -136,8 +136,8 @@
@Test
fun isSelected_Horizontal_contains_start_and_end_return_true() {
- val start = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
- val end = PxPosition(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val start = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
+ val end = Offset(x = betweenLeftAndRight, y = betweenTopAndBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -146,8 +146,8 @@
@Test
fun isSelected_Horizontal_smaller_than_left_return_false() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = smallerThanLeft, y = largerThanBottom)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = smallerThanLeft, y = largerThanBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -156,8 +156,8 @@
@Test
fun isSelected_Horizontal_larger_than_right_return_false() {
- val start = PxPosition(x = largerThanRight, y = smallerThanTop)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = largerThanRight, y = smallerThanTop)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -166,8 +166,8 @@
@Test
fun isSelected_Horizontal_same_column_smaller_than_top_return_false() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = betweenLeftAndRight, y = smallerThanTop)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = betweenLeftAndRight, y = smallerThanTop)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -176,8 +176,8 @@
@Test
fun isSelected_Horizontal_same_column_larger_than_bottom_return_false() {
- val start = PxPosition(x = betweenLeftAndRight, y = largerThanBottom)
- val end = PxPosition(x = largerThanRight, y = largerThanBottom)
+ val start = Offset(x = betweenLeftAndRight, y = largerThanBottom)
+ val end = Offset(x = largerThanRight, y = largerThanBottom)
val result = SelectionMode.Horizontal.isSelected(bounds = bounds, start = start, end = end)
@@ -186,8 +186,8 @@
@Test
fun areHandlesCrossed_Vertical_same_row_not_crossed() {
- val start = PxPosition(x = smallerThanLeft, y = betweenTopAndBottom)
- val end = PxPosition(x = largerThanRight, y = betweenTopAndBottom)
+ val start = Offset(x = smallerThanLeft, y = betweenTopAndBottom)
+ val end = Offset(x = largerThanRight, y = betweenTopAndBottom)
val result =
SelectionMode.Vertical.areHandlesCrossed(
@@ -200,8 +200,8 @@
@Test
fun areHandlesCrossed_Vertical_same_row_crossed() {
- val start = PxPosition(x = largerThanRight, y = betweenTopAndBottom)
- val end = PxPosition(x = smallerThanLeft, y = betweenTopAndBottom)
+ val start = Offset(x = largerThanRight, y = betweenTopAndBottom)
+ val end = Offset(x = smallerThanLeft, y = betweenTopAndBottom)
val result =
SelectionMode.Vertical.areHandlesCrossed(
@@ -214,8 +214,8 @@
@Test
fun areHandlesCrossed_Vertical_different_rows_not_crossed() {
- val start = PxPosition(x = smallerThanLeft, y = smallerThanTop)
- val end = PxPosition(x = smallerThanLeft, y = largerThanBottom)
+ val start = Offset(x = smallerThanLeft, y = smallerThanTop)
+ val end = Offset(x = smallerThanLeft, y = largerThanBottom)
val result =
SelectionMode.Vertical.areHandlesCrossed(
@@ -228,8 +228,8 @@
@Test
fun areHandlesCrossed_Vertical_different_rows_crossed() {
- val start = PxPosition(x = smallerThanLeft, y = largerThanBottom)
- val end = PxPosition(x = largerThanRight, y = smallerThanTop)
+ val start = Offset(x = smallerThanLeft, y = largerThanBottom)
+ val end = Offset(x = largerThanRight, y = smallerThanTop)
val result =
SelectionMode.Vertical.areHandlesCrossed(
@@ -242,8 +242,8 @@
@Test
fun areHandlesCrossed_Horizontal_same_column_not_crossed() {
- val start = PxPosition(x = betweenLeftAndRight, y = smallerThanTop)
- val end = PxPosition(x = betweenLeftAndRight, y = largerThanBottom)
+ val start = Offset(x = betweenLeftAndRight, y = smallerThanTop)
+ val end = Offset(x = betweenLeftAndRight, y = largerThanBottom)
val result =
SelectionMode.Horizontal.areHandlesCrossed(
@@ -256,8 +256,8 @@
@Test
fun areHandlesCrossed_Horizontal_same_column_crossed() {
- val start = PxPosition(x = betweenLeftAndRight, y = largerThanBottom)
- val end = PxPosition(x = betweenLeftAndRight, y = smallerThanTop)
+ val start = Offset(x = betweenLeftAndRight, y = largerThanBottom)
+ val end = Offset(x = betweenLeftAndRight, y = smallerThanTop)
val result =
SelectionMode.Horizontal.areHandlesCrossed(
@@ -270,8 +270,8 @@
@Test
fun areHandlesCrossed_Horizontal_different_columns_not_crossed() {
- val start = PxPosition(x = smallerThanLeft, y = largerThanBottom)
- val end = PxPosition(x = largerThanRight, y = smallerThanTop)
+ val start = Offset(x = smallerThanLeft, y = largerThanBottom)
+ val end = Offset(x = largerThanRight, y = smallerThanTop)
val result =
SelectionMode.Horizontal.areHandlesCrossed(
@@ -284,8 +284,8 @@
@Test
fun areHandlesCrossed_Horizontal_different_columns_crossed() {
- val start = PxPosition(x = largerThanRight, y = smallerThanTop)
- val end = PxPosition(x = smallerThanLeft, y = largerThanBottom)
+ val start = Offset(x = largerThanRight, y = smallerThanTop)
+ val end = Offset(x = smallerThanLeft, y = largerThanBottom)
val result =
SelectionMode.Horizontal.areHandlesCrossed(
diff --git a/ui/ui-unit/api/0.1.0-dev14.txt b/ui/ui-unit/api/0.1.0-dev14.txt
index c670d87..6e1d7fe 100644
--- a/ui/ui-unit/api/0.1.0-dev14.txt
+++ b/ui/ui-unit/api/0.1.0-dev14.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -346,11 +346,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -467,46 +469,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
method @androidx.compose.Stable public inline operator androidx.ui.unit.PxSize div(int other);
@@ -631,10 +610,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/api/current.txt b/ui/ui-unit/api/current.txt
index c670d87..6e1d7fe 100644
--- a/ui/ui-unit/api/current.txt
+++ b/ui/ui-unit/api/current.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -346,11 +346,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -467,46 +469,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
method @androidx.compose.Stable public inline operator androidx.ui.unit.PxSize div(int other);
@@ -631,10 +610,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
index c670d87..6e1d7fe 100644
--- a/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/public_plus_experimental_0.1.0-dev14.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -346,11 +346,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -467,46 +469,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
method @androidx.compose.Stable public inline operator androidx.ui.unit.PxSize div(int other);
@@ -631,10 +610,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/api/public_plus_experimental_current.txt b/ui/ui-unit/api/public_plus_experimental_current.txt
index c670d87..6e1d7fe 100644
--- a/ui/ui-unit/api/public_plus_experimental_current.txt
+++ b/ui/ui-unit/api/public_plus_experimental_current.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -346,11 +346,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -467,46 +469,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
method @androidx.compose.Stable public inline operator androidx.ui.unit.PxSize div(int other);
@@ -631,10 +610,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/api/restricted_0.1.0-dev14.txt b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
index 3347fdf..c31949b 100644
--- a/ui/ui-unit/api/restricted_0.1.0-dev14.txt
+++ b/ui/ui-unit/api/restricted_0.1.0-dev14.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -348,11 +348,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -471,47 +473,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- ctor @kotlin.PublishedApi internal PxPosition(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
ctor @kotlin.PublishedApi internal PxSize(internal long value);
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
@@ -641,10 +619,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/api/restricted_current.txt b/ui/ui-unit/api/restricted_current.txt
index 3347fdf..c31949b 100644
--- a/ui/ui-unit/api/restricted_current.txt
+++ b/ui/ui-unit/api/restricted_current.txt
@@ -331,7 +331,7 @@
public final class IntPxKt {
method public static inline androidx.ui.unit.IntPxPosition IntPxPosition-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize IntPxSize-rRMsBxU(int width, int height);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition-rRMsBxU(int x, int y);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset Offset-rRMsBxU(int x, int y);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize-rRMsBxU(int width, int height);
method @androidx.compose.Stable public static androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition center(androidx.ui.unit.IntPxBounds);
@@ -348,11 +348,13 @@
method @androidx.compose.Stable public static int lerp-9BbVZj8(int start, int stop, float fraction);
method @androidx.compose.Stable public static inline int max-rRMsBxU(int a, int b);
method @androidx.compose.Stable public static inline int min-rRMsBxU(int a, int b);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset minus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
+ method @androidx.compose.Stable public static inline operator androidx.ui.geometry.Offset plus(androidx.ui.geometry.Offset, androidx.ui.unit.IntPxPosition other);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.IntPxSize times(int, androidx.ui.unit.IntPxSize size);
method @androidx.compose.Stable public static inline operator int times--Vi_IPY(float, int other);
method @androidx.compose.Stable public static inline operator int times-9kGzznM(int, int other);
method @androidx.compose.Stable public static inline operator int times-tHVXE4c(double, int other);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition toPxPosition(androidx.ui.unit.IntPxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset toOffset(androidx.ui.unit.IntPxPosition);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize toPxSize(androidx.ui.unit.IntPxSize);
method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxSize toSize(androidx.ui.unit.IntPxBounds);
}
@@ -471,47 +473,23 @@
}
public final class PxKt {
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.unit.PxPosition topLeft, androidx.ui.unit.PxSize size);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition PxPosition(float x, float y);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.PxBounds PxBounds(androidx.ui.geometry.Offset topLeft, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline androidx.ui.unit.PxSize PxSize(float width, float height);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition center(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline androidx.ui.unit.PxPosition center(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static float getDistance(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static androidx.ui.geometry.Offset center(androidx.ui.unit.PxSize);
+ method @androidx.compose.Stable public static inline androidx.ui.geometry.Offset center(androidx.ui.unit.PxBounds);
method public static inline float getHeight(androidx.ui.unit.PxBounds);
method public static float getMinDimension(androidx.ui.unit.PxSize);
method public static inline float getWidth(androidx.ui.unit.PxBounds);
- method @androidx.compose.Stable public static androidx.ui.unit.PxPosition lerp(androidx.ui.unit.PxPosition start, androidx.ui.unit.PxPosition stop, float fraction);
- method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.unit.PxPosition);
+ method @androidx.compose.Stable public static inline androidx.ui.unit.IntPxPosition round(androidx.ui.geometry.Offset);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(int, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(float, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static inline operator androidx.ui.unit.PxSize times(double, androidx.ui.unit.PxSize size);
method @androidx.compose.Stable public static androidx.ui.unit.PxBounds toBounds(androidx.ui.unit.PxSize);
- method @androidx.compose.Stable public static inline long toOffset(androidx.ui.unit.PxPosition);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxBounds);
method @androidx.compose.Stable public static androidx.ui.geometry.Rect toRect(androidx.ui.unit.PxSize);
method @androidx.compose.Stable public static androidx.ui.unit.PxSize toSize(androidx.ui.unit.PxBounds);
}
- @androidx.compose.Immutable public final class PxPosition {
- ctor @kotlin.PublishedApi internal PxPosition(internal long value);
- method @androidx.compose.Immutable public androidx.ui.unit.PxPosition copy(long value);
- method public inline float getX();
- method public inline float getY();
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition minus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.PxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition plus(androidx.ui.unit.IntPxPosition other);
- method @androidx.compose.Stable public inline operator androidx.ui.unit.PxPosition unaryMinus();
- property public final inline float x;
- property public final inline float y;
- field public static final androidx.ui.unit.PxPosition.Companion! Companion;
- }
-
- public static final class PxPosition.Companion {
- method public androidx.ui.unit.PxPosition getOrigin();
- property public final androidx.ui.unit.PxPosition Origin;
- }
-
@androidx.compose.Immutable public final class PxSize {
ctor @kotlin.PublishedApi internal PxSize(internal long value);
method @androidx.compose.Immutable public androidx.ui.unit.PxSize copy(long value);
@@ -641,10 +619,10 @@
}
@androidx.compose.Immutable public final class Velocity {
- ctor public Velocity(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition component1();
- method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.unit.PxPosition pixelsPerSecond);
- method public androidx.ui.unit.PxPosition getPixelsPerSecond();
+ ctor public Velocity(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset component1();
+ method @androidx.compose.Immutable public androidx.ui.unit.Velocity copy(androidx.ui.geometry.Offset pixelsPerSecond);
+ method public androidx.ui.geometry.Offset getPixelsPerSecond();
method public operator androidx.ui.unit.Velocity unaryMinus();
field public static final androidx.ui.unit.Velocity.Companion! Companion;
}
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
index c4e0cb7..141f05a 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/IntPx.kt
@@ -19,6 +19,7 @@
import androidx.compose.Immutable
import androidx.compose.Stable
+import androidx.ui.geometry.Offset
import androidx.ui.unit.IntPx.Companion.Infinity
import androidx.ui.util.lerp
import androidx.ui.util.packInts
@@ -328,6 +329,20 @@
}
/**
+ * Subtract a [IntPxPosition] from this [Offset].
+ */
+@Stable
+inline operator fun Offset.minus(other: IntPxPosition) =
+ Offset(x - other.x.value, y - other.y.value)
+
+/**
+ * Add a [IntPxPosition] to this [Offset].
+ */
+@Stable
+inline operator fun Offset.plus(other: IntPxPosition) =
+ Offset(x + other.x.value, y + other.y.value)
+
+/**
* A two-dimensional position using [IntPx] for units
*/
@OptIn(ExperimentalUnsignedTypes::class)
@@ -446,17 +461,18 @@
PxSize(width = width.value.toFloat(), height = height.value.toFloat())
/**
- * Create a [PxPosition] from [IntPx] values.
+ * Create a [Offset] from [IntPx] values.
*/
@Stable
-inline fun PxPosition(x: IntPx, y: IntPx): PxPosition =
- PxPosition(x = x.value.toFloat(), y = y.value.toFloat())
+inline fun Offset(x: IntPx, y: IntPx): Offset =
+ Offset(x.value.toFloat(), y.value.toFloat())
/**
- * Convert a [IntPxPosition] to a [PxPosition]
+ * Convert a [IntPxPosition] to a [Offset]
*/
@Stable
-inline fun IntPxPosition.toPxPosition(): PxPosition = PxPosition(this.x, this.y)
+inline fun IntPxPosition.toOffset(): Offset =
+ Offset(x.value.toFloat(), y.value.toFloat())
/**
* Convert a [IntPxSize] to a [PxSize]
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
index e172e90..46fa747 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Px.kt
@@ -21,13 +21,11 @@
import androidx.compose.Stable
import androidx.ui.geometry.Offset
import androidx.ui.geometry.Rect
-import androidx.ui.util.lerp
import androidx.ui.util.packFloats
import androidx.ui.util.unpackFloat1
import androidx.ui.util.unpackFloat2
import kotlin.math.min
import kotlin.math.roundToInt
-import kotlin.math.sqrt
/**
* Holds a unit of squared dimensions, such as `1.value * 2.px`. [PxSquared], [PxCubed],
@@ -315,12 +313,12 @@
inline operator fun Double.times(size: PxSize) = size * this
/**
- * Returns the [PxPosition] of the center of the rect from the point of [0, 0]
+ * Returns the [Offset] of the center of the rect from the point of [0, 0]
* with this [PxSize].
*/
@Stable
-fun PxSize.center(): PxPosition {
- return PxPosition(width / 2f, height / 2f)
+fun PxSize.center(): Offset {
+ return Offset(width / 2f, height / 2f)
}
/**
@@ -330,103 +328,10 @@
val PxSize.minDimension get() = min(width, height)
/**
- * A two-dimensional position using pixels for units
- */
-@Immutable
-data class PxPosition @PublishedApi internal constructor(@PublishedApi internal val value: Long) {
- /**
- * The horizontal aspect of the position in pixels
- */
- inline val x: Float
- get() = unpackFloat1(value)
-
- /**
- * The vertical aspect of the position in pixels
- */
- inline val y: Float
- get() = unpackFloat2(value)
-
- /**
- * Subtract a [PxPosition] from another one.
- */
- @Stable
- inline operator fun minus(other: PxPosition) =
- PxPosition(x - other.x, y - other.y)
-
- /**
- * Add a [PxPosition] to another one.
- */
- @Stable
- inline operator fun plus(other: PxPosition) =
- PxPosition(x + other.x, y + other.y)
-
- /**
- * Subtract a [IntPxPosition] from this [PxPosition].
- */
- @Stable
- inline operator fun minus(other: IntPxPosition) =
- PxPosition(x - other.x.value, y - other.y.value)
-
- /**
- * Add a [IntPxPosition] to this [PxPosition].
- */
- @Stable
- inline operator fun plus(other: IntPxPosition) =
- PxPosition(x + other.x.value, y + other.y.value)
-
- /**
- * Returns a new PxPosition representing the negation of this point.
- */
- @Stable
- inline operator fun unaryMinus() = PxPosition(-x, -y)
-
- @Stable
- override fun toString(): String = "($x, $y)"
-
- companion object {
- @Stable
- val Origin = PxPosition(0.0f, 0.0f)
- }
-}
-
-/**
- * Constructs a [PxPosition] from [x] and [y] position pixel values.
+ * Round a [Offset] down to the nearest [Int] coordinates.
*/
@Stable
-inline fun PxPosition(x: Float, y: Float): PxPosition = PxPosition(packFloats(x, y))
-
-/**
- * The magnitude of the offset represented by this [PxPosition].
- */
-@Stable
-fun PxPosition.getDistance(): Float = sqrt(x * x + y * y)
-
-/**
- * Convert a [PxPosition] to a [Offset].
- */
-@Stable
-inline fun PxPosition.toOffset(): Offset = Offset(x, y)
-
-/**
- * Round a [PxPosition] down to the nearest [Int] coordinates.
- */
-@Stable
-inline fun PxPosition.round(): IntPxPosition = IntPxPosition(x.roundToInt().ipx, y.roundToInt().ipx)
-
-/**
- * Linearly interpolate between two [PxPosition]s.
- *
- * The [fraction] argument represents position on the timeline, with 0.0 meaning
- * that the interpolation has not started, returning [start] (or something
- * equivalent to [start]), 1.0 meaning that the interpolation has finished,
- * returning [stop] (or something equivalent to [stop]), and values in between
- * meaning that the interpolation is at the relevant point on the timeline
- * between [start] and [stop]. The interpolation can be extrapolated beyond 0.0 and
- * 1.0, so negative values and values greater than 1.0 are valid.
- */
-@Stable
-fun lerp(start: PxPosition, stop: PxPosition, fraction: Float): PxPosition =
- PxPosition(lerp(start.x, stop.x, fraction), lerp(start.y, stop.y, fraction))
+inline fun Offset.round(): IntPxPosition = IntPxPosition(x.roundToInt().ipx, y.roundToInt().ipx)
/**
* A four dimensional bounds using pixels for units
@@ -440,7 +345,7 @@
)
@Stable
-inline fun PxBounds(topLeft: PxPosition, size: PxSize) =
+inline fun PxBounds(topLeft: Offset, size: PxSize) =
PxBounds(
left = topLeft.x,
top = topLeft.y,
@@ -461,11 +366,11 @@
inline val PxBounds.height: Float get() = bottom - top
/**
- * Returns the [PxPosition] of the center of the [PxBounds].
+ * Returns the [Offset] of the center of the [PxBounds].
*/
@Stable
-inline fun PxBounds.center(): PxPosition {
- return PxPosition(left + width / 2f, top + height / 2f)
+inline fun PxBounds.center(): Offset {
+ return Offset(left + width / 2f, top + height / 2f)
}
/**
diff --git a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
index d86fb0e..d0451c1 100644
--- a/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
+++ b/ui/ui-unit/src/commonMain/kotlin/androidx/ui/unit/Velocity.kt
@@ -17,12 +17,13 @@
package androidx.ui.unit
import androidx.compose.Immutable
+import androidx.ui.geometry.Offset
/** A velocity in two dimensions. */
@Immutable
data class Velocity(
/** The number of pixels per second of velocity in the x and y directions. */
- val pixelsPerSecond: PxPosition
+ val pixelsPerSecond: Offset
) {
/** Return the negation of a velocity. */
operator fun unaryMinus() =
@@ -32,7 +33,7 @@
/**
* Velocity of 0 pixels per second in both x and y.
*/
- val Zero = Velocity(PxPosition(0f, 0f))
+ val Zero = Velocity(Offset(0f, 0f))
}
}
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
index 57d0618..e7a24ce 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/IntPxTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.unit
+import androidx.ui.geometry.Offset
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
@@ -221,7 +222,7 @@
@Test
fun createPosition() {
- assertEquals(PxPosition(10f, 20f), PxPosition(10.ipx, 20.ipx))
+ assertEquals(Offset(10f, 20f), Offset(10.ipx, 20.ipx))
}
@Test
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
index 6d7ff1d..1c508fa 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/PxTest.kt
@@ -16,6 +16,8 @@
package androidx.ui.unit
+import androidx.ui.geometry.Offset
+import androidx.ui.geometry.lerp
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
@@ -52,52 +54,52 @@
@Test
fun sizeCenter() {
val size = PxSize(width = 10f, height = 20f)
- assertEquals(PxPosition(5f, 10f), size.center())
+ assertEquals(Offset(5f, 10f), size.center())
}
@Test
fun positionDistance() {
- val position = PxPosition(3f, 4f)
+ val position = Offset(3f, 4f)
assertEquals(5f, position.getDistance())
}
@Test
fun lerpPosition() {
- val a = PxPosition(3f, 10f)
- val b = PxPosition(5f, 8f)
- assertEquals(PxPosition(4f, 9f), lerp(a, b, 0.5f))
- assertEquals(PxPosition(3f, 10f), lerp(a, b, 0f))
- assertEquals(PxPosition(5f, 8f), lerp(a, b, 1f))
+ val a = Offset(3f, 10f)
+ val b = Offset(5f, 8f)
+ assertEquals(Offset(4f, 9f), lerp(a, b, 0.5f))
+ assertEquals(Offset(3f, 10f), lerp(a, b, 0f))
+ assertEquals(Offset(5f, 8f), lerp(a, b, 1f))
}
@Test
fun positionMinus() {
- val a = PxPosition(3f, 10f)
- val b = PxPosition(5f, 8f)
- assertEquals(PxPosition(-2f, 2f), a - b)
- assertEquals(PxPosition(2f, -2f), b - a)
+ val a = Offset(3f, 10f)
+ val b = Offset(5f, 8f)
+ assertEquals(Offset(-2f, 2f), a - b)
+ assertEquals(Offset(2f, -2f), b - a)
}
@Test
fun positionPlus() {
- val a = PxPosition(3f, 10f)
- val b = PxPosition(5f, 8f)
- assertEquals(PxPosition(8f, 18f), a + b)
- assertEquals(PxPosition(8f, 18f), b + a)
+ val a = Offset(3f, 10f)
+ val b = Offset(5f, 8f)
+ assertEquals(Offset(8f, 18f), a + b)
+ assertEquals(Offset(8f, 18f), b + a)
}
@Test
fun pxPositionMinusIntPxPosition() {
- val a = PxPosition(3f, 10f)
+ val a = Offset(3f, 10f)
val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(PxPosition(-2f, 2f), a - b)
+ assertEquals(Offset(-2f, 2f), a - b)
}
@Test
fun pxPositionPlusIntPxPosition() {
- val a = PxPosition(3f, 10f)
+ val a = Offset(3f, 10f)
val b = IntPxPosition(5.ipx, 8.ipx)
- assertEquals(PxPosition(8f, 18f), a + b)
+ assertEquals(Offset(8f, 18f), a + b)
}
@Test
diff --git a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
index 1775a0c..e4c3097 100644
--- a/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
+++ b/ui/ui-unit/src/unitTest/kotlin/androidx/ui/unit/VelocityTest.kt
@@ -16,6 +16,7 @@
package androidx.ui.unit
+import androidx.ui.geometry.Offset
import com.google.common.truth.Truth
import org.junit.Test
import org.junit.runner.RunWith
@@ -24,30 +25,30 @@
@RunWith(JUnit4::class)
class VelocityTest {
- private val velocity1 = Velocity(pixelsPerSecond = PxPosition(3f, -7f))
- private val velocity2 = Velocity(pixelsPerSecond = PxPosition(5f, 13f))
+ private val velocity1 = Velocity(pixelsPerSecond = Offset(3f, -7f))
+ private val velocity2 = Velocity(pixelsPerSecond = Offset(5f, 13f))
@Test
fun operatorUnaryMinus() {
Truth.assertThat(-velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-3f, 7f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(-3f, 7f)))
Truth.assertThat(-velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-5f, -13f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(-5f, -13f)))
}
@Test
fun operatorPlus() {
Truth.assertThat(velocity2 + velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8f, 6f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(8f, 6f)))
Truth.assertThat(velocity1 + velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(8f, 6f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(8f, 6f)))
}
@Test
fun operatorMinus() {
Truth.assertThat(velocity1 - velocity2)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(-2f, -20f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(-2f, -20f)))
Truth.assertThat(velocity2 - velocity1)
- .isEqualTo(Velocity(pixelsPerSecond = PxPosition(2f, 20f)))
+ .isEqualTo(Velocity(pixelsPerSecond = Offset(2f, 20f)))
}
}
\ No newline at end of file
diff --git a/ui/ui-vector/src/commonMain/kotlin/androidx/ui/graphics/vector/Vector.kt b/ui/ui-vector/src/commonMain/kotlin/androidx/ui/graphics/vector/Vector.kt
index 1cb630e..98b35131 100644
--- a/ui/ui-vector/src/commonMain/kotlin/androidx/ui/graphics/vector/Vector.kt
+++ b/ui/ui-vector/src/commonMain/kotlin/androidx/ui/graphics/vector/Vector.kt
@@ -136,7 +136,7 @@
root.draw(Canvas(targetImage))
isDirty = false
}
- canvas.drawImage(targetImage, Offset.zero, obtainVectorPaint(alpha, colorFilter))
+ canvas.drawImage(targetImage, Offset.Zero, obtainVectorPaint(alpha, colorFilter))
}
override fun draw(canvas: Canvas) {