onPointerUp method
Implementation
@override
void onPointerUp(int pointerId, Offset offset, Map<int, Offset> pointers) {
//_log.info("up ${pointers.length}, active $_moveActive, timer: ${activeTimer()}, swipetimer: $_swipeTimer, offset $_swipeOffset");
if (pointers.isEmpty && !_moveActive) {
// cancel if the only point went up
cancelTimer();
_moveActive = false;
_swipeOffset = null;
_nextManualMoveEvent = 0;
return;
}
// if (!_moveActive) {
// return;
// }
super.onPointerUp(pointerId, offset, pointers);
cancelTimer();
if (_swipeTimer != null) {
// swipe still active
_swipeTimer?.cancel();
_swipeTimer = null;
_swipeOffset = null;
_nextManualMoveEvent = 0;
return;
}
velocityCalculator.addEvent(offset);
// calculate the offset per iteration
_swipeOffset = velocityCalculator.lastVelocity.offsetPerMillisecond * _swipeSleepMs.toDouble();
if (startPosition?.rotation != 0) {
double hyp = sqrt(_swipeOffset!.dx * _swipeOffset!.dx + _swipeOffset!.dy * _swipeOffset!.dy);
double rad = atan2(_swipeOffset!.dy, _swipeOffset!.dx);
double rot = startPosition!.rotationRadian;
_swipeOffset = Offset(cos(-rot + rad) * hyp, sin(-rot + rad) * hyp);
// print(
// "diff: $diffX/$diffY @ ${widget.viewModel.mapViewPosition!.rotation}($rad) from ${(details.localFocalPoint.dx - _startLocalFocalPoint!.dx) * widget.viewModel.viewScaleFactor}/${(details.localFocalPoint.dy - _startLocalFocalPoint!.dy) * widget.viewModel.viewScaleFactor}");
}
_swipeTimer = Timer.periodic(Duration(milliseconds: _swipeSleepMs), (timer) {
_swipeTimerProcess();
});
}