mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 03:06:59 +08:00
@@ -81,7 +81,9 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
|
||||
final GlobalKey _parentKey = GlobalKey();
|
||||
Animation<Offset>? _animation;
|
||||
CurvedAnimation? _curvedAnimation;
|
||||
Animation<double>? _scaleAnimation;
|
||||
CurvedAnimation? _curvedScaleAnimation;
|
||||
late Offset _scaleAnimationFocalPoint;
|
||||
late AnimationController _controller;
|
||||
late AnimationController _scaleController;
|
||||
@@ -96,17 +98,7 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
touchSlop: Platform.isIOS ? 9 : 4,
|
||||
);
|
||||
|
||||
late final _scaleGestureRecognizer =
|
||||
ScaleGestureRecognizer(
|
||||
debugOwner: this,
|
||||
allowedButtonsFilter: (buttons) => buttons == kPrimaryButton,
|
||||
trackpadScrollToScaleFactor: Offset(0, -1 / widget.scaleFactor),
|
||||
trackpadScrollCausesScale: widget.trackpadScrollCausesScale,
|
||||
)
|
||||
..gestureSettings = gestureSettings
|
||||
..onStart = _onScaleStart
|
||||
..onUpdate = _onScaleUpdate
|
||||
..onEnd = _onScaleEnd;
|
||||
late final ScaleGestureRecognizer _scaleGestureRecognizer;
|
||||
|
||||
final bool _rotateEnabled = false;
|
||||
|
||||
@@ -451,7 +443,10 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
frictionSimulationY.finalX,
|
||||
),
|
||||
).animate(
|
||||
CurvedAnimation(parent: _controller, curve: Curves.decelerate),
|
||||
_curvedAnimation ??= CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.decelerate,
|
||||
),
|
||||
)
|
||||
..addListener(_handleInertiaAnimation);
|
||||
_controller
|
||||
@@ -478,7 +473,7 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
begin: scale,
|
||||
end: frictionSimulation.x(tFinal),
|
||||
).animate(
|
||||
CurvedAnimation(
|
||||
_curvedScaleAnimation ??= CurvedAnimation(
|
||||
parent: _scaleController,
|
||||
curve: Curves.decelerate,
|
||||
),
|
||||
@@ -700,6 +695,17 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scaleGestureRecognizer =
|
||||
ScaleGestureRecognizer(
|
||||
debugOwner: this,
|
||||
allowedButtonsFilter: (buttons) => buttons == kPrimaryButton,
|
||||
trackpadScrollToScaleFactor: Offset(0, -1 / widget.scaleFactor),
|
||||
trackpadScrollCausesScale: widget.trackpadScrollCausesScale,
|
||||
)
|
||||
..gestureSettings = gestureSettings
|
||||
..onStart = _onScaleStart
|
||||
..onUpdate = _onScaleUpdate
|
||||
..onEnd = _onScaleEnd;
|
||||
_controller = AnimationController(vsync: this);
|
||||
_scaleController = AnimationController(vsync: this);
|
||||
|
||||
@@ -726,7 +732,9 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
|
||||
@override
|
||||
void dispose() {
|
||||
_scaleGestureRecognizer.dispose();
|
||||
_curvedAnimation?.dispose();
|
||||
_controller.dispose();
|
||||
_curvedScaleAnimation?.dispose();
|
||||
_scaleController.dispose();
|
||||
_transformer.removeListener(_handleTransformation);
|
||||
if (widget.transformationController == null) {
|
||||
|
||||
Reference in New Issue
Block a user