Closed MichaelSamir47 closed 1 year ago
You can set aspectRatioLocked = true
and use AspectRatioSettable.setAspectRatio(_:)
or AspectRatioSettable.setAspectRatioValue(_:)
Thanks
if I set
cropper.aspectRatioLocked = true
and
cropper.setAspectRatio(.ratio(width: 8, height: 10))
then the app is crashing with this log in console
Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]. Layer: <CALayer:0x281880700; position = CGPoint (0 0); bounds = CGRect (0 0; 0 0); delegate = <QCropper.CropBox: 0x1016199d0; frame = (0 0; 0 0); layer = <CALayer: 0x281880700>>; sublayers = (<CALayer: 0x2818807e0>, <CALayer: 0x281880940>, <CALayer: 0x281880a60>, <CALayer: 0x281880b80>, <CALayer: 0x281880ca0>); allowsGroupOpacity = YES; borderWidth = 2; borderColor = <CGColor 0x283be1860> [<CGColorSpace 0x283ccc600> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 1 1 ); backgroundColor = <CGColor 0x283bfa440> [<CGColorSpace 0x283ccc600> (kCGColorSpaceICCBased; kCGColorSpaceModelMonochrome; Generic Gray Gamma 2.2 Profile; extended range)] ( 0 0 )>'
Is aspectRatioLocked = true
and use AspectRatioSettable.setAspectRatio(_:)
or AspectRatioSettable.setAspectRatioValue(_:)
set at CropperViewController.swift-func resetToDefaultLayout() ?
how to force cropping an image with aspect ratio (9:16)without free scaling?