Merge pull request #32 from Kopi-Su-Studio/master

Fix to prevent the AnimationController from stopping if a sensorControl is active
This commit is contained in:
Zebiao Hu 2021-11-28 19:52:42 +08:00 committed by GitHub
commit 2fe97f8276
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -211,8 +211,12 @@ class _PanoramaState extends State<Panorama> with SingleTickerProviderStateMixin
zoomDelta *= 1 - _dampingFactor; zoomDelta *= 1 - _dampingFactor;
scene!.camera.zoom = zoom.clamp(widget.minZoom, widget.maxZoom); scene!.camera.zoom = zoom.clamp(widget.minZoom, widget.maxZoom);
// stop animation if not needed // stop animation if not needed
if (latitudeDelta.abs() < 0.001 && longitudeDelta.abs() < 0.001 && zoomDelta.abs() < 0.001) { if (latitudeDelta.abs() < 0.001 &&
if (widget.animSpeed == 0 && _controller.isAnimating) _controller.stop(); longitudeDelta.abs() < 0.001 &&
zoomDelta.abs() < 0.001) {
if (widget.sensorControl == SensorControl.None &&
widget.animSpeed == 0 &&
_controller.isAnimating) _controller.stop();
} }
// rotate for screen orientation // rotate for screen orientation