Skip to content

Commit 3c6c8bd

Browse files
refactor(webapp): add 'on' and 'off' states for Toggle Cursor Button (#1337)
1 parent 6fa5b62 commit 3c6c8bd

10 files changed

Lines changed: 52 additions & 7 deletions

File tree

webapp/src/client/app/modules/web-client/ard/web-client-ard.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<session-toolbar
1111
[sessionContainerParent]="sessionContainerElement"
1212
[middleButtons]="middleToolbarButtons"
13+
[middleToggleButtons]="middleToolbarToggleButtons"
1314
[rightButtons]="rightToolbarButtons">
1415
</session-toolbar>
1516

webapp/src/client/app/modules/web-client/ard/web-client-ard.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ export class WebClientArdComponent extends WebClientBaseComponent implements OnI
7878
icon: 'dvl-icon dvl-icon-screen',
7979
action: () => this.scaleTo(this.screenScale.Real),
8080
},
81+
];
82+
83+
middleToolbarToggleButtons = [
8184
{
8285
label: 'Toggle Cursor Kind',
83-
icon: 'dvl-icon dvl-icon-toggle',
86+
icon: 'dvl-icon dvl-icon-cursor',
8487
action: () => this.toggleCursorKind(),
88+
isActive: () => !this.cursorOverrideActive,
8589
},
8690
];
8791

webapp/src/client/app/modules/web-client/form/form-controls/enable-display-configuration-control/enable-display-configuration-control.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component, Input, OnInit } from '@angular/core';
22
import { FormGroup } from '@angular/forms';
33

44
import { BaseComponent } from '@shared/bases/base.component';
5+
import { ArdQualityMode } from '@shared/enums/ard-quality-mode.enum';
56
import { WebFormService } from '@shared/services/web-form.service';
67

78
@Component({

webapp/src/client/app/modules/web-client/rdp/web-client-rdp.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[sessionContainerParent]="sessionContainerElement"
1212
[leftButtons]="leftToolbarButtons"
1313
[middleButtons]="middleToolbarButtons"
14+
[middleToggleButtons]="middleToolbarToggleButtons"
1415
[rightButtons]="rightToolbarButtons"
1516
[checkboxes]="checkboxes">
1617
</session-toolbar>

webapp/src/client/app/modules/web-client/rdp/web-client-rdp.component.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export class WebClientRdpComponent extends WebClientBaseComponent implements OnI
6464
rdpError: { kind: string; backtrace: string };
6565
isFullScreenMode = false;
6666
showToolbarDiv = true;
67+
useUnicodeKeyboard = false;
6768
cursorOverrideActive = false;
6869

6970
leftToolbarButtons = [
@@ -90,10 +91,14 @@ export class WebClientRdpComponent extends WebClientBaseComponent implements OnI
9091
icon: 'dvl-icon dvl-icon-screen',
9192
action: () => this.scaleTo(this.screenScale.Real),
9293
},
94+
];
95+
96+
middleToolbarToggleButtons = [
9397
{
9498
label: 'Toggle Cursor Kind',
9599
icon: 'dvl-icon dvl-icon-cursor',
96100
action: () => this.toggleCursorKind(),
101+
isActive: () => !this.cursorOverrideActive,
97102
},
98103
];
99104

@@ -108,8 +113,11 @@ export class WebClientRdpComponent extends WebClientBaseComponent implements OnI
108113
checkboxes = [
109114
{
110115
label: 'Unicode Keyboard Mode',
111-
checked: false,
112-
action: (checked: boolean) => this.setKeyboardUnicodeMode(checked),
116+
action: () => {
117+
this.useUnicodeKeyboard = !this.useUnicodeKeyboard;
118+
this.setKeyboardUnicodeMode(this.useUnicodeKeyboard);
119+
},
120+
isChecked: () => this.useUnicodeKeyboard,
113121
},
114122
];
115123

webapp/src/client/app/modules/web-client/vnc/web-client-vnc.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[sessionContainerParent]="sessionContainerElement"
1212
[leftButtons]="leftToolbarButtons"
1313
[middleButtons]="middleToolbarButtons"
14+
[middleToggleButtons]="middleToolbarToggleButtons"
1415
[rightButtons]="rightToolbarButtons">
1516
</session-toolbar>
1617

webapp/src/client/app/modules/web-client/vnc/web-client-vnc.component.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,14 @@ export class WebClientVncComponent extends WebClientBaseComponent implements OnI
9898
icon: 'dvl-icon dvl-icon-screen',
9999
action: () => this.scaleTo(this.screenScale.Real),
100100
},
101+
];
102+
103+
middleToolbarToggleButtons = [
101104
{
102105
label: 'Toggle Cursor Kind',
103-
icon: 'dvl-icon dvl-icon-toggle',
106+
icon: 'dvl-icon dvl-icon-cursor',
104107
action: () => this.toggleCursorKind(),
108+
isActive: () => !this.cursorOverrideActive,
105109
},
106110
];
107111

webapp/src/client/app/shared/components/session-toolbar/session-toolbar.component.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,25 @@
3434
<div class="separator" *ngIf="!last"></div>
3535

3636
</ng-container>
37+
38+
<div class="separator" *ngIf="middleToggleButtons.length > 0"></div>
39+
40+
<ng-container *ngFor="let button of middleToggleButtons; let i = index; let last = last">
41+
<p-button (click)="button.action()"
42+
[label]="button.label"
43+
[icon]="button.icon"
44+
iconPos="left"
45+
[styleClass]="button.isActive() ? '' : 'p-button-inactive'">
46+
</p-button>
47+
48+
<div class="separator" *ngIf="!last"></div>
49+
50+
</ng-container>
3751
</div>
3852

3953
<div class="session-toolbar-middle-group" *ngIf="checkboxes.length > 0">
4054
<ng-container *ngFor="let checkbox of checkboxes; let i = index; let last = last">
41-
<p-checkbox [(ngModel)]="checkbox.checked" (onChange)="checkbox.action(checkbox.checked)"
55+
<p-checkbox (onChange)="checkbox.action()"
4256
[label]="checkbox.label" [binary]="true"></p-checkbox>
4357

4458
<div class="separator" *ngIf="checkboxes.length > 1 && !last"></div>

webapp/src/client/app/shared/components/session-toolbar/session-toolbar.component.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,7 @@
7676
flex-direction: column;
7777
height: 100%;
7878
}
79+
80+
::ng-deep .p-button-inactive .p-button-icon {
81+
color: gray !important;
82+
}

webapp/src/client/app/shared/components/session-toolbar/session-toolbar.component.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ export class SessionToolbarComponent {
2121
action: () => void;
2222
}[] = [];
2323

24+
@Input() middleToggleButtons: {
25+
label: string;
26+
icon: string;
27+
action: () => void;
28+
isActive: () => boolean;
29+
}[] = [];
30+
2431
@Input() rightButtons: {
2532
label: string;
2633
icon: string;
@@ -29,8 +36,8 @@ export class SessionToolbarComponent {
2936

3037
@Input() checkboxes: {
3138
label: string;
32-
checked: boolean;
33-
action: (checked: boolean) => void;
39+
action: () => void;
40+
isChecked: () => boolean;
3441
}[] = [];
3542

3643
isFullScreenMode = false;

0 commit comments

Comments
 (0)