Skip to content

Commit

Permalink
Some minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
longitachi committed Jul 3, 2024
1 parent ee0a28a commit eae55ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 4 additions & 7 deletions Sources/Edit/ZLClipOverlayView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ class ZLClipOverlayView: UIView {
}

shadowMaskLayer.path = getShadowMaskLayerPath().cgPath
gridLinesLayer.path = getGridLinesLayerPath().cgPath
}
}

Expand Down Expand Up @@ -168,22 +167,20 @@ class ZLClipOverlayView: UIView {
private func getGridLinesLayerPath() -> UIBezierPath {
let path = UIBezierPath()

let r = cropRect.width / 2
let diff = isCircle ? r - sqrt(pow(r, 2) - pow(r / 3, 2)) : 0
// 画竖线
let dw = cropRect.width / 3
for i in 1...2 {
let x = CGFloat(i) * dw + cropRect.minX
path.move(to: CGPoint(x: x, y: cropRect.minY + diff))
path.addLine(to: CGPoint(x: x, y: cropRect.maxY - diff))
path.move(to: CGPoint(x: x, y: cropRect.minY))
path.addLine(to: CGPoint(x: x, y: cropRect.maxY))
}

// 画横线
let dh = cropRect.height / 3
for i in 1...2 {
let y = CGFloat(i) * dh + cropRect.minY
path.move(to: CGPoint(x: cropRect.minX + diff, y: y))
path.addLine(to: CGPoint(x: cropRect.maxX - diff, y: y))
path.move(to: CGPoint(x: cropRect.minX, y: y))
path.addLine(to: CGPoint(x: cropRect.maxX, y: y))
}

return path
Expand Down
11 changes: 9 additions & 2 deletions Sources/Edit/ZLEditImageViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1143,8 +1143,15 @@ open class ZLEditImageViewController: UIViewController {
var editModel: ZLEditImageModel?

func callback() {
dismiss(animated: animate) {
self.editFinishBlock?(resImage, editModel)
// 内部自己调用,先回调在退出
if let nav = presentingViewController as? ZLImageNavController,
nav.topViewController is ZLPhotoPreviewController {
editFinishBlock?(resImage, editModel)
dismiss(animated: animate)
} else {
dismiss(animated: animate) {
self.editFinishBlock?(resImage, editModel)
}
}
}

Expand Down

0 comments on commit eae55ce

Please sign in to comment.