KMRectangleController.swift 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. //
  2. // KMRectangleController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by Niehaoyu on 2024/11/26.
  6. //
  7. import Cocoa
  8. import KMComponentLibrary
  9. class KMRectangleController: NSViewController {
  10. //Color
  11. @IBOutlet var colorBGView: NSView!
  12. @IBOutlet var colorLabel: NSTextField!
  13. @IBOutlet var colorGroup: ComponentCColorGroup!
  14. @IBOutlet var colorSlider: ComponentSlider!
  15. @IBOutlet var colorOpacitySelect: ComponentSelect!
  16. @IBOutlet var fillColorGroup: ComponentCColorGroup!
  17. //Line
  18. @IBOutlet var lineBGView: NSView!
  19. @IBOutlet var lineLabel: NSTextField!
  20. @IBOutlet var lineTypeSelector: ComponentCSelectorGroup!
  21. @IBOutlet var lineWidthSlider: ComponentSlider!
  22. @IBOutlet var lineWidthSelect: ComponentSelect!
  23. @IBOutlet var linedashInfoView: NSView!
  24. @IBOutlet var lineDashSlider: ComponentSlider!
  25. @IBOutlet var lineDashSelect: ComponentSelect!
  26. private let solidProperty = ComponentCSelectorProperty.init(size: .s, state: .normal, text: "", iconImage: NSImage(named: "lineStyle_solid"))
  27. private let dashProperty = ComponentCSelectorProperty.init(size: .s, state: .normal, text: "", iconImage: NSImage(named: "lineStyle_dash"))
  28. private var annotations: [CPDFAnnotation] = [] //CPDFCircleAnnotation, CPDFSquareAnnotation
  29. private var circleAnnotations: [CPDFCircleAnnotation] {
  30. get {
  31. var validAnnotations: [CPDFCircleAnnotation] = []
  32. for annotation in annotations {
  33. if annotation is CPDFCircleAnnotation {
  34. validAnnotations.append((annotation as! CPDFCircleAnnotation))
  35. }
  36. }
  37. return validAnnotations
  38. }
  39. }
  40. private var squareAnnotations: [CPDFSquareAnnotation] {
  41. get {
  42. var validAnnotations: [CPDFSquareAnnotation] = []
  43. for annotation in annotations {
  44. if annotation is CPDFSquareAnnotation {
  45. validAnnotations.append((annotation as! CPDFSquareAnnotation))
  46. }
  47. }
  48. return validAnnotations
  49. }
  50. }
  51. var pdfView: CPDFListView?
  52. var viewManager: KMPDFViewManager?
  53. //MARK: - func
  54. override func viewDidAppear() {
  55. super.viewDidAppear()
  56. colorSlider.reloadData()
  57. lineWidthSlider.reloadData()
  58. lineDashSlider.reloadData()
  59. }
  60. override func viewDidLoad() {
  61. super.viewDidLoad()
  62. // Do view setup here.
  63. setupProperty()
  64. }
  65. func setupProperty() {
  66. //Color
  67. colorLabel.stringValue = KMLocalizedString("Color")
  68. colorLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
  69. colorLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
  70. colorGroup.delegate = self
  71. fillColorGroup.delegate = self
  72. colorSlider.properties = ComponentSliderProperty(size: .m, percent: 1)
  73. colorSlider.delegate = self
  74. colorOpacitySelect.properties = ComponentSelectProperties(size: .s,
  75. state: .normal,
  76. creatable: true,
  77. text: "100%",
  78. textUnit: "%",
  79. regexString: "0123456789%")
  80. if true {
  81. var opacityItems: [ComponentMenuitemProperty] = []
  82. for string in ["25%", "50%", "75%", "100%"] {
  83. let item = ComponentMenuitemProperty(type: .normal, text: string)
  84. opacityItems.append(item)
  85. }
  86. colorOpacitySelect.updateMenuItemsArr(opacityItems)
  87. }
  88. colorOpacitySelect.delegate = self
  89. //Line
  90. lineLabel.stringValue = KMLocalizedString("Line")
  91. lineLabel.textColor = ComponentLibrary.shared.getComponentColorFromKey("colorText/2")
  92. lineLabel.font = ComponentLibrary.shared.getFontFromKey("mac/body-s-medium")
  93. lineTypeSelector.updateItemProperty([solidProperty, dashProperty])
  94. lineTypeSelector.delegate = self
  95. lineWidthSlider.properties = ComponentSliderProperty(size: .m, percent: 1)
  96. lineWidthSlider.delegate = self
  97. lineWidthSelect.properties = ComponentSelectProperties(size: .s,
  98. state: .normal,
  99. creatable: true,
  100. text: "2",
  101. textUnit: " pt",
  102. regexString: "0123456789 pt")
  103. if true {
  104. var opacityItems: [ComponentMenuitemProperty] = []
  105. for string in ["1 pt", "2 pt", "4 pt", "6 pt", "8 pt", "10 pt"] {
  106. let item = ComponentMenuitemProperty(type: .normal, text: string)
  107. opacityItems.append(item)
  108. }
  109. lineWidthSelect.updateMenuItemsArr(opacityItems)
  110. }
  111. lineWidthSelect.delegate = self
  112. lineDashSlider.properties = ComponentSliderProperty(size: .m, percent: 1)
  113. lineDashSlider.delegate = self
  114. lineDashSelect.properties = ComponentSelectProperties(size: .s,
  115. state: .normal,
  116. creatable: true,
  117. text: "2",
  118. textUnit: " pt",
  119. regexString: "0123456789 pt")
  120. if true {
  121. var opacityItems: [ComponentMenuitemProperty] = []
  122. for string in ["1 pt", "2 pt", "4 pt", "6 pt", "8 pt", "10 pt"] {
  123. let item = ComponentMenuitemProperty(type: .normal, text: string)
  124. opacityItems.append(item)
  125. }
  126. lineDashSelect.updateMenuItemsArr(opacityItems)
  127. }
  128. lineDashSelect.delegate = self
  129. }
  130. func reloadData() {
  131. guard let pdfView = self.pdfView else {
  132. return
  133. }
  134. var firstAnnotation: CPDFAnnotation?
  135. self.annotations.removeAll()
  136. let allAnnotations: [CPDFAnnotation] = pdfView.activeAnnotations as? [CPDFAnnotation] ?? []
  137. for annotation in allAnnotations {
  138. if annotation is CPDFCircleAnnotation {
  139. annotations.append((annotation as! CPDFCircleAnnotation))
  140. } else if annotation is CPDFSquareAnnotation {
  141. annotations.append((annotation as! CPDFSquareAnnotation))
  142. }
  143. }
  144. if annotations.count > 0 {
  145. firstAnnotation = annotations.first
  146. }
  147. if true {
  148. var colors: [NSColor] = []
  149. var fillColors: [NSColor] = []
  150. if let annotation = firstAnnotation {
  151. if annotation is CPDFSquareAnnotation {
  152. colors = KMAnnotationPropertiesColorManager.manager.rectangle_Colors
  153. fillColors = KMAnnotationPropertiesColorManager.manager.rectangle_Fill_Colors
  154. } else if annotation is CPDFCircleAnnotation {
  155. colors = KMAnnotationPropertiesColorManager.manager.circle_Colors
  156. fillColors = KMAnnotationPropertiesColorManager.manager.circle_Fill_Colors
  157. }
  158. } else if viewManager?.subToolMode == .Rectangle {
  159. colors = KMAnnotationPropertiesColorManager.manager.rectangle_Colors
  160. fillColors = KMAnnotationPropertiesColorManager.manager.rectangle_Fill_Colors
  161. } else if viewManager?.subToolMode == .Circle {
  162. colors = KMAnnotationPropertiesColorManager.manager.circle_Colors
  163. fillColors = KMAnnotationPropertiesColorManager.manager.circle_Fill_Colors
  164. }
  165. if colors.count > 4 {
  166. let colorAProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: colors[0])
  167. let colorBProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: colors[1])
  168. let colorCProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: colors[2])
  169. let colorDProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: colors[3])
  170. let colorEProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: true, color: colors[4])
  171. colorGroup.setUpWithColorPropertys([colorAProperty, colorBProperty, colorCProperty, colorDProperty], customItemProperty: colorEProperty)
  172. }
  173. if fillColors.count > 4 {
  174. let colorAProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: fillColors[0])
  175. let colorBProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: fillColors[1])
  176. let colorCProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: fillColors[2])
  177. let colorDProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: false, color: fillColors[3])
  178. let colorEProperty = ComponentCColorProperty(colorType: .color, state: .normal, isCustom: true, color: fillColors[4])
  179. fillColorGroup.setUpWithColorPropertys([colorAProperty, colorBProperty, colorCProperty, colorDProperty], customItemProperty: colorEProperty)
  180. }
  181. }
  182. var _borderColor: NSColor?
  183. var _fillColor: NSColor?
  184. var _opacity: CGFloat?
  185. var _borderStyle: CPDFBorderStyle?
  186. var _borderWidth: CGFloat?
  187. var _borderDashWidth: CGFloat?
  188. if let annotation = firstAnnotation {
  189. _borderColor = annotation.color
  190. if annotation is CPDFCircleAnnotation {
  191. _fillColor = (annotation as! CPDFCircleAnnotation).interiorColor
  192. } else if annotation is CPDFSquareAnnotation {
  193. _fillColor = (annotation as! CPDFSquareAnnotation).interiorColor
  194. }
  195. _opacity = annotation.opacity
  196. let border: CPDFBorder = annotation.border ?? CPDFBorder()
  197. _borderStyle = border.style
  198. _borderWidth = border.lineWidth
  199. if border.style == .dashed {
  200. var dash = 1.0
  201. for dashPattern in border.dashPattern {
  202. if let value = dashPattern as? CGFloat {
  203. dash = value
  204. break
  205. }
  206. }
  207. _borderDashWidth = dash
  208. }
  209. if annotations.count > 1 {
  210. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .color) == true {
  211. _borderColor = nil
  212. }
  213. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .interiorColor) == true {
  214. _fillColor = nil
  215. }
  216. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .opacity) {
  217. _opacity = nil
  218. }
  219. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .border_Style) {
  220. _borderStyle = nil
  221. }
  222. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .line_Width) {
  223. _borderWidth = nil
  224. }
  225. if CPDFListView.isAnnotationsContainMultiType(annotations, withType: .dash_Pattern) {
  226. _borderDashWidth = nil
  227. }
  228. }
  229. } else {
  230. if viewManager?.subToolMode == .Rectangle {
  231. _borderColor = CPDFSquareAnnotation.defaultColor()
  232. _fillColor = CPDFSquareAnnotation.defaultInteriorColor()
  233. _opacity = CPDFSquareAnnotation.defaultOpacity()
  234. let border: CPDFBorder = CPDFSquareAnnotation.defaultBorder()
  235. _borderStyle = border.style
  236. _borderWidth = border.lineWidth
  237. if border.style == .dashed {
  238. var dash = 1.0
  239. for dashPattern in border.dashPattern {
  240. if let value = dashPattern as? CGFloat {
  241. dash = value
  242. break
  243. }
  244. }
  245. _borderDashWidth = dash
  246. }
  247. } else if viewManager?.subToolMode == .Circle {
  248. _borderColor = CPDFCircleAnnotation.defaultColor()
  249. _fillColor = CPDFCircleAnnotation.defaultInteriorColor()
  250. _opacity = CPDFCircleAnnotation.defaultOpacity()
  251. let border: CPDFBorder = CPDFCircleAnnotation.defaultBorder()
  252. _borderStyle = border.style
  253. _borderWidth = border.lineWidth
  254. if border.style == .dashed {
  255. var dash = 1.0
  256. for dashPattern in border.dashPattern {
  257. if let value = dashPattern as? CGFloat {
  258. dash = value
  259. break
  260. }
  261. }
  262. _borderDashWidth = dash
  263. }
  264. }
  265. }
  266. colorGroup.currentColor = _borderColor
  267. colorGroup.refreshUI()
  268. fillColorGroup.currentColor = _fillColor
  269. fillColorGroup.refreshUI()
  270. if let value = _opacity {
  271. colorSlider.properties.percent = value
  272. colorOpacitySelect.properties.text = String(format: "%.0f%@", value*100, "%")
  273. } else {
  274. colorSlider.properties.percent = 0
  275. colorOpacitySelect.properties.text = "-"
  276. }
  277. colorSlider.reloadData()
  278. colorOpacitySelect.reloadData()
  279. linedashInfoView.isHidden = true
  280. dashProperty.state = .normal
  281. solidProperty.state = .normal
  282. if let value = _borderStyle {
  283. if value == .dashed {
  284. linedashInfoView.isHidden = false
  285. dashProperty.state = .pressed
  286. } else if value == .solid {
  287. solidProperty.state = .pressed
  288. }
  289. }
  290. lineTypeSelector.reloadData()
  291. if let value = _borderWidth {
  292. let percent = value/18
  293. lineWidthSlider.properties.percent = percent
  294. lineWidthSelect.properties.text = String(format: "%.0f%@", value, " pt")
  295. } else {
  296. lineWidthSlider.properties.percent = 0
  297. lineWidthSelect.properties.text = "-"
  298. }
  299. lineWidthSlider.reloadData()
  300. lineWidthSelect.reloadData()
  301. if let value = _borderDashWidth {
  302. let percent = value / 18
  303. lineDashSlider.properties.percent = percent
  304. lineDashSelect.properties.text = String(format: "%.0f%@", value, " pt")
  305. } else {
  306. lineDashSlider.properties.percent = 0
  307. lineDashSelect.properties.text = "-"
  308. }
  309. lineDashSlider.reloadData()
  310. lineDashSelect.reloadData()
  311. }
  312. //MARK: - Mouse
  313. override func mouseDown(with event: NSEvent) {
  314. super.mouseDown(with: event)
  315. view.window?.makeFirstResponder(nil)
  316. }
  317. }
  318. //MARK: - ComponentCColorDelegate
  319. extension KMRectangleController: ComponentCColorDelegate {
  320. func componentCColorDidChooseColor(_ view: NSView, _ color: NSColor?) {
  321. if view == colorGroup {
  322. CPDFAnnotation.updateAnnotations(annotations, newColor: color, withPDFView: pdfView)
  323. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  324. CPDFCircleAnnotation.updateDefault_Color(color)
  325. }
  326. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  327. CPDFSquareAnnotation.updateDefault_Color(color)
  328. }
  329. } else if view == fillColorGroup {
  330. CPDFAnnotation.updateAnnotations(annotations, newInteriorColor: color, withPDFView: pdfView)
  331. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  332. CPDFCircleAnnotation.updateDefault_InteriorColor(color)
  333. }
  334. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  335. CPDFSquareAnnotation.updateDefault_InteriorColor(color)
  336. }
  337. }
  338. reloadData()
  339. }
  340. }
  341. //MARK: - ComponentSliderDelegate
  342. extension KMRectangleController: ComponentSliderDelegate {
  343. func componentSliderDidUpdate(_ view: ComponentSlider) {
  344. if view == colorSlider {
  345. let opacity = view.properties.percent
  346. CPDFAnnotation.updateAnnotations(annotations, newOpacity: opacity, withPDFView: pdfView)
  347. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  348. CPDFCircleAnnotation.updateDefault_Opacity(opacity)
  349. }
  350. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  351. CPDFSquareAnnotation.updateDefault_Opacity(opacity)
  352. }
  353. } else if view == lineWidthSlider {
  354. let value = view.properties.percent * 18
  355. CPDFAnnotation.updateAnnotations(annotations, newLineWidth: value, withPDFView: pdfView)
  356. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  357. CPDFCircleAnnotation.updateDefault_LineWidth(value)
  358. }
  359. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  360. CPDFSquareAnnotation.updateDefault_LineWidth(value)
  361. }
  362. } else if view == lineDashSlider {
  363. let value = view.properties.percent * 18
  364. CPDFAnnotation.updateAnnotations(annotations, newDashPattern: value, withPDFView: pdfView)
  365. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle{
  366. CPDFCircleAnnotation.updateDefault_DashPattern(value)
  367. }
  368. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  369. CPDFSquareAnnotation.updateDefault_DashPattern(value)
  370. }
  371. }
  372. reloadData()
  373. }
  374. }
  375. //MARK: - ComponentSelectDelegate
  376. extension KMRectangleController: ComponentSelectDelegate {
  377. func componentSelectTextDidEndEditing(_ view: ComponentSelect, removeUnit text: String?) {
  378. if let result = text {
  379. if view == colorOpacitySelect {
  380. let opacity = max(0, min(1, result.stringToCGFloat()/100))
  381. CPDFAnnotation.updateAnnotations(annotations, newOpacity: opacity, withPDFView: pdfView)
  382. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  383. CPDFCircleAnnotation.updateDefault_Opacity(opacity)
  384. }
  385. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  386. CPDFSquareAnnotation.updateDefault_Opacity(opacity)
  387. }
  388. } else if view == lineWidthSelect {
  389. var value = result.stringToCGFloat()
  390. if value > 18 {
  391. value = 18
  392. } else if value < 0 {
  393. value = 0
  394. }
  395. CPDFAnnotation.updateAnnotations(annotations, newLineWidth: value, withPDFView: pdfView)
  396. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  397. CPDFCircleAnnotation.updateDefault_LineWidth(value)
  398. }
  399. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  400. CPDFSquareAnnotation.updateDefault_LineWidth(value)
  401. }
  402. } else if view == lineDashSelect {
  403. var value = result.stringToCGFloat()
  404. if value > 18 {
  405. value = 18
  406. } else if value < 0 {
  407. value = 0
  408. }
  409. CPDFAnnotation.updateAnnotations(annotations, newDashPattern: value, withPDFView: pdfView)
  410. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle{
  411. CPDFCircleAnnotation.updateDefault_DashPattern(value)
  412. }
  413. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  414. CPDFSquareAnnotation.updateDefault_DashPattern(value)
  415. }
  416. }
  417. reloadData()
  418. }
  419. }
  420. func componentSelectDidSelect(view: ComponentSelect?, menuItemProperty: ComponentMenuitemProperty?) {
  421. if var result = menuItemProperty?.text {
  422. if let textUnit = view?.properties.textUnit {
  423. result = result.stringByDeleteCharString(textUnit)
  424. }
  425. if view == colorOpacitySelect {
  426. let opacity = max(0, min(1, result.stringToCGFloat()/100))
  427. CPDFAnnotation.updateAnnotations(annotations, newOpacity: opacity, withPDFView: pdfView)
  428. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  429. CPDFCircleAnnotation.updateDefault_Opacity(opacity)
  430. }
  431. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  432. CPDFSquareAnnotation.updateDefault_Opacity(opacity)
  433. }
  434. } else if view == lineWidthSelect {
  435. var value = result.stringToCGFloat()
  436. if value > 18 {
  437. value = 18
  438. } else if value < 0 {
  439. value = 0
  440. }
  441. CPDFAnnotation.updateAnnotations(annotations, newLineWidth: value, withPDFView: pdfView)
  442. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  443. CPDFCircleAnnotation.updateDefault_LineWidth(value)
  444. }
  445. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  446. CPDFSquareAnnotation.updateDefault_LineWidth(value)
  447. }
  448. } else if view == lineDashSelect {
  449. var value = result.stringToCGFloat()
  450. if value > 18 {
  451. value = 18
  452. } else if value < 0 {
  453. value = 0
  454. }
  455. CPDFAnnotation.updateAnnotations(annotations, newDashPattern: value, withPDFView: pdfView)
  456. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle{
  457. CPDFCircleAnnotation.updateDefault_DashPattern(value)
  458. }
  459. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  460. CPDFSquareAnnotation.updateDefault_DashPattern(value)
  461. }
  462. }
  463. reloadData()
  464. }
  465. }
  466. }
  467. //MARK: - ComponentCSelectorGroupDelegate
  468. extension KMRectangleController: ComponentCSelectorGroupDelegate {
  469. func componentCSelectorGroupDidChoose(_ view: ComponentCSelectorGroup, _ item: ComponentCSelectorItem) {
  470. if item.properties == solidProperty {
  471. CPDFAnnotation.updateAnnotations(annotations, newBorderStyle: .solid, withPDFView: pdfView)
  472. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  473. CPDFCircleAnnotation.updateDefault_Style(.solid)
  474. }
  475. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  476. CPDFSquareAnnotation.updateDefault_Style(.solid)
  477. }
  478. } else if item.properties == dashProperty {
  479. CPDFAnnotation.updateAnnotations(annotations, newBorderStyle: .dashed, withPDFView: pdfView)
  480. if circleAnnotations.count > 0 || viewManager?.subToolMode == .Circle {
  481. CPDFCircleAnnotation.updateDefault_Style(.dashed)
  482. }
  483. if squareAnnotations.count > 0 || viewManager?.subToolMode == .Rectangle {
  484. CPDFSquareAnnotation.updateDefault_Style(.dashed)
  485. }
  486. }
  487. reloadData()
  488. }
  489. }