Skip to content

Commit

Permalink
fixes android pressure range (flutter#7516)
Browse files Browse the repository at this point in the history
  • Loading branch information
jslavitz authored Jan 22, 2019
1 parent 2123d3a commit c57e66f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,11 +474,10 @@ private void addPointerForIndex(MotionEvent event, int pointerIndex, int pointer

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
Expand Down

0 comments on commit c57e66f

Please sign in to comment.