Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class PinchGestureHandler : GestureHandler<PinchGestureHandler>() {
override fun onScale(detector: ScaleGestureDetector): Boolean {
val prevScaleFactor: Double = scale
scale *= detector.scaleFactor.toDouble()
val delta = detector.timeDelta
val delta = detector.timeDeltaSeconds

if (delta > 0) {
velocity = (scale - prevScaleFactor) / delta
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,16 @@ public long getTimeDelta() {
return mCurrTime - mPrevTime;
}

/**
* Return the time difference in seconds between the previous
* accepted scaling event and the current scaling event.
*
* @return Time difference since the last scaling event in seconds.
*/
public double getTimeDeltaSeconds() {
return (double)this.getTimeDelta() / 1000;
}

/**
* Return the event time of the current event being processed.
*
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gesture-handlers/pinch-gh.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The scale factor relative to the points of the two touches in screen coordinates

### `velocity`

Velocity of the pan gesture the current moment. The value is expressed in point units per second.
Velocity of the pan gesture the current moment. The value is expressed in scale factor per second.

### `focalX`

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/gestures/pinch-gesture.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ The scale factor relative to the points of the two touches in screen coordinates

### `velocity`

Velocity of the pan gesture the current moment. The value is expressed in point units per second.
Velocity of the pan gesture the current moment. The value is expressed in scale factor per second.

### `focalX`

Expand Down