KMLeftSideViewController+Search.swift 909 B

12345678910111213141516171819202122232425262728
  1. //
  2. // KMLeftSideViewController+Search.swift
  3. // PDF Master
  4. //
  5. // Created by tangchao on 2023/12/24.
  6. //
  7. import Foundation
  8. // MARK: - Menu
  9. extension KMLeftSideViewController {
  10. @objc func addAnnotationsForSelections(_ sender: NSMenuItem) {
  11. guard let selections = sender.representedObject as? [CPDFSelection], selections.count > 0 else {
  12. return
  13. }
  14. for selection in selections {
  15. self.listView.addAnnotation(with: CAnnotationType(rawValue: sender.tag) ?? .circle, selection: selection, page: selection.page, bounds: selection.bounds)
  16. }
  17. }
  18. @objc func selectSelections(_ sender: NSMenuItem) {
  19. guard let selections = sender.representedObject as? [CPDFSelection], selections.count > 0 else {
  20. return
  21. }
  22. self.listView.currentSelection = CPDFSelection.selectionByAddingSelections(selections as NSArray)
  23. }
  24. }