Skip to content

Commit

Permalink
Support localization #72: Zoom in PDF view.
Browse files Browse the repository at this point in the history
  • Loading branch information
filimo committed Jan 13, 2020
1 parent 0d92e25 commit bb6bd61
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import SwiftUI
func updateNSView(_: PDFView, context: Context) {
if url == "" || Self.pdfView.document?.documentURL?.absoluteString == url { return }
if let url = URL(string: url) {
Self.pdfView.scaleFactor = PdfStore.shared.pdfZoom.cgFloatValue
Self.pdfView.scaleFactor = PdfStore.shared.pdfZoom
Self.pdfView.document = PDFDocument(url: url)
Self.pdfView.delegate = context.coordinator
}
Expand Down
4 changes: 2 additions & 2 deletions ReaderTranslator/Stores/PdfStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ final class PdfStore: ObservableObject {
@Published(wrappedValue: nil, key: "pdfAudio") var pdfAudio: URL?
@Published(key: "lastPdf") var lastPdf: String = ""
@Published(key: "lastPdfPage") var lastPdfPage = "1"
@Published(key: "pdfZoom") var pdfZoom = "1" {
@Published(key: "pdfZoom") var pdfZoom: CGFloat = 1 {
didSet {
PDFKitViewRepresentable.pdfView.scaleFactor = pdfZoom.cgFloatValue
PDFKitViewRepresentable.pdfView.scaleFactor = pdfZoom
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct ReaderView_Pdf_Toolbar: View {
private var zoomView: some View {
HStack {
Text(" Zoom: ")
TextField(" ", text: self.$pdfStore.pdfZoom)
TextField("www", value: self.$pdfStore.pdfZoom, formatter: NumberFormatter.localCGFloat)
.fixedSize()
.textFieldStyle(RoundedBorderTextFieldStyle())
}
Expand Down
2 changes: 1 addition & 1 deletion ReaderTranslatorMac/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.8.10</string>
<string>1.8.11</string>
<key>CFBundleVersion</key>
<string>1800</string>
<key>LSApplicationCategoryType</key>
Expand Down

0 comments on commit bb6bd61

Please sign in to comment.