diff --git a/app/lib/handlers/area.dart b/app/lib/handlers/area.dart index 9fb1da510162..176c9bc24421 100644 --- a/app/lib/handlers/area.dart +++ b/app/lib/handlers/area.dart @@ -54,7 +54,7 @@ class AreaHandler extends Handler { context.getCameraTransform().localToGlobal(details.localFocalPoint); start = globalPosition; - return false; + return true; } @override diff --git a/app/lib/handlers/hand.dart b/app/lib/handlers/hand.dart index 94ec446f8446..32448652692e 100644 --- a/app/lib/handlers/hand.dart +++ b/app/lib/handlers/hand.dart @@ -5,25 +5,16 @@ class GeneralHandHandler extends Handler { GeneralHandHandler(super.data); - @override - void onScaleUpdate(ScaleUpdateDetails details, EventContext context) { - context - .getCurrentIndexCubit() - .move(details.focalPointDelta / context.getCameraTransform().size); - _moved = true; - } - @override void onScaleEnd(ScaleEndDetails details, EventContext context) { - if (_moved) { - context.bake(); - } _moved = false; + context.refresh(); } @override bool onScaleStart(ScaleStartDetails details, EventContext context) { - _moved = false; + _moved = true; + context.refresh(); return false; } diff --git a/app/lib/handlers/handler.dart b/app/lib/handlers/handler.dart index 570f3c820c82..0ffdb6458c9e 100644 --- a/app/lib/handlers/handler.dart +++ b/app/lib/handlers/handler.dart @@ -186,7 +186,7 @@ abstract class Handler { void onLongPressEnd(LongPressEndDetails details, EventContext context) {} - bool onScaleStart(ScaleStartDetails details, EventContext context) => false; + bool onScaleStart(ScaleStartDetails details, EventContext context) => true; void onScaleStartAbort(ScaleStartDetails details, EventContext context) {} @@ -477,6 +477,7 @@ abstract class PastingHandler extends Handler { [bool first = false]) { final transform = context.getCameraTransform(); if (first) _firstPos = transform.localToGlobal(event.localPosition); + if (!first && _firstPos == null) return; _secondPos = transform.localToGlobal(event.localPosition); _aspectRatio = context.isCtrlPressed; _center = context.isShiftPressed; @@ -507,6 +508,13 @@ abstract class PastingHandler extends Handler { context.refresh(); } + @override + void onScaleStartAbort(ScaleStartDetails details, EventContext context) { + _firstPos = null; + _secondPos = null; + context.refresh(); + } + double get constraintedAspectRatio => 0; double get constraintedWidth => 0; double get constraintedHeight => 0; diff --git a/app/lib/handlers/select.dart b/app/lib/handlers/select.dart index 078551074372..95a61d399364 100644 --- a/app/lib/handlers/select.dart +++ b/app/lib/handlers/select.dart @@ -528,7 +528,7 @@ class SelectHandler extends Handler { return true; } context.refresh(); - return false; + return true; } @override diff --git a/app/lib/handlers/spacer.dart b/app/lib/handlers/spacer.dart index d6dcbae088e1..269fdaff728f 100644 --- a/app/lib/handlers/spacer.dart +++ b/app/lib/handlers/spacer.dart @@ -48,7 +48,7 @@ class SpacerHandler extends Handler { final transform = context.getCameraTransform(); _startPosition = transform.localToGlobal(details.localFocalPoint); _refreshRenderers(_startPosition!, context).whenComplete(context.refresh); - return false; + return true; } @override diff --git a/app/lib/views/view.dart b/app/lib/views/view.dart index b92fd69fb72f..8f6c37b42fa0 100644 --- a/app/lib/views/view.dart +++ b/app/lib/views/view.dart @@ -239,11 +239,11 @@ class _MainViewViewportState extends State _isScalingDisabled = null; }, onScaleStart: (details) { + _isScalingDisabled ??= !cubit.state.moveEnabled; if (_isScalingDisabled != false) { - _isScalingDisabled = !cubit.state.moveEnabled || - cubit - .getHandler() - .onScaleStart(details, getEventContext()); + _isScalingDisabled = cubit + .getHandler() + .onScaleStart(details, getEventContext()); } else { cubit .getHandler()