Scroll enabled for large display zoom only (#1009)

This commit is contained in:
Nathan Mattes 2023-04-13 22:39:01 +02:00
parent 4066b26030
commit e6e691b7aa
1 changed files with 17 additions and 15 deletions

View File

@ -21,6 +21,7 @@ struct ComposeContentToolbarView: View {
static var toolbarHeight: CGFloat { 48 } static var toolbarHeight: CGFloat { 48 }
@ObservedObject var viewModel: ViewModel @ObservedObject var viewModel: ViewModel
let isZoomed = (UIScreen.main.scale != UIScreen.main.nativeScale)
@State private var showingLanguagePicker = false @State private var showingLanguagePicker = false
@State private var didChangeLanguage = false @State private var didChangeLanguage = false
@ -30,7 +31,7 @@ struct ComposeContentToolbarView: View {
var body: some View { var body: some View {
HStack(spacing: .zero) { HStack(spacing: .zero) {
ScrollView(.horizontal) { ScrollView(isZoomed ? .horizontal : []) {
HStack(spacing: .zero) { HStack(spacing: .zero) {
ForEach(ComposeContentToolbarView.ViewModel.Action.allCases, id: \.self) { action in ForEach(ComposeContentToolbarView.ViewModel.Action.allCases, id: \.self) { action in
switch action { switch action {
@ -171,20 +172,21 @@ struct ComposeContentToolbarView: View {
} }
} }
} }
Spacer()
let count: Int = { Spacer()
if viewModel.isContentWarningActive { let count: Int = {
return viewModel.contentWeightedLength + viewModel.contentWarningWeightedLength if viewModel.isContentWarningActive {
} else { return viewModel.contentWeightedLength + viewModel.contentWarningWeightedLength
return viewModel.contentWeightedLength } else {
} return viewModel.contentWeightedLength
}() }
let remains = viewModel.maxTextInputLimit - count }()
let isOverflow = remains < 0 let remains = viewModel.maxTextInputLimit - count
Text("\(remains)") let isOverflow = remains < 0
.foregroundColor(Color(isOverflow ? UIColor.systemRed : UIColor.secondaryLabel)) Text("\(remains)")
.font(.system(size: isOverflow ? 18 : 16, weight: isOverflow ? .medium : .regular)) .foregroundColor(Color(isOverflow ? UIColor.systemRed : UIColor.secondaryLabel))
.accessibilityLabel(L10n.A11y.Plural.Count.charactersLeft(remains)) .font(.system(size: isOverflow ? 18 : 16, weight: isOverflow ? .medium : .regular))
.accessibilityLabel(L10n.A11y.Plural.Count.charactersLeft(remains))
} }
.padding(.leading, 4) // 4 + 12 = 16 .padding(.leading, 4) // 4 + 12 = 16