Skip to content

Commit

Permalink
Move game control toolbar to status bar
Browse files Browse the repository at this point in the history
- Moved the game control items to the status bar to maximize the space available for the Goban board, enhancing user experience.
- Updated the ToolbarItems to StatusToolbarItems in the ToolbarView for appropriate naming.
  • Loading branch information
ChinChangYang committed Aug 5, 2024
1 parent ccf727c commit b02c49c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 35 deletions.
22 changes: 5 additions & 17 deletions ios/KataGo iOS/KataGo iOS/GobanView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,7 @@ struct GobanItems: View {
} else if isConfigPresented {
ConfigView(config: gameRecord.config, isBoardSizeChanged: $isBoardSizeChanged)
} else {
if hSizeClass == .compact && vSizeClass == .regular {
VStack {
BoardView(config: gameRecord.config)
HStack {
ToolbarItems(gameRecord: gameRecord)
}
.padding()
}
} else {
HStack {
BoardView(config: gameRecord.config)
VStack {
ToolbarItems(gameRecord: gameRecord)
}
.padding()
}
}
BoardView(config: gameRecord.config)
}
}
.toolbar {
Expand All @@ -182,6 +166,10 @@ struct GobanItems: View {
isConfigPresented: $isConfigPresented,
isBoardSizeChanged: $isBoardSizeChanged)
}

ToolbarItem(placement: .status) {
StatusToolbarItems(gameRecord: gameRecord)
}
}
}
}
Expand Down
20 changes: 2 additions & 18 deletions ios/KataGo iOS/KataGo iOS/ToolbarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,62 +8,46 @@
import SwiftUI
import KataGoInterface

struct ToolbarItems: View {
struct StatusToolbarItems: View {
@EnvironmentObject var player: PlayerObject
@EnvironmentObject var gobanState: GobanState
@EnvironmentObject var board: ObservableBoard
var gameRecord: GameRecord

var body: some View {
Group {
HStack {
Button(action: passAction) {
Image(systemName: "hand.raised")
.resizable()
}
.padding()

Button(action: backwardAction) {
Image(systemName: "backward.frame")
.resizable()
}
.padding()

if gobanState.analysisStatus == .pause {
Button(action: startAnalysisAction) {
Image(systemName: "sparkle")
.resizable()
}
.padding()
} else if gobanState.analysisStatus == .run {
Button(action: stopAction) {
Image(systemName: "sparkle")
.resizable()
.symbolEffect(.variableColor.iterative.reversing, isActive: true)
}
.padding()
} else {
Button(action: pauseAnalysisAction) {
Image(systemName: "sparkle")
.resizable()
.foregroundColor(.red)
}
.padding()
}

Button(action: forwardAction) {
Image(systemName: "forward.frame")
.resizable()
}
.padding()

Button(action: clearBoardAction) {
Image(systemName: "clear")
.resizable()
}
.padding()
}
.scaledToFit()
.frame(maxWidth: 60)
}

func passAction() {
Expand Down

0 comments on commit b02c49c

Please sign in to comment.