Skip to content

Commit 1c6c2d3

Browse files
Merge branch 'feature-canvas-graph'
* feature-canvas-graph: minimum max altitude of 2000m scale padding as well
2 parents 1041467 + d4637b4 commit 1c6c2d3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

css/main.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ header > div {
358358
#main .row .header .graph {
359359
position: absolute;
360360
bottom: -1px;
361-
right: 18px;
361+
right: 22px;
362362
width: 60px;
363363
height: 40px;
364364
}

js/tracker.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,8 @@ function convert_time(text) {
585585
}
586586

587587
function drawAltitudeProfile(c1, c2, alt_list, alt_max) {
588+
alt_max = (alt_max < 2000) ? 2000 : alt_max;
589+
588590
var ctx1 = c1.getContext("2d");
589591
var ctx2 = c2.getContext("2d");
590592

@@ -607,10 +609,10 @@ function drawAltitudeProfile(c1, c2, alt_list, alt_max) {
607609
ctx2.lineWidth = 2 * ratio;
608610
ctx2.strokeStyle= "#33B5F5";
609611

610-
var xt1 = (cw1 - 2) / alt_list.length;
611-
var yt1 = (ch1 - 6) / alt_max;
612-
var xt2 = (cw2 - 2) / alt_list.length;
613-
var yt2 = (ch2 - 6) / alt_max;
612+
var xt1 = (cw1 - (2 * ratio)) / alt_list.length;
613+
var yt1 = (ch1 - (6 * ratio)) / alt_max;
614+
var xt2 = (cw2 - (2 * ratio)) / alt_list.length;
615+
var yt2 = (ch2 - (6 * ratio)) / alt_max;
614616

615617
xt1 = (xt1 > 1) ? 1 : xt1;
616618
yt1 = (yt1 > 1) ? 1 : yt1;

0 commit comments

Comments
 (0)