Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edebc45c authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Android (Google) Code Review
Browse files

Merge "Revert "STL Element exposes a lookaheadScopeCoordinates"" into main

parents 0f75c1ce 3c0fe6b2
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ internal class Element(val key: ElementKey) {
         * we are idle on this content.
         */
        var targetSize by mutableStateOf(SizeUnspecified)
        var targetCoordinates: LayoutCoordinates? by mutableStateOf(null)
        var targetOffset by mutableStateOf(Offset.Unspecified)

        /** The last state this element had in this content. */
@@ -376,7 +375,6 @@ internal class ElementNode(
                // this content when idle.
                coordinates?.let { coords ->
                    with(layoutImpl.lookaheadScope) {
                        stateInContent.targetCoordinates = lookaheadScopeCoordinates
                        stateInContent.targetOffset =
                            lookaheadScopeCoordinates.localLookaheadPositionOf(coords)
                    }
+0 −8
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.input.pointer.PointerType
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.layout.LookaheadScope
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
@@ -167,13 +166,6 @@ interface ElementStateScope {
     */
    fun ElementKey.targetOffset(content: ContentKey): Offset?

    /**
     * Return the *target* layout coordinates of [this] element in the given [content], i.e. the
     * LayoutCoordinates of the element when idle, or `null` if the element is not composed and
     * placed in that content (yet).
     */
    fun ElementKey.targetCoordinates(content: ContentKey): LayoutCoordinates?

    /**
     * Return the *target* size of [this] content, i.e. the size of the content when idle, or `null`
     * if the content was not composed (yet).
+0 −5
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.compose.animation.scene
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MotionScheme
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.layout.LayoutCoordinates
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.LayoutDirection
import com.android.compose.animation.scene.transformation.PropertyTransformationScope
@@ -38,10 +37,6 @@ internal class ElementStateScopeImpl(private val layoutImpl: SceneTransitionLayo
        }
    }

    override fun ElementKey.targetCoordinates(content: ContentKey): LayoutCoordinates? {
        return layoutImpl.elements[this]?.stateByContent?.get(content)?.targetCoordinates
    }

    override fun ContentKey.targetSize(): IntSize? {
        return layoutImpl.content(this).targetSize.takeIf { it != Element.SizeUnspecified }
    }
+0 −1
Original line number Diff line number Diff line
@@ -1489,7 +1489,6 @@ class ElementTest {

        assertThat(bState.targetSize).isNotEqualTo(Element.SizeUnspecified)
        assertThat(bState.targetOffset).isNotEqualTo(Offset.Unspecified)
        assertThat(bState.targetCoordinates).isNotEqualTo(null)
    }

    @Test