|
@@ -209,7 +209,7 @@ import Foundation
|
|
|
}
|
|
|
|
|
|
if (isDashed) {
|
|
|
- let pattern: [CGFloat] = [5.0, 5.0]
|
|
|
+ let pattern: [CGFloat] = [2.0, 2.0]
|
|
|
path.setLineDash(pattern, count: 2, phase: 0.0)
|
|
|
}
|
|
|
color?.setStroke()
|
|
@@ -339,56 +339,6 @@ import Foundation
|
|
|
|
|
|
return NSUnionRect(super.displayRectForBounds(bounds, lineWidth: _lineWidth), NSIntegralRect(rect));
|
|
|
}
|
|
|
-
|
|
|
- override func drawSelectionHighlightForView(_ pdfView: CPDFListView, inContext context: CGContext, isHover: Bool) {
|
|
|
- super.drawSelectionHighlightForView(pdfView, inContext: context, isHover: isHover)
|
|
|
-
|
|
|
- if !self.isKind(of: KMTableAnnotation.self) {
|
|
|
- if NSIsEmptyRect(self.bounds) == false {
|
|
|
- let scale = ceil(1.0 / pdfView.unitWidth(on: self.page))
|
|
|
- var b = self.bounds
|
|
|
- var bounds = NSIntegralRect(b)
|
|
|
- var rect = NSMakeRect(0.0, 0.0, scale * NSWidth(bounds), scale * NSHeight(bounds))
|
|
|
- var image = NSImage(size: rect.size)
|
|
|
- image.lockFocus()
|
|
|
- let transform = NSAffineTransform()
|
|
|
- transform.scale(by: scale)
|
|
|
- transform.translateX(by: NSMinX(b) - NSMinX(bounds), yBy: NSMinY(b) - NSMinY(bounds))
|
|
|
- transform.concat()
|
|
|
- var path = NSBezierPath()
|
|
|
- for aPath in self.paths {
|
|
|
- guard let _path = aPath as? NSBezierPath else {
|
|
|
- continue
|
|
|
- }
|
|
|
- path.append(_path)
|
|
|
- }
|
|
|
- let lineWidth = self.lineWidth()
|
|
|
- path.lineWidth = fmax(1.0, lineWidth)
|
|
|
- path.lineJoinStyle = .round
|
|
|
- if self.borderStyle() == .dashed {
|
|
|
- path.setDashPattern(self.dashPattern() as? NSArray ?? NSArray())
|
|
|
- path.lineCapStyle = .butt
|
|
|
- } else {
|
|
|
- path.lineCapStyle = .round
|
|
|
- }
|
|
|
- NSGraphicsContext.saveGraphicsState()
|
|
|
-
|
|
|
- NSShadow.setShadowWithColor(NSColor(white: 0, alpha: 0.33333), blurRadius: 2.0, yOffset: -2.0)
|
|
|
- let color = self.color ?? .black
|
|
|
- NSColor(calibratedWhite: 0, alpha: color.alphaComponent).setStroke()
|
|
|
- path.stroke()
|
|
|
- NSGraphicsContext.restoreGraphicsState()
|
|
|
- NSGraphicsContext.current?.compositingOperation = .clear
|
|
|
- NSColor.black.setStroke()
|
|
|
- path.stroke()
|
|
|
- image.unlockFocus()
|
|
|
-
|
|
|
- let cgImage = image.cgImage(forProposedRect: &rect, context: NSGraphicsContext(cgContext: context, flipped: false), hints: nil)
|
|
|
- KMContextDrawImage(context, NSRectToCGRect(bounds), cgImage)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
override func isConvertibleAnnotation() -> Bool {
|
|
|
return true
|