|
@@ -41,7 +41,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
|
|
|
let MinCellWidth: CGFloat = 10.0
|
|
|
let MinCellHeight: CGFloat = 10.0
|
|
|
|
|
|
- var pdfView: CPDFListView = CPDFListView()
|
|
|
+ weak var pdfView: CPDFListView?
|
|
|
|
|
|
deinit {
|
|
|
KMPrint("KMTableAnnotation 释放")
|
|
@@ -479,7 +479,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
|
|
|
rect.origin.y + self.bounds.origin.y - 4,
|
|
|
rect.size.width, rect.size.height)
|
|
|
|
|
|
- let newRect = self.pdfView.convert(bounds, from: self.page)
|
|
|
+ let newRect = self.pdfView?.convert(bounds, from: self.page) ?? .zero
|
|
|
|
|
|
self.currentCell = self.cellData(with: point)
|
|
|
let cell = self.rowDataList[currentCell.row][currentCell.column]
|
|
@@ -1563,7 +1563,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
|
|
|
if let textColor = self.textView?.textColor {
|
|
|
cell.textColor = textColor
|
|
|
}
|
|
|
- cell.font = NSFont(name: (self.textView?.font!.fontName)!, size: CGFloat((self.textView?.font!.pointSize)!/self.pdfView.scaleFactor))!
|
|
|
+ cell.font = NSFont(name: (self.textView?.font!.fontName)!, size: CGFloat((self.textView?.font!.pointSize)!/(self.pdfView?.scaleFactor ?? 1)))!
|
|
|
|
|
|
let path: NSBezierPath?
|
|
|
path = self.crossLines[self.rowNumber - row - 1]
|
|
@@ -1573,7 +1573,7 @@ class KMTableAnnotation: CPDFInkAnnotation, NSTextViewDelegate {
|
|
|
// self.moveCrossLineOfIndex(index, withDistance: y)
|
|
|
}
|
|
|
self.afreshDrawLine()
|
|
|
- self.pdfView.needsDisplay = true
|
|
|
+ self.pdfView?.needsDisplay = true
|
|
|
}
|
|
|
}
|
|
|
|