Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

Fix for incorrect crop for some images #5

@vopt

Description

@vopt

There's a bug that got ported from GKImagePicker. I'm not up to speed on the proper use of github so I'll just leave this here. Replace this function in WDImageCropView:

private func calcVisibleRectForResizeableCropArea() -> CGRect {
    let resizableView = cropOverlayView as! WDResizableCropOverlayView

    // first of all, get the size scale by taking a look at the real image dimensions. Here it 
    // doesn't matter if you take the width or the height of the image, because it will always
    // be scaled in the exact same proportion of the real image
    var sizeScale = self.imageView.image!.size.width / self.imageView.frame.size.width
    sizeScale *= self.scrollView.zoomScale

    // then get the position of the cropping rect inside the image
    var visibleRect = resizableView.contentView.convertRect(resizableView.contentView.bounds,
        toView: imageView)
    visibleRect = WDImageCropView.scaleRect(visibleRect, scale: sizeScale)

    return visibleRect
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions