-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Font annotation fixes, added custom input accessory
- Loading branch information
1 parent
78fe34c
commit 43de4a1
Showing
5 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
Zotero/Scenes/Detail/PDF/Views/CustomFreeTextAnnotationView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// CustomFreeTextAnnotationView.swift | ||
// Zotero | ||
// | ||
// Created by Michal Rentka on 02.08.2023. | ||
// Copyright © 2023 Corporation for Digital Scholarship. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
import PSPDFKit | ||
import PSPDFKitUI | ||
|
||
protocol FreeTextInputDelegate: AnyObject { | ||
func showColorPicker(sender: UIView) | ||
func showFontSizePicker(sender: UIView) | ||
func changeFontSize(size: UInt) | ||
} | ||
|
||
final class CustomFreeTextAnnotationView: FreeTextAnnotationView { | ||
weak var delegate: FreeTextInputDelegate? | ||
|
||
override func textViewForEditing() -> UITextView { | ||
let textView = super.textViewForEditing() | ||
textView.inputAccessoryView = FreeTextInputAccessory() | ||
return textView | ||
} | ||
} | ||
|
||
final class FreeTextInputAccessory: UIView { | ||
init() { | ||
super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 44)) | ||
self.autoresizingMask = .flexibleWidth | ||
self.backgroundColor = .systemBackground | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters