Skip to content

Commit 41069b1

Browse files
committed
1
1 parent ce8f644 commit 41069b1

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperDropdown.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ fun SuperDropdown(
141141
val insideRightPx by rememberUpdatedState(with(density) {
142142
insideMargin.calculateRightPadding(LayoutDirection.Ltr).toPx()
143143
}.roundToInt())
144-
val transformOriginXPadding by rememberUpdatedState(with(density) {
145-
64.dp.toPx()
146-
})
147144
var transformOrigin by mutableStateOf(TransformOrigin.Center)
148145

149146
DisposableEffect(Unit) {
@@ -181,12 +178,8 @@ fun SuperDropdown(
181178
dropdownOffsetYPx = positionInWindow.y.toInt()
182179
componentHeightPx = coordinates.size.height
183180
componentWidthPx = coordinates.size.width
184-
val xInWindow = dropdownOffsetXPx + if (mode == DropDownMode.AlwaysOnRight || !alignLeft) {
185-
componentWidthPx - insideRightPx - transformOriginXPadding
186-
} else {
187-
insideLeftPx + transformOriginXPadding
188-
}
189-
val yInWindow = dropdownOffsetYPx - componentHeightPx / 3
181+
val xInWindow = dropdownOffsetXPx + if (mode == DropDownMode.AlwaysOnRight || !alignLeft) componentWidthPx else 0
182+
val yInWindow = dropdownOffsetYPx + componentHeightPx / 2
190183
transformOrigin = TransformOrigin(
191184
xInWindow / windowWidthPx.toFloat(),
192185
yInWindow / windowHeightPx.toFloat()

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/extra/SuperSpinner.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,6 @@ fun SuperSpinner(
145145
val insideRightPx by rememberUpdatedState(with(density) {
146146
insideMargin.calculateRightPadding(LayoutDirection.Ltr).toPx()
147147
}.roundToInt())
148-
val transformOriginXPadding by rememberUpdatedState(with(density) {
149-
64.dp.toPx()
150-
})
151148
var transformOrigin by mutableStateOf(TransformOrigin.Center)
152149

153150
DisposableEffect(Unit) {
@@ -185,12 +182,8 @@ fun SuperSpinner(
185182
dropdownOffsetYPx = positionInWindow.y.toInt()
186183
componentHeightPx = coordinates.size.height
187184
componentWidthPx = coordinates.size.width
188-
val xInWindow = dropdownOffsetXPx + if (mode == SpinnerMode.AlwaysOnRight || !alignLeft) {
189-
componentWidthPx - insideRightPx - transformOriginXPadding
190-
} else {
191-
insideLeftPx + transformOriginXPadding
192-
}
193-
val yInWindow = dropdownOffsetYPx - componentHeightPx / 3
185+
val xInWindow = dropdownOffsetXPx + if (mode == SpinnerMode.AlwaysOnRight || !alignLeft) componentWidthPx else 0
186+
val yInWindow = dropdownOffsetYPx + componentHeightPx / 2
194187
transformOrigin = TransformOrigin(
195188
xInWindow / windowWidthPx.toFloat(),
196189
yInWindow / windowHeightPx.toFloat()

miuix/src/commonMain/kotlin/top/yukonga/miuix/kmp/utils/MiuixPopupUtil.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,9 @@ class MiuixPopupUtil {
179179
visible = isPopupShowing.value,
180180
modifier = Modifier.zIndex(2f).fillMaxSize(),
181181
enter = fadeIn(
182-
animationSpec = tween(150, easing = DecelerateEasing(1.5f))
182+
animationSpec = tween(150, easing = AccelerateEasing(1.5f))
183183
) + scaleIn(
184-
initialScale = 0.8f,
184+
initialScale = 0.4f,
185185
animationSpec = tween(150, easing = DecelerateEasing(1.5f)),
186186
transformOrigin = popupTransformOrigin.value.invoke()
187187
),

0 commit comments

Comments
 (0)