Skip to content

Commit 7a6e73e

Browse files
committed
Fix key preview wrong offset caused by 3870097
1 parent 3870097 commit 7a6e73e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

app/src/main/java/io/github/yawnoc/strokeinput/InputContainer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,13 @@ public void showKeyPreviewPlane() {
239239
final int screenWidth = keyboard.getScreenWidth();
240240
final int screenHeight = keyboard.getScreenHeight();
241241
final int keyboardHeight = keyboard.getHeight();
242+
final int popupBufferZoneHeight = keyboard.getPopupBufferZoneHeight();
242243

243244
keyPreviewPlane.updateDimensions(
244245
screenWidth,
245246
screenHeight,
246-
keyboardHeight
247+
keyboardHeight,
248+
popupBufferZoneHeight
247249
);
248250
keyPreviewPlanePopup.dismiss();
249251
keyPreviewPlanePopup.setWidth(screenWidth);

app/src/main/java/io/github/yawnoc/strokeinput/KeyPreviewPlane.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public class KeyPreviewPlane extends View {
3333
private int width;
3434
private int height;
3535
private int keyboardHeight;
36+
private int popupBufferZoneHeight;
3637
private final List<Key> keyList = new ArrayList<>();
3738
private Key latestKey;
3839
private int shiftMode = InputContainer.SHIFT_DISABLED;
@@ -90,12 +91,14 @@ private void initialiseDrawing(final Context context) {
9091
public void updateDimensions(
9192
final int width,
9293
final int height,
93-
final int keyboardHeight
94+
final int keyboardHeight,
95+
final int popupBufferZoneHeight
9496
)
9597
{
9698
this.width = width;
9799
this.height = height;
98100
this.keyboardHeight = keyboardHeight;
101+
this.popupBufferZoneHeight = popupBufferZoneHeight;
99102
}
100103

101104
public void updateShiftMode(final int shiftMode) {
@@ -186,7 +189,7 @@ public void onDraw(final Canvas canvas) {
186189
final int previewY = (
187190
key.y
188191
- keyPreviewHeight - key.previewMarginY
189-
+ this.height - keyboardHeight
192+
+ this.height - keyboardHeight - popupBufferZoneHeight
190193
);
191194

192195
canvas.translate(previewX, previewY);

0 commit comments

Comments
 (0)