LED brightness UI (#520)
* Add nouislider * Add LEDBrightnessComponent * Move LEDBrightnessComponent to correct folder * Add LED brightness page to side menu and device routes * Add LEDBrightnessComponent to device index file * Add LEDBrightnessComponent and NouisliderModule to shared module * Remove ngModelChange from LEDBrightnessComponent until onChange is implemented * Fix stylelint issue in led brightness component * Add nouislider files to webpack.config.js * Add adjusting LED brightness sliders with arrow keys * Various tweaks to LEDBrightnessComponent * Fix linting issues in LEDBrightnessComponent * Allow "::ng-deep" pseudo element in stylelint config * Add reading LED brightness settings from user configuration * led-brightness save * Move slider to its own wrapper component, add debounce for slider change events * Small fixes to imports and exports of SliderWrapperComponent * Fix slide component making change event when initial value is set * Export SliderPips interface * Fix LED Brightness slider pips * Add support for value unit in SliderWrapperComponent * Add a bit of space before LED brightness sliders so the slider handle doesn't go beyond the page in the min position * Implement onDestroy, fix slider pip values and imports in LEDBrightnessComponent * Fix imports, implement onDestroy in SliderWrapperComponent * Move fix for slider pip value style to global styles file * Reorder stylelint rules
This commit is contained in:
committed by
László Monda
parent
5ceca41e0f
commit
90f56c350e
@@ -3,6 +3,7 @@ import { Routes } from '@angular/router';
|
||||
import { DeviceConfigurationComponent } from './configuration/device-configuration.component';
|
||||
import { DeviceFirmwareComponent } from './firmware/device-firmware.component';
|
||||
import { MouseSpeedComponent } from './mouse-speed/mouse-speed.component';
|
||||
import { LEDBrightnessComponent } from './led-brightness/led-brightness.component';
|
||||
|
||||
export const deviceRoutes: Routes = [
|
||||
{
|
||||
@@ -21,6 +22,10 @@ export const deviceRoutes: Routes = [
|
||||
path: 'mouse-speed',
|
||||
component: MouseSpeedComponent
|
||||
},
|
||||
{
|
||||
path: 'led-brightness',
|
||||
component: LEDBrightnessComponent
|
||||
},
|
||||
{
|
||||
path: 'firmware',
|
||||
component: DeviceFirmwareComponent
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './configuration/device-configuration.component';
|
||||
export * from './firmware/device-firmware.component';
|
||||
export * from './mouse-speed/mouse-speed.component';
|
||||
export * from './led-brightness/led-brightness.component';
|
||||
export * from './device.routes';
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<h1>
|
||||
<i class="fa fa-sliders"></i>
|
||||
<span>LED brightness</span>
|
||||
</h1>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>LED display icon and layer texts brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="iconsAndLayerTextsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('iconsAndLayerTextsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>LED display alphanumeric segments brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="alphanumericSegmentsBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('alphanumericSegmentsBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row led-setting">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label>Key backlight brightness</label>
|
||||
<div class="slider-wrapper-container">
|
||||
<slider-wrapper
|
||||
[min]="0"
|
||||
[max]="255"
|
||||
[step]="1"
|
||||
[pips]="sliderPips"
|
||||
[(ngModel)]="keyBacklightBrightness"
|
||||
(ngModelChange)="onSetPropertyValue('keyBacklightBrightness', $event)"></slider-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,19 @@
|
||||
:host {
|
||||
overflow-y: auto;
|
||||
display: block;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
|
||||
label {
|
||||
display: block;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.led-setting {
|
||||
margin-bottom: 6rem;
|
||||
}
|
||||
|
||||
.slider-wrapper-container {
|
||||
margin-left: 1.6rem;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import { AfterViewInit, Component, OnInit, OnDestroy, ViewChildren, QueryList } from '@angular/core';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { AppState, getUserConfiguration } from '../../../store';
|
||||
import { SetUserConfigurationValueAction } from '../../../store/actions/user-config';
|
||||
import { SliderPips } from '../../slider-wrapper/slider-wrapper.component';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import { UserConfiguration } from 'uhk-common';
|
||||
|
||||
@Component({
|
||||
selector: 'device-led-brightness',
|
||||
templateUrl: './led-brightness.component.html',
|
||||
styleUrls: ['./led-brightness.component.scss'],
|
||||
host: {
|
||||
'class': 'container-fluid'
|
||||
}
|
||||
})
|
||||
export class LEDBrightnessComponent implements OnInit, OnDestroy {
|
||||
public iconsAndLayerTextsBrightness: number = 0;
|
||||
public alphanumericSegmentsBrightness: number = 0;
|
||||
public keyBacklightBrightness: number = 0;
|
||||
public sliderPips: SliderPips = {
|
||||
mode: 'positions',
|
||||
values: [0, 50, 100],
|
||||
density: 6,
|
||||
stepped: true
|
||||
};
|
||||
|
||||
private userConfig$: Store<UserConfiguration>;
|
||||
private userConfigSubscription: Subscription;
|
||||
|
||||
constructor(private store: Store<AppState>) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.userConfig$ = this.store.select(getUserConfiguration);
|
||||
this.userConfigSubscription = this.userConfig$.subscribe(config => {
|
||||
this.iconsAndLayerTextsBrightness = config.iconsAndLayerTextsBrightness;
|
||||
this.alphanumericSegmentsBrightness = config.alphanumericSegmentsBrightness;
|
||||
this.keyBacklightBrightness = config.keyBacklightBrightness;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.userConfigSubscription.unsubscribe();
|
||||
}
|
||||
|
||||
onSetPropertyValue(propertyName: string, value: number): void {
|
||||
this.store.dispatch(new SetUserConfigurationValueAction({
|
||||
propertyName,
|
||||
value
|
||||
}));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user