Skip to content

Commit 4598ae5

Browse files
authored
feat: navigation mode tooltips of add-on page (#2201)
* feat: navigation mode tooltips of add-on page * fix: cmd/ctrl * fix: tooltip positioning * fix: pinch to zoom
1 parent 9418aeb commit 4598ae5

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

packages/uhk-web/src/app/components/add-on/add-on.component.html

+30-8
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,24 @@ <h3 class="margin-top">Touchpad settings</h3>
220220
<circle-tooltip tooltip="Navigation mode to be triggered by the touchpad pinch zoom gesture."/>
221221
</td>
222222
<td>
223-
<div class="select-container align-slider">
224-
<ng-select [items]="pitchToZoomOptions"
225-
[ngModel]="moduleConfiguration.touchpadPinchToZoom"
226-
(ngModelChange)="onSetModuleConfigurationValue('touchpadPinchToZoom', $event)"
227-
[clearable]="false"
228-
bindLabel="label"
229-
bindValue="value"
230-
/>
223+
<div class="d-flex align-items-center gap-1">
224+
<div class="select-container align-slider">
225+
<ng-select [items]="pitchToZoomOptions"
226+
[ngModel]="moduleConfiguration.touchpadPinchToZoom"
227+
(ngModelChange)="onSetModuleConfigurationValue('touchpadPinchToZoom', $event)"
228+
[clearable]="false"
229+
bindLabel="label"
230+
bindValue="value"
231+
/>
232+
</div>
233+
<ng-template #pinchToZoomTooltip>
234+
<ul class="no-indent text-start">
235+
<li><strong>Zoom</strong>: This mode emits both the PC and Mac zoom modes. It serves as a general, OS-independent zoom mode, but one of the two zoom modes may interfere with some applications, in which case the desired PC or Mac zoom mode must be selected specifically.</li>
236+
<li><strong>Zoom PC</strong>: <kbd>Ctrl</kbd> + <kbd>+</kbd> / <kbd>Ctrl</kbd> + <kbd>-</kbd> - shortcuts are produced.</li>
237+
<li><strong>Zoom Mac</strong>: <kbd>Cmd</kbd> + <kbd>+</kbd> / <kbd>Cmd</kbd> + <kbd>-</kbd> - shortcuts are produced.</li>
238+
</ul>
239+
</ng-template>
240+
<circle-tooltip [tooltip]="pinchToZoomTooltip" width="400" placement="bottom top"/>
231241
</div>
232242
</td>
233243
</tr>
@@ -282,6 +292,18 @@ <h3>Navigation modes</h3>
282292
</td>
283293
<td>
284294
Mode
295+
<ng-template #navigationModeTooltip>
296+
<ul class="no-indent text-start">
297+
<li><strong>Cursor</strong>: Module controls mouse movement.</li>
298+
<li><strong>Scroll</strong>: Module controls scrolling.</li>
299+
<li><strong>Media</strong>: Up/down directions control volume, horizontal directions control play/pause, and switch to the next track.</li>
300+
<li><strong>Caret</strong>: Module produces arrow key taps. This can be used to move comfortably in a text editor.</li>
301+
<li><strong>Zoom PC</strong>: <kbd>Ctrl</kbd> + <kbd>+</kbd> / <kbd>Ctrl</kbd> + <kbd>-</kbd> - shortcuts are produced.</li>
302+
<li><strong>Zoom Mac</strong>: <kbd>Cmd</kbd> + <kbd>+</kbd> / <kbd>Cmd</kbd> + <kbd>-</kbd> - shortcuts are produced.</li>
303+
<li><strong>Zoom</strong>: This mode emits both the PC and Mac zoom modes. It serves as a general, OS-independent zoom mode, but one of the two zoom modes may interfere with some applications, in which case the desired PC or Mac zoom mode must be selected specifically.</li>
304+
</ul>
305+
</ng-template>
306+
<circle-tooltip [tooltip]="navigationModeTooltip" width="400" placement="bottom bottom-end"/>
285307
</td>
286308
</tr>
287309
<tr class="separator">

packages/uhk-web/src/app/components/add-on/add-on.component.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { Subscription } from 'rxjs';
55
import { UHK_MODULES } from 'uhk-common';
66
import { ModuleConfiguration, ModuleId, NavigationMode } from 'uhk-common';
77

8-
import { AppState, getSelectedModuleConfiguration } from '../../store';
8+
import { OperatingSystem } from '../../models/operating-system';
9+
import { AppState, getOperatingSystem, getSelectedModuleConfiguration } from '../../store';
910
import { SetModuleConfigurationValueAction } from '../../store/actions/user-config';
1011

1112
@Component({
@@ -80,6 +81,8 @@ export class AddOnComponent implements OnDestroy {
8081
moduleConfiguration = new ModuleConfiguration();
8182

8283
private subscription: Subscription;
84+
private osSubscription: Subscription;
85+
8386
constructor(private store:Store<AppState>,
8487
private cdRef: ChangeDetectorRef) {
8588
this.subscription = store.select(getSelectedModuleConfiguration)

packages/uhk-web/src/app/services/mapper.service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Injectable } from '@angular/core';
1+
import { Injectable, OnDestroy } from '@angular/core';
22
import { Store } from '@ngrx/store';
33
import { KeyModifiers, KeystrokeType, SecondaryRoleAction } from 'uhk-common';
44
import { Subscription } from 'rxjs';
@@ -14,7 +14,7 @@ export enum OsSpecificKeys {
1414
export type OsSpecificTexts = OsSpecificKeys | KeyModifiers;
1515

1616
@Injectable()
17-
export class MapperService {
17+
export class MapperService implements OnDestroy {
1818

1919
private basicScanCodeTextMap: Map<number, string[]>;
2020
private mediaScanCodeTextMap: Map<number, string[]>;
@@ -43,6 +43,10 @@ export class MapperService {
4343
});
4444
}
4545

46+
ngOnDestroy(): void {
47+
this.osSubscription.unsubscribe();
48+
}
49+
4650
public scanCodeToText(scanCode: number, type: KeystrokeType = KeystrokeType.basic): string[] {
4751
let map: Map<number, string[]>;
4852
let prefix: string;

0 commit comments

Comments
 (0)