|
@@ -85,9 +85,9 @@ class KMCropPropertyController: NSViewController {
|
|
|
}
|
|
|
set {
|
|
|
_cropSeparateOn = newValue
|
|
|
-
|
|
|
+
|
|
|
UserDefaults.standard.setValue(_cropSeparateOn, forKey: "CropSeparateOnKey")
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public var cropAutoOn : Bool {
|
|
@@ -96,9 +96,9 @@ class KMCropPropertyController: NSViewController {
|
|
|
}
|
|
|
set {
|
|
|
_cropAutoOn = newValue
|
|
|
-
|
|
|
+
|
|
|
UserDefaults.standard.setValue(_cropAutoOn, forKey: "CropAutoOnKey")
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public var syncChangeBounds : Bool {
|
|
@@ -107,9 +107,9 @@ class KMCropPropertyController: NSViewController {
|
|
|
}
|
|
|
set {
|
|
|
_syncChangeBounds = newValue
|
|
|
-
|
|
|
+
|
|
|
UserDefaults.standard.setValue(_syncChangeBounds, forKey: "CropSyncChangeBoundsKey")
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
func setupProperty() {
|
|
@@ -210,6 +210,13 @@ class KMCropPropertyController: NSViewController {
|
|
|
}
|
|
|
|
|
|
func reloadData() {
|
|
|
+ //White Margin
|
|
|
+ separateSwitch.properties.open = cropSeparateOn
|
|
|
+ separateSwitch.reloadData()
|
|
|
+
|
|
|
+ autoSwitch.properties.open = cropAutoOn
|
|
|
+ autoSwitch.reloadData()
|
|
|
+
|
|
|
guard let pdfView = self.pdfView else {
|
|
|
return
|
|
|
}
|
|
@@ -220,13 +227,6 @@ class KMCropPropertyController: NSViewController {
|
|
|
let pageBounds = page.bounds
|
|
|
let selectionRect = pdfView.selectionRect
|
|
|
|
|
|
- //White Margin
|
|
|
- separateSwitch.properties.open = cropSeparateOn
|
|
|
- separateSwitch.reloadData()
|
|
|
-
|
|
|
- autoSwitch.properties.open = cropAutoOn
|
|
|
- autoSwitch.reloadData()
|
|
|
-
|
|
|
//PageSize
|
|
|
sizeWidthInput.properties.maxSize = Int(pageBounds.size.width)
|
|
|
sizeWidthInput.properties.text = String(format: "%.0f", selectionRect.size.width)
|
|
@@ -255,7 +255,7 @@ class KMCropPropertyController: NSViewController {
|
|
|
pageTopInput.properties.maxSize = Int(pageBounds.size.height)
|
|
|
pageTopInput.properties.text = String(format: "%.0f", pageBounds.size.height - CGRectGetMaxY(selectionRect))
|
|
|
pageTopInput.reloadData()
|
|
|
-
|
|
|
+
|
|
|
pageBottomInput.properties.maxSize = Int(pageBounds.size.height)
|
|
|
pageBottomInput.properties.text = String(format: "%.0f", selectionRect.origin.y)
|
|
|
pageBottomInput.reloadData()
|
|
@@ -334,7 +334,7 @@ extension KMCropPropertyController: ComponentInputNumberDelegate {
|
|
|
if let text = inputNumber?.properties.text {
|
|
|
value = text.stringToCGFloat()
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
var rect = pdfView.selectionRect
|
|
|
if inputNumber == sizeWidthInput {
|
|
|
if syncChangeBounds {
|
|
@@ -352,7 +352,7 @@ extension KMCropPropertyController: ComponentInputNumberDelegate {
|
|
|
scale = value / rect.size.height
|
|
|
}
|
|
|
rect.size.width *= scale
|
|
|
- }
|
|
|
+ }
|
|
|
rect.size.height = value
|
|
|
} else if inputNumber == pageLeftInput {
|
|
|
rect.origin.x = value
|
|
@@ -368,7 +368,7 @@ extension KMCropPropertyController: ComponentInputNumberDelegate {
|
|
|
|
|
|
cropAutoOn = false
|
|
|
cropSeparateOn = false
|
|
|
-
|
|
|
+
|
|
|
reloadData()
|
|
|
}
|
|
|
}
|