Skip to content

Commit

Permalink
feat: Pan & Zoom feature, quite buggy now
Browse files Browse the repository at this point in the history
  • Loading branch information
tatsuz0u committed May 23, 2021
1 parent 875ba81 commit 12f6c6f
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 64 deletions.
1 change: 1 addition & 0 deletions EhPanda/App/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct Defaults {
static var avatarScale: CGFloat = 1/1
static var headerScale: CGFloat = 8/11
static var previewScale: CGFloat = 32/45
static var contentHScale: CGFloat = 7/10

static var rowW: CGFloat = rowH * rowScale
static var rowH: CGFloat = 110
Expand Down
1 change: 1 addition & 0 deletions EhPanda/DataFlow/AppAction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ enum AppAction {
case initiateSetting
case cleanDetailViewCommentContent
case cleanCommentViewCommentContent
case saveAspectBox(gid: String, box: [Int: CGFloat])
case saveReadingProgress(gid: String, tag: Int)
case updateDiskImageCacheSize(size: String)
case updateAppIconType(iconType: IconType)
Expand Down
3 changes: 3 additions & 0 deletions EhPanda/DataFlow/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ extension AppState {
items?[gid]?.contents?.sort { $0.tag < $1.tag }
}
}
mutating func insertAspectBox(gid: String, box: [Int: CGFloat]) {
items?[gid]?.detail?.aspectBox = box
}
mutating func insertReadingProgress(gid: String, progress: Int) {
items?[gid]?.detail?.readingProgress = progress
}
Expand Down
2 changes: 2 additions & 0 deletions EhPanda/DataFlow/Store.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ final class Store: ObservableObject {
appState.settings.filter = Filter()
case .initiateSetting:
appState.settings.setting = Setting()
case .saveAspectBox(let gid, let box):
appState.cachedList.insertAspectBox(gid: gid, box: box)
case .saveReadingProgress(let gid, let tag):
appState.cachedList.insertReadingProgress(gid: gid, progress: tag)
case .updateDiskImageCacheSize(let size):
Expand Down
1 change: 1 addition & 0 deletions EhPanda/Models/Manga.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ struct MangaDetail: Codable {
var readingProgress: Int?
var currentPageNum = 0
var pageNumMaximum = 1
var aspectBox = [Int: CGFloat]()

var isFavored: Bool
var archiveURL: String?
Expand Down
Loading

0 comments on commit 12f6c6f

Please sign in to comment.