#1485 fixed magnifier edge detection

This commit is contained in:
Thibault Deckers 2025-03-25 23:23:08 +01:00
parent 9c641e0f49
commit 8193c48234
2 changed files with 7 additions and 2 deletions

View file

@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
## <a id="unreleased"></a>[Unreleased]
### Fixed
- swiping images for some combinations of screen size, device pixel ratio, and image size
## <a id="v1.12.7"></a>[v1.12.7] - 2025-03-16
### Added

View file

@ -1,5 +1,6 @@
import 'package:aves_magnifier/src/controller/controller_delegate.dart';
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
mixin EdgeHitDetector on AvesMagnifierControllerDelegate {
@ -15,7 +16,7 @@ mixin EdgeHitDetector on AvesMagnifierControllerDelegate {
final x = -position.dx;
final range = _boundaries.getXEdges(scale: _scale);
return EdgeHit(x <= range.min, x >= range.max);
return EdgeHit(x <= range.min + precisionErrorTolerance, x >= range.max - precisionErrorTolerance);
}
EdgeHit getYEdgeHit() {
@ -25,7 +26,7 @@ mixin EdgeHitDetector on AvesMagnifierControllerDelegate {
final y = -position.dy;
final range = _boundaries.getYEdges(scale: _scale);
return EdgeHit(y <= range.min, y >= range.max);
return EdgeHit(y <= range.min + precisionErrorTolerance, y >= range.max - precisionErrorTolerance);
}
bool shouldMoveX(Offset move, bool canFling) {