This commit is contained in:
Romain Vimont 2018-08-07 23:40:06 +02:00
parent 60c882841f
commit 80233b7b72

View File

@ -68,11 +68,11 @@ public final class Device {
// the device may have been rotated since the event was generated, so ignore the event // the device may have been rotated since the event was generated, so ignore the event
return null; return null;
} }
Size deviceSize = screenInfo.getDeviceSize(); Rect contentRect = screenInfo.getContentRect();
Point point = position.getPoint(); Point point = position.getPoint();
int scaledX = point.x * deviceSize.getWidth() / videoSize.getWidth(); int deviceX = contentRect.left + point.x * contentRect.width() / videoSize.getWidth();
int scaledY = point.y * deviceSize.getHeight() / videoSize.getHeight(); int deviceY = contentRect.top + point.y * contentRect.height() / videoSize.getHeight();
return new Point(scaledX, scaledY); return new Point(deviceX, deviceY);
} }
public static String getDeviceName() { public static String getDeviceName() {