Skip to content

Commit 47471a3

Browse files
authored
fix: enhance typing behavior page (#2890)
1 parent c01915a commit 47471a3

5 files changed

Lines changed: 45 additions & 15 deletions

File tree

packages/uhk-common/src/config-serializer/config-items/advanced-secondary-role-configuration.ts

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,19 @@ export const ADVANCED_SECONDARY_ROLE_CONFIGURATION_FIELD_SET = new Set<keyof Adv
3232
export interface AdvancedSecondaryRoleConfigurationPreset {
3333
name: string;
3434
strategy: SecondaryRoleStrategy;
35+
tooltip: string;
3536
configuration: AdvancedSecondaryRoleConfiguration;
3637
}
3738

3839
export const CUSTOM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME = 'Custom';
39-
export const HRM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME = 'HRM';
40+
export const CUSTOM_ADVANCED_SECONDARY_ROLE_TOOLTIP = 'your individual settings';
4041
export const TIMEOUT_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME = 'Timeout';
4142
export const SIMPLE_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME = 'Simple';
4243

4344
export const SIMPLE_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondaryRoleConfigurationPreset = {
4445
name: SIMPLE_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME,
4546
strategy: SecondaryRoleStrategy.Simple,
47+
tooltip: 'hold while tapping another key for secondary, tap for primary',
4648
configuration: {
4749
secondaryRoleAdvancedStrategyTimeout: 1000, // TODO: Firngrod, can the timeout be disabled with the new implementation?
4850
secondaryRoleAdvancedStrategyMinimumHoldTime: 0,
@@ -56,9 +58,10 @@ export const SIMPLE_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecond
5658
}
5759
}
5860

59-
export const HRM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondaryRoleConfigurationPreset = {
60-
name: HRM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME,
61+
export const HRM_TIMEOUT_CANCEL_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondaryRoleConfigurationPreset = {
62+
name: 'HRM-timeout-cancel',
6163
strategy: SecondaryRoleStrategy.Advanced,
64+
tooltip: 'hold while tapping another key for secondary, tap for primary, hold past timeout for no action',
6265
configuration: {
6366
secondaryRoleAdvancedStrategyTimeout: 300,
6467
secondaryRoleAdvancedStrategyMinimumHoldTime: 150,
@@ -72,9 +75,27 @@ export const HRM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondary
7275
}
7376
}
7477

78+
export const HRM_TIMEOUT_SECONDARY_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondaryRoleConfigurationPreset = {
79+
name: 'HRM-timeout-secondary',
80+
strategy: SecondaryRoleStrategy.Advanced,
81+
tooltip: 'hold while tapping another key or hold past timeout for secondary, tap for primary',
82+
configuration: {
83+
secondaryRoleAdvancedStrategyTimeout: 350,
84+
secondaryRoleAdvancedStrategyMinimumHoldTime: 100,
85+
secondaryRoleAdvancedStrategyTimeoutAction: SecondaryRoleAdvancedStrategyTimeoutAction.Secondary,
86+
secondaryRoleAdvancedStrategyTimeoutType: SecondaryRoleAdvancedStrategyTimeoutType.Active,
87+
secondaryRoleAdvancedStrategyTrigger: SecondaryRoleAdvancedStrategyTriggeringEvent.Release,
88+
secondaryRoleAdvancedStrategySafetyMargin: 1,
89+
secondaryRoleAdvancedStrategyDoubletapToPrimary: true,
90+
secondaryRoleAdvancedStrategyTriggerByMouse: false,
91+
secondaryRoleAdvancedStrategyTriggerFromSameHalf: false,
92+
}
93+
}
94+
7595
export const TIMEOUT_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecondaryRoleConfigurationPreset = {
7696
name: TIMEOUT_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME,
7797
strategy: SecondaryRoleStrategy.Advanced,
98+
tooltip: 'hold until timeout for secondary, briefly tap for primary',
7899
configuration: {
79100
secondaryRoleAdvancedStrategyTimeout: 200,
80101
secondaryRoleAdvancedStrategyMinimumHoldTime: 150,
@@ -91,6 +112,7 @@ export const TIMEOUT_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET: AdvancedSecon
91112

92113
export const BUILTIN_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESETS: AdvancedSecondaryRoleConfigurationPreset[] = [
93114
SIMPLE_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET,
94-
HRM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET,
115+
HRM_TIMEOUT_CANCEL_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET,
116+
HRM_TIMEOUT_SECONDARY_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET,
95117
TIMEOUT_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET,
96118
];

packages/uhk-web/src/app/components/device/typing-behavior-page/typing-behavior-page.component.html

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ <h3>Secondary roles</h3>
2828
{{ preset.name }}
2929
</button>
3030
</div>
31+
<circle-tooltip class="mt-2 ms-1"
32+
[tooltip]="presetsTooltip"
33+
[width]="380"/>
34+
<ng-template #presetsTooltip>
35+
<ng-container *ngFor="let preset of typingBehaviorPresets; trackBy: trackPresets; let isLast = last">
36+
<p [class.mb-0]="isLast">
37+
<span class="fw-bold">{{ preset.name }}</span> - {{ preset.tooltip }}
38+
</p>
39+
</ng-container>
40+
</ng-template>
3141
</div>
3242
</div>
3343
</div>
@@ -81,8 +91,8 @@ <h5 class="fw-bold d-inline-block">Dual role key</h5>
8191
[width]="380"/>
8292
<ng-template #timeoutTypeTooltip>
8393
<p>Assume timeout leads to Primary or None:</p>
84-
<p>Active: timeout action is applied immediately when timeout is reached. Secondary role can no longer be activated after timeout was reached.</p>
85-
Passive: timeout action is delayed until release. Secondary role can still be triggered until key release.
94+
<p>activated immediately: timeout action is applied immediately when timeout is reached. Secondary role can no longer be activated after timeout was reached. Correspondence macro value: Active</p>
95+
on uninterrupted release: timeout action is delayed until release. Secondary role can still be triggered until key release. Correspondence macro value: Passive
8696
</ng-template>
8797
</td>
8898
<td>
@@ -98,10 +108,6 @@ <h5 class="fw-bold d-inline-block">Dual role key</h5>
98108
/>
99109
</div>
100110

101-
<span>
102-
activated
103-
</span>
104-
105111
<div class="timeout-action-type-container">
106112
<ng-select
107113
[clearable]="false"
@@ -209,7 +215,7 @@ <h5 class="fw-bold d-inline-block">Trigger keys</h5>
209215
</td>
210216
</tr>
211217
<tr class="separator">
212-
<td>Refuse triggers from same half
218+
<td>Suppress same-side triggers
213219
<circle-tooltip tooltip="When checked, same half keys don't trigger currently pressed secondary role keys."
214220
[width]="250"/>
215221
</td>

packages/uhk-web/src/app/components/device/typing-behavior-page/typing-behavior-page.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tbody {
77
tr {
88
td:not([colspan='2']):first-of-type {
9-
width: 25%;
9+
width: 21%;
1010
}
1111

1212
td {
@@ -30,7 +30,7 @@
3030

3131
.timeout-action-type-container {
3232
display: inline-block;
33-
width: 250px;
33+
width: 205px;
3434
}
3535
}
3636
}

packages/uhk-web/src/app/components/device/typing-behavior-page/typing-behavior-page.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ export class TypingBehaviorPage implements AdvancedSecondaryRoleConfiguration, O
6464
timeoutActionTypeDropdownOptions = [
6565
{
6666
id: SecondaryRoleAdvancedStrategyTimeoutType.Active,
67-
text: 'Immediately (active)'
67+
text: 'activated immediately'
6868
},
6969
{
7070
id: SecondaryRoleAdvancedStrategyTimeoutType.Passive,
71-
text: 'Only after Key release (passive)'
71+
text: 'on uninterrupted release'
7272
},
7373
]
7474

packages/uhk-web/src/app/store/reducers/user-configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ConnectionsAction,
1010
Constants,
1111
CUSTOM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME,
12+
CUSTOM_ADVANCED_SECONDARY_ROLE_TOOLTIP,
1213
emptyHostConnection,
1314
getDefaultHalvesInfo,
1415
HalvesInfo,
@@ -1369,6 +1370,7 @@ export const calculateTypingBehaviorPresets = (state: State): TypingBehaviorPres
13691370
result.push({
13701371
name: CUSTOM_ADVANCED_SECONDARY_ROLE_CONFIGURATION_PRESET_NAME,
13711372
strategy: SecondaryRoleStrategy.Advanced,
1373+
tooltip: CUSTOM_ADVANCED_SECONDARY_ROLE_TOOLTIP,
13721374
configuration: currentConfiguration,
13731375
selected: !hasMatches,
13741376
})

0 commit comments

Comments
 (0)