Skip to content

Commit

Permalink
Merge xclud#68
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehutch committed Feb 28, 2023
1 parent 677255e commit 5d305b8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/src/crop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Crop extends StatefulWidget {
this.onChanged,
this.animationDuration = const Duration(milliseconds: 200),
this.radius,
this.scaleLimit,
}) : super(key: key);

/// The widget below this widget in the tree.
Expand Down Expand Up @@ -67,6 +68,9 @@ class Crop extends StatefulWidget {
/// Radius of the crop area.
final Radius? radius;

/// Maximum zoom scale
final double? scaleLimit;

@override
State<StatefulWidget> createState() {
return _CropState();
Expand Down Expand Up @@ -220,6 +224,10 @@ class _CropState extends State<Crop> with TickerProviderStateMixin {
widget.controller._offset += details.focalPoint - _previousOffset;
_previousOffset = details.focalPoint;
widget.controller._scale = _previousScale * details.scale;
if (widget.scaleLimit != null &&
widget.controller._scale > widget.scaleLimit!) {
widget.controller._scale = widget.scaleLimit!;
}
_startOffset = widget.controller._offset;
_endOffset = widget.controller._offset;

Expand Down

0 comments on commit 5d305b8

Please sign in to comment.