feat(temperatureDragger): fix rendering issues

This commit is contained in:
Vladimir Lugovsky 2017-07-13 14:10:33 +03:00
parent 43e0e184e0
commit 5d8769205c
2 changed files with 4 additions and 2 deletions

View file

@ -21,7 +21,8 @@
<g class="toFilter" filter="url(#blurFilter)">
<path [attr.d]="arc.d" [attr.fill]="arc.color" *ngFor="let arc of styles.gradArcs"></path>
</g>
<path [attr.d]="styles.nonSelectedArc.d" [attr.fill]="styles.nonSelectedArc.color"></path>
<!-- ngFor is a quirk fix for webkit rendering issues -->
<path [attr.d]="styles.nonSelectedArc.d" [attr.fill]="styles.nonSelectedArc.color" *ngFor="let number of [0,1,2,3,4,5]"></path>
</g>
<circle [attr.cx]="styles.thumbPosition.x" [attr.cy]="styles.thumbPosition.y" [attr.r]="pinRadius"

View file

@ -30,6 +30,7 @@ export class TemperatureDraggerComponent implements AfterViewInit, OnChanges {
@Input() min: number = 0; // min output value
@Input() max: number = 100; // max output value
@Input() step = 0.1;
@Output() power = new EventEmitter<boolean>();
@ -345,7 +346,7 @@ export class TemperatureDraggerComponent implements AfterViewInit, OnChanges {
}
private toValueNumber(factor) {
return factor * (this.max - this.min) + this.min;
return Math.round(factor * (this.max - this.min) / this.step) * this.step + this.min;
}
private static toRad(angle) {