Skip to content

Commit 793158e

Browse files
committed
Calculate available space above and below cursor correctly
1 parent 5ff01d5 commit 793158e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/main/java/org/fcitx/fcitx5/android/input/CandidatesView.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,13 @@ class CandidatesView(
163163
} else {
164164
if (horizontal + selfWidth > parentWidth) parentWidth - selfWidth else horizontal
165165
}
166-
val bottomSpace = parentHeight - bottomInsets
166+
val bottomLimit = parentHeight - bottomInsets
167+
val bottomSpace = bottomLimit - bottom
167168
// move CandidatesView above cursor anchor, only when
168-
// bottom space is not enough && top space is larger than bottom
169-
val tY: Float =
170-
if (bottom + selfHeight > bottomSpace && top > bottomSpace) top - selfHeight else bottom
169+
val tY: Float = if (
170+
bottom + selfHeight > bottomLimit // bottom space is not enough
171+
&& top > bottomSpace // top space is larger than bottom
172+
) top - selfHeight else bottom
171173
translationX = tX
172174
translationY = tY
173175
// update touchEventReceiverWindow's position after CandidatesView's

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy