Skip to content

Commit

Permalink
Merge pull request #421 from DeveloperAcademy-POSTECH/Feat/#405-Split…
Browse files Browse the repository at this point in the history
…ViewSize

[Feat] SplitView 사이즈 조정 기능 구현
  • Loading branch information
minjung0067 authored Jan 13, 2025
2 parents 887772b + daef768 commit f6df2a8
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 97 deletions.
279 changes: 197 additions & 82 deletions Presentation/MainPDF/MainPDFView.swift

Large diffs are not rendered by default.

20 changes: 5 additions & 15 deletions Presentation/OriginalPaper/Floating/FloatingSplitView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ struct FloatingSplitView: View {

@EnvironmentObject var floatingViewModel: FloatingViewModel
@EnvironmentObject var focusFigureViewModel: FocusFigureViewModel
@EnvironmentObject var mainPDFViewModel: MainPDFViewModel

@ObservedObject var observableDocument: ObservableDocument

Expand All @@ -31,10 +32,11 @@ struct FloatingSplitView: View {
let isFigSelected: Bool
let isCollectionSelected: Bool
let onSelect: () -> Void
let isVertical: Bool

@State private var isSavedLocation: Bool = false

init(id: UUID, documentID: String, document: PDFDocument, head: String, isFigSelected: Bool, isCollectionSelected: Bool, onSelect: @escaping () -> Void) {
init(id: UUID, documentID: String, document: PDFDocument, head: String, isFigSelected: Bool, isCollectionSelected: Bool, onSelect: @escaping () -> Void, isVertical: Bool) {
self.document = document
_observableDocument = ObservedObject(wrappedValue: ObservableDocument(document: document))

Expand All @@ -44,10 +46,9 @@ struct FloatingSplitView: View {
self.isFigSelected = isFigSelected
self.isCollectionSelected = isCollectionSelected
self.onSelect = onSelect
self.isVertical = isVertical
}

@State private var isVertical = false

var body: some View {
GeometryReader { geometry in
VStack(spacing: 0) {
Expand All @@ -66,7 +67,7 @@ struct FloatingSplitView: View {
Button(action: {
onSelect()
}, label: {
Image(systemName: isVertical ? "arrow.left.arrow.right" : "arrow.up.arrow.down")
Image(systemName: isVertical ? "arrow.up.arrow.down" : "arrow.left.arrow.right")
.font(.system(size: 14, weight: .medium))
.foregroundStyle(.gray600)
})
Expand Down Expand Up @@ -238,17 +239,6 @@ struct FloatingSplitView: View {
}
}
.background(.gray100)
.onAppear {
updateOrientation(with: geometry)
}
.onChange(of: geometry.size) {
updateOrientation(with: geometry)
}
}
}

// 기기의 방향에 따라 isVertical 상태를 업데이트하는 함수
private func updateOrientation(with geometry: GeometryProxy) {
isVertical = geometry.size.height > geometry.size.width
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"buildCommand" : {
"command" : "build",
"skipDependencies" : false,
"style" : "buildOnly"
},
"configuredTargets" : [

],
"continueBuildingAfterErrors" : false,
"dependencyScope" : "workspace",
"enableIndexBuildArena" : false,
"hideShellScriptEnvironment" : false,
"parameters" : {
"action" : "build",
"overrides" : {

}
},
"qos" : "utility",
"schemeCommand" : "launch",
"showNonLoggedProgress" : true,
"useDryRun" : false,
"useImplicitDependencies" : false,
"useLegacyBuildLocations" : false,
"useParallelTargets" : true
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"client":{"name":"basic","version":0,"file-system":"device-agnostic","perform-ownership-analysis":"no"},"targets":{"":["<all>"]},"commands":{"<all>":{"tool":"phony","inputs":["<WorkspaceHeaderMapVFSFilesWritten>"],"outputs":["<all>"]},"P0:::Gate WorkspaceHeaderMapVFSFilesWritten":{"tool":"phony","inputs":[],"outputs":["<WorkspaceHeaderMapVFSFilesWritten>"]}}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Target dependency graph (0 target)
Binary file not shown.

0 comments on commit f6df2a8

Please sign in to comment.