onSinglePanEnd method
void
onSinglePanEnd()
Implementation
void onSinglePanEnd() {
if (_state == State2.rotate) {
if (!enableRotate) {
return;
}
if (enableAnimations) {
//perform rotation animation
final deltaTime =
(DateTime.now().millisecondsSinceEpoch - _timeCurrent);
if (deltaTime < 120) {
final w = ((_wPrev + _wCurr) / 2).abs();
final self = this;
_animationId = requestAnimationFrame((t) {
self.updateTbState(State2.animationRotate, true);
final rotationAxis = self.calculateRotationAxis(
self._cursorPosPrev, self._cursorPosCurr);
self.onRotationAnim(t, rotationAxis, math.min(w, self.wMax));
});
} else {
//cursor has been standing still for over 120 ms since last movement
updateTbState(State2.idle, false);
activateGizmos(false);
dispatchEvent(_changeEvent);
}
} else {
updateTbState(State2.idle, false);
activateGizmos(false);
dispatchEvent(_changeEvent);
}
} else if (_state == State2.pan || _state == State2.idle) {
updateTbState(State2.idle, false);
if (enableGrid) {
disposeGrid();
}
activateGizmos(false);
dispatchEvent(_changeEvent);
}
dispatchEvent(_endEvent);
}