Commit f62062f9 authored by Andres Käver's avatar Andres Käver
Browse files

small fixes

parent c942d0cf
Pipeline #796 passed with stages
in 1 minute and 14 seconds
......@@ -45,3 +45,8 @@ export function decimalToHex(d: number, padding? : number | null): string {
return hex;
}
export function roundToPrecision(x: number, precision?: number): number {
const y = +x + (precision === undefined ? 0.5 : precision/2);
return y - (y % (precision === undefined ? 1 : +precision));
}
......@@ -35,7 +35,7 @@ function addToBucket(buckets: L.LatLngExpression[][][], bucketNo: number, latLon
return buckets;
}
// minSpeed and maxSpeed - seconds per km
export function getColorCodedPolylines(locations: IGpsLocation[], minPace: number = 6, maxPace: number = 10, paceBuckets: number = 256): L.LatLngExpression[][][] {
export function getColorCodedPolylines(locations: IGpsLocation[], minPace: number = 6, maxPace: number = 18, paceBuckets: number = 256): L.LatLngExpression[][][] {
if (!locations || locations.length == 0) return [];
const result: L.LatLngExpression[][][] = [];
......
......@@ -43,9 +43,9 @@ export class HomeIndex {
constructor(private gpsSessionService: GpsSessionService, private gpsLocationService: GpsLocationService) {
this.paceColorGradient = gradstop({
stops: 1024,
stops: 256,
inputFormat: 'hex',
colorArray: ['#00FF00', '#FFFF00', '#FF0000']
colorArray: ['#00FF00', '#FFFF00', '#FF0000']
});
}
......@@ -166,7 +166,7 @@ export class HomeIndex {
const polylinePoints: L.LatLngExpression[] = [];
this.trackLength = 0;
const paceBuckets = getColorCodedPolylines(this.gpsLocations, 6, 18, 1024);
const paceBuckets = getColorCodedPolylines(this.gpsLocations, 6, 18, this.paceColorGradient.length);
this.gpsLocations.forEach((location, index) => {
polylinePoints.push([location.latitude, location.longitude]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment