Skip to content

Commit 4c85a1b

Browse files
committed
Fix displaying machines numbers
1 parent a2678ac commit 4c85a1b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

app.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ var app = {
572572
drawChart: function(){
573573
// clear previous content
574574
app.ctx.clearRect(0,0,app.w,app.h);
575+
app.ctx.oxlabels = [];
575576
// scale...
576577
app.wmax = 0;
577578
app.scale = 1;
@@ -582,7 +583,6 @@ var app = {
582583
app.scale = (app.w-2*app.f)/app.wmax;
583584

584585
app.drawXOY();
585-
app.drawScale();
586586

587587
// draw all tasks
588588
var bSplitted,aRGB;
@@ -667,7 +667,7 @@ var app = {
667667
},
668668

669669
drawXOY: function(){
670-
var ctx = app.ctx, w = app.w, h = app.h, f = app.f;
670+
var ctx = app.ctx, w = app.w, h = app.h, f = app.f, scale = app.scale;
671671
ctx.beginPath();
672672
ctx.moveTo(f,f);
673673
ctx.lineTo(w,f);
@@ -682,10 +682,8 @@ var app = {
682682
ctx.moveTo(f,h+f-20);
683683
ctx.lineTo(f+f/3,h-f);
684684
ctx.stroke();
685-
},
686685

687-
drawScale: function(){
688-
var ctx = app.ctx, f = app.f, scale = app.scale;
686+
// horizontal scale
689687
for(var i=1;i<app.wmax;i++){
690688
ctx.beginPath();
691689
ctx.moveTo(scale*i+f,f-5);
@@ -955,7 +953,10 @@ Task.prototype.drawTask = function(r,g,b,bLineToDeadlineMark){
955953
if(!app.bOneLine) {
956954
ctx.write(0,ti*20+f+15+u,"T"+this.i,"rgb(0,0,0)",10,true);
957955
} else {
958-
ctx.write(0,ti*20+f+15+u,"M"+this.M,"rgb(0,0,0)",10,true);
956+
if(!ctx.oxlabels[this.M]){
957+
ctx.oxlabels[this.M] = true;
958+
ctx.write(0,ti*20+f+15+u,"M"+this.M,"rgb(0,0,0)",10,true);
959+
}
959960
ctx.write(scale*this.s+f,ti*20+f+15+u,""+this.i,"rgb(0,0,0)",10,true);
960961
}
961962
};

0 commit comments

Comments
 (0)