show video restore btn if translated

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-11-17 21:39:53 +08:00
parent 0f8166620e
commit de03bef226
4 changed files with 18 additions and 7 deletions

View File

@@ -36,9 +36,9 @@ class MouseInteractiveViewer extends StatefulWidget {
this.transformationController,
this.alignment,
this.trackpadScrollCausesScale = false,
required this.childKey,
required this.child,
required this.onTranslate,
}) : assert(minScale > 0),
assert(interactionEndFrictionCoefficient > 0),
assert(maxScale > 0),
@@ -66,6 +66,7 @@ class MouseInteractiveViewer extends StatefulWidget {
final GestureScaleUpdateCallback? onInteractionUpdate;
final TransformationController? transformationController;
final GlobalKey childKey;
final VoidCallback onTranslate;
static const double _kDrag = 0.0000135;
@@ -641,6 +642,8 @@ class _MouseInteractiveViewerState extends State<MouseInteractiveViewer>
_transformer.value,
newFocalPointScene - focalPointScene,
);
widget.onTranslate();
}
void _handleInertiaAnimation() {

View File

@@ -740,7 +740,7 @@ class _InteractiveViewerState extends State<InteractiveViewer>
// with GestureDetector's scale gesture.
void _onScaleStart(ScaleStartDetails details) {
if (widget.isAnimating?.call() == true ||
(details.pointerCount < 2 && _transformer.value.row0.x == 1.0)) {
(details.pointerCount < 2 && _transformer.value.storage[0] == 1.0)) {
widget.onPanStart?.call(details);
return;
}
@@ -773,7 +773,7 @@ class _InteractiveViewerState extends State<InteractiveViewer>
// handled with GestureDetector's scale gesture.
void _onScaleUpdate(ScaleUpdateDetails details) {
if (widget.isAnimating?.call() == true ||
(details.pointerCount < 2 && _transformer.value.row0.x == 1.0)) {
(details.pointerCount < 2 && _transformer.value.storage[0] == 1.0)) {
widget.onPanUpdate?.call(details);
return;
}
@@ -873,11 +873,11 @@ class _InteractiveViewerState extends State<InteractiveViewer>
// Handle the end of a gesture of _GestureType. All of pan, scale, and rotate
// are handled with GestureDetector's scale gesture.
void _onScaleEnd(ScaleEndDetails details) {
if (_transformer.value.row0.x == 1.0) {
if (_transformer.value.storage[0] == 1.0) {
widget.onReset?.call();
}
if (widget.isAnimating?.call() == true ||
(details.pointerCount < 2 && _transformer.value.row0.x == 1.0)) {
(details.pointerCount < 2 && _transformer.value.storage[0] == 1.0)) {
widget.onPanEnd?.call(details);
return;
}

View File

@@ -359,7 +359,7 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
void onDoubleTap() {
Matrix4 matrix = _transformationController.value.clone();
double currentScale = matrix.row0.x;
double currentScale = matrix.storage[0];
double targetScale = widget.minScale;