add mouse scroll to zoom functionality

This commit is contained in:
2025-08-11 21:59:53 +00:00
parent dbe17805e0
commit 2b942893c0
2 changed files with 59 additions and 42 deletions
+3 -2
View File
@@ -208,8 +208,9 @@ class LazyCanvasController with ChangeNotifier {
}
/// Increment or decrement the scale by an additive delta value.
void updateScalebyDelta(double delta) {
final focalPoint = Offset(canvasSize.width / 2, canvasSize.height / 2);
void updateScalebyDelta(double delta, {Offset? focalPoint}) {
// added focalPoint param
focalPoint ??= Offset(canvasSize.width / 2, canvasSize.height / 2);
final newScale = _scale + delta;
_gsTopLeftOffset = newGsTopLeftOnScaling(_gsTopLeftOffset, focalPoint, _scale, newScale);
_scale = newScale;