fixes android pressure range (flutter/engine#7516)

This commit is contained in:
jslavitz 2019-01-22 15:09:02 -08:00 committed by GitHub
parent 8d6ec47a36
commit 9b55d2ced1

View File

@ -474,11 +474,10 @@ public class FlutterView extends SurfaceView
packet.putLong(0); // obscured
// TODO(eseidel): Could get the calibrated range if necessary:
// event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE)
InputDevice.MotionRange pressureRange = event.getDevice().getMotionRange(MotionEvent.AXIS_PRESSURE);
packet.putDouble(event.getPressure(pointerIndex)); // pressure
packet.putDouble(0.0); // pressure_min
packet.putDouble(1.0); // pressure_max
packet.putDouble(pressureRange.getMin()); // pressure_min
packet.putDouble(pressureRange.getMax()); // pressure_max
if (pointerKind == kPointerDeviceKindStylus) {
packet.putDouble(event.getAxisValue(MotionEvent.AXIS_DISTANCE, pointerIndex)); // distance