Fixed delay tab error
This commit is contained in:
@@ -12,15 +12,15 @@
|
||||
max="1000"
|
||||
step="0.1"
|
||||
placeholder="Delay amount"
|
||||
class="form-control"
|
||||
[(ngModel)]="delay"
|
||||
(ngModelChange)="setDelay($event)">
|
||||
class="form-control"
|
||||
[attr.value]="delay"
|
||||
(change)="setDelay($event)">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row macro-delay__presets">
|
||||
<div class="col-xs-12">
|
||||
<h6>Choose a preset</h6>
|
||||
<button *ngFor="let delay of presets" class="btn btn-sm btn-default"(click)="setDelay(delay)">{{delay}}s</button>
|
||||
<button *ngFor="let delay of presets" class="btn btn-sm btn-default" (click)="setDelay(delay)">{{delay}}s</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,11 @@
|
||||
import { AfterViewInit, Component, ElementRef, Input, OnInit, Renderer, ViewChild } from '@angular/core';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
Component,
|
||||
ElementRef,
|
||||
Input,
|
||||
OnInit,
|
||||
ViewChild
|
||||
} from '@angular/core';
|
||||
|
||||
import { EditableMacroAction } from '../../../../../config-serializer/config-items/macro-action';
|
||||
|
||||
@@ -8,26 +15,24 @@ const INITIAL_DELAY = 0.5; // In seconds
|
||||
selector: 'macro-delay-tab',
|
||||
template: require('./macro-delay.component.html'),
|
||||
styles: [require('./macro-delay.component.scss')],
|
||||
host: { 'class': 'macro__delay' }
|
||||
host: { 'class': 'macro__delay' },
|
||||
changeDetection: ChangeDetectionStrategy.OnPush
|
||||
})
|
||||
export class MacroDelayTabComponent implements AfterViewInit, OnInit {
|
||||
export class MacroDelayTabComponent implements OnInit {
|
||||
@Input() macroAction: EditableMacroAction;
|
||||
@ViewChild('macroDelayInput') input: ElementRef;
|
||||
|
||||
private delay: number;
|
||||
/* tslint:disable:no-unused-variable: It is used in the template. */
|
||||
private presets: number[] = [0.3, 0.5, 0.8, 1, 2, 3, 4, 5];
|
||||
/* tslint:enable:no-unused-variable */
|
||||
|
||||
constructor(private renderer: Renderer) { }
|
||||
constructor() { }
|
||||
|
||||
ngOnInit() {
|
||||
this.delay = this.macroAction.delay > 0 ? this.macroAction.delay / 1000 : INITIAL_DELAY;
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.renderer.invokeElementMethod(this.input.nativeElement, 'focus');
|
||||
}
|
||||
|
||||
setDelay(value: number): void {
|
||||
this.delay = value;
|
||||
this.macroAction.delay = this.delay * 1000;
|
||||
|
||||
Reference in New Issue
Block a user