altpro
Advanced tools
Comparing version 0.2.0 to 0.2.1
0.2.1 / 2019-02-07 | ||
================== | ||
* ignore entries with no elevation | ||
0.2.0 / 2019-02-04 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -49,8 +49,13 @@ const findSegment = require('./find-segment'); | ||
ctx.moveTo(0, first.elevation - ref); | ||
ctx.moveTo(0, first.elevation === undefined ? 0 : (first.elevation - ref)); | ||
for(let i = 1; i < items.length; i++) { | ||
const { elevation, distance } = items[i]; | ||
ctx.lineTo(distance, elevation - ref); | ||
if (elevation !== undefined) { | ||
ctx.lineTo(distance, elevation - ref); | ||
} | ||
} | ||
if (last.elevation === undefined) { | ||
ctx.lineTo(last.distance, 0); | ||
} | ||
@@ -69,4 +74,8 @@ ctx.stroke(); | ||
ctx.moveTo(d1, 0); | ||
ctx.lineTo(d1, e1 - ref); | ||
ctx.lineTo(d2, e2 - ref); | ||
if (e1 !== undefined) { | ||
ctx.lineTo(d1, e1 - ref); | ||
} | ||
if (e2 !== undefined) { | ||
ctx.lineTo(d2, e2 - ref); | ||
} | ||
ctx.lineTo(d2, 0); | ||
@@ -232,6 +241,11 @@ ctx.closePath(); | ||
function displayLabel({ elevation }) { | ||
if (unit === 'ft') { | ||
elevation *= 3.28084; | ||
if (elevation !== undefined) { | ||
if (unit === 'ft') { | ||
elevation *= 3.28084; | ||
} | ||
elevation = Math.round(elevation); | ||
} | ||
elevation = Math.round(elevation); | ||
else { | ||
elevation = ''; | ||
} | ||
label.innerText = `${elevation}`; | ||
@@ -238,0 +252,0 @@ label.hidden = false; |
{ | ||
"name": "altpro", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Elevation profile widget.", | ||
@@ -5,0 +5,0 @@ "author": { |
11887
328