mirror of
https://github.com/fcitx5-android/fcitx5-android.git
synced 2026-08-02 20:16:06 +08:00
Calculate available space above and below cursor correctly
This commit is contained in:
parent
5ff01d5aa7
commit
793158eb21
@ -163,11 +163,13 @@ class CandidatesView(
|
||||
} else {
|
||||
if (horizontal + selfWidth > parentWidth) parentWidth - selfWidth else horizontal
|
||||
}
|
||||
val bottomSpace = parentHeight - bottomInsets
|
||||
val bottomLimit = parentHeight - bottomInsets
|
||||
val bottomSpace = bottomLimit - bottom
|
||||
// move CandidatesView above cursor anchor, only when
|
||||
// bottom space is not enough && top space is larger than bottom
|
||||
val tY: Float =
|
||||
if (bottom + selfHeight > bottomSpace && top > bottomSpace) top - selfHeight else bottom
|
||||
val tY: Float = if (
|
||||
bottom + selfHeight > bottomLimit // bottom space is not enough
|
||||
&& top > bottomSpace // top space is larger than bottom
|
||||
) top - selfHeight else bottom
|
||||
translationX = tX
|
||||
translationY = tY
|
||||
// update touchEventReceiverWindow's position after CandidatesView's
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user