|
@@ -26,6 +26,7 @@ class KMCropController: NSViewController {
|
|
private var coverController: KMCropCoverController?
|
|
private var coverController: KMCropCoverController?
|
|
|
|
|
|
var pdfDocument: CPDFDocument?
|
|
var pdfDocument: CPDFDocument?
|
|
|
|
+ var selectionRect: CGRect = .zero
|
|
|
|
|
|
weak open var delegate: KMCropControllerDelegate?
|
|
weak open var delegate: KMCropControllerDelegate?
|
|
|
|
|
|
@@ -74,9 +75,14 @@ class KMCropController: NSViewController {
|
|
let bounds = page?.bounds ?? CGRectZero
|
|
let bounds = page?.bounds ?? CGRectZero
|
|
|
|
|
|
documentPreview.pdfView.toolMode = .selectToolMode
|
|
documentPreview.pdfView.toolMode = .selectToolMode
|
|
- documentPreview.pdfView.displayBox = .mediaBox
|
|
|
|
- documentPreview.pdfView.selectionRect = bounds
|
|
|
|
- documentPreview.pdfView.setNeedsDisplayForVisiblePages()
|
|
|
|
|
|
+ documentPreview.pdfView.selectionPageIndex = 0
|
|
|
|
+
|
|
|
|
+ if CGRectEqualToRect(selectionRect, CGRectZero) {
|
|
|
|
+ selectionRect = bounds
|
|
|
|
+ } else {
|
|
|
|
+ documentPreview.pdfView.selectionRect = selectionRect
|
|
|
|
+ documentPreview.pdfView.setNeedsDisplayForVisiblePages()
|
|
|
|
+ }
|
|
|
|
|
|
propertyController.pdfView = documentPreview.pdfView
|
|
propertyController.pdfView = documentPreview.pdfView
|
|
propertyController.reloadData()
|
|
propertyController.reloadData()
|