修改键盘UI

This commit is contained in:
2025-11-20 20:17:19 +08:00
parent b2994adc1c
commit 8296ac12b6
4 changed files with 46 additions and 20 deletions

View File

@@ -226,6 +226,10 @@
title:@"⇧"
output:@""
type:KBKeyTypeShift];
// Shift
// - shift.caseVariant = Lower 使 KBSkinIconMap "shift"
// - shift.caseVariant = Upper 使 "shift_upper"
shift.caseVariant = self.shiftOn ? KBKeyCaseVariantUpper : KBKeyCaseVariantLower;
[row3 addObject:shift];
for (NSString *s in r3chars) {
NSString *shown = self.shiftOn ? s : s.lowercaseString;
@@ -357,14 +361,35 @@
//
KBKeyButton *firstChar = nil;
BOOL hasCharacterInRow = NO;
for (KBKeyButton *b in row.subviews) {
if ([b isKindOfClass:[KBKeyButton class]] && b.key.type == KBKeyTypeCharacter) { firstChar = b; break; }
if (![b isKindOfClass:[KBKeyButton class]]) continue;
if (b.key.type == KBKeyTypeCharacter) {
firstChar = b;
hasCharacterInRow = YES;
break;
}
}
// 使
if (!firstChar) {
for (KBKeyButton *b in row.subviews) { if ([b isKindOfClass:[KBKeyButton class]]) { firstChar = b; break; } }
for (KBKeyButton *b in row.subviews) {
if ([b isKindOfClass:[KBKeyButton class]]) {
firstChar = b;
break;
}
}
}
if (firstChar) {
// 123/ABC/AI/#+=
// 1:1 123/ABC
if (!hasCharacterInRow &&
(firstChar.key.type == KBKeyTypeModeChange ||
firstChar.key.type == KBKeyTypeSymbolsToggle ||
firstChar.key.type == KBKeyTypeCustom)) {
[firstChar mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(firstChar.mas_height);
}];
}
for (KBKeyButton *b in row.subviews) {
if (![b isKindOfClass:[KBKeyButton class]]) continue;
// firstChar
@@ -372,30 +397,30 @@
if (b == firstChar) continue;
if (b.key.type == KBKeyTypeCharacter) continue;
// Shift Backspace 1:1 =
//
if (b.key.type == KBKeyTypeShift || b.key.type == KBKeyTypeBackspace) {
// 1:1
// - ShiftBackspace
// - 123/ABCModeChange#+=SymbolsToggleAICustom
BOOL isBottomModeKey = (b.key.type == KBKeyTypeModeChange) ||
(b.key.type == KBKeyTypeSymbolsToggle) ||
(b.key.type == KBKeyTypeCustom);
if (b.key.type == KBKeyTypeShift ||
b.key.type == KBKeyTypeBackspace ||
isBottomModeKey) {
[b mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.equalTo(b.mas_height);
make.width.equalTo(b.mas_height); // =
}];
continue;
}
CGFloat multiplier = 1.5;
// Space
// Space 4.0 3.0
if (b.key.type == KBKeyTypeSpace) {
multiplier = 4.0;
multiplier = 3.0;
}
// Send 2.6
// Send 2.4
else if (b.key.type == KBKeyTypeReturn) {
multiplier = 2.6;
}
// 123/ABC#+=AI1
else if (b.key.type == KBKeyTypeModeChange ||
b.key.type == KBKeyTypeSymbolsToggle ||
b.key.type == KBKeyTypeCustom) {
multiplier = 1.0;
multiplier = 2.4;
}
// Globe
else if (b.key.type == KBKeyTypeGlobe) {