Skip to content

Commit

Permalink
Tweak FormulaView layout
Browse files Browse the repository at this point in the history
  • Loading branch information
tekezo committed Jan 28, 2024
1 parent 0ae6fa8 commit edca1a5
Showing 1 changed file with 33 additions and 34 deletions.
67 changes: 33 additions & 34 deletions src/apps/SettingsWindow/src/View/DevicesGamePadSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,23 @@ struct DevicesGamePadSettingsView: View {
value: binding.gamePadXYStickFlickingInputWindowMilliseconds
)

FormulaView(
name: "X formula",
defaultValue: String(
cString: libkrbn_core_configuration_game_pad_stick_x_formula_default_value()
),
value: binding.gamePadStickXFormula
)

FormulaView(
name: "Y formula",
defaultValue: String(
cString: libkrbn_core_configuration_game_pad_stick_y_formula_default_value()
),
value: binding.gamePadStickYFormula
)
HStack {
FormulaView(
name: "X formula",
defaultValue: String(
cString: libkrbn_core_configuration_game_pad_stick_x_formula_default_value()
),
value: binding.gamePadStickXFormula
)

FormulaView(
name: "Y formula",
defaultValue: String(
cString: libkrbn_core_configuration_game_pad_stick_y_formula_default_value()
),
value: binding.gamePadStickYFormula
)
}
}.padding()
}

Expand Down Expand Up @@ -257,33 +259,30 @@ struct DevicesGamePadSettingsView: View {
}

var body: some View {
HStack {
Toggle(
isOn: $value.overwrite
) {
Text("Overwrite \(name) formula:")
.frame(maxWidth: .infinity, alignment: .leading)
}
.switchToggleStyle(controlSize: .mini, font: .callout)
.frame(width: 480.0)
VStack {
HStack {
Toggle(
isOn: $value.overwrite
) {
Text("Overwrite \(name) formula:")
}
.switchToggleStyle(controlSize: .mini, font: .callout)

VStack(alignment: .leading) {
if error {
Text("invalid formula")
.foregroundColor(Color.errorForeground)
.background(Color.errorBackground)
}

TextEditor(text: $text)
.frame(height: 200.0)
.if(!value.overwrite) {
$0
.disabled(true)
.foregroundColor(.gray)
}
Spacer()
}
.padding(.leading, 20)
.disabled(!value.overwrite)

TextEditor(text: $text)
.frame(height: 200.0)
.disabled(!value.overwrite)
.if(!value.overwrite) {
$0.foregroundColor(.gray)
}
}
.onChange(of: text) { newText in
update(byText: newText)
Expand Down

0 comments on commit edca1a5

Please sign in to comment.