Skip to content

Commit

Permalink
perroenpista: fix logo reload and F/T/R/E/N data handling
Browse files Browse the repository at this point in the history
Need to clear canvas before repaint new logo
Also add parsing of "datos" event to handle FTR
  • Loading branch information
jonsito committed Jul 19, 2021
1 parent e750a6b commit 85cbfe7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 3 additions & 2 deletions agility/livestream/perroenpista.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@

function initialize() {
// initialize logo canvas
var c = document.getElementById("pp_Logo");
var ctx = c.getContext("2d");
var canvas = document.getElementById("pp_Logo");
var ctx = canvas.getContext("2d");
ac_config.myImage = new Image(150,150);
ac_config.myImage.onload = function() { ctx.drawImage(ac_config.myImage, 0, 0); };

Expand Down Expand Up @@ -84,6 +84,7 @@ <h4><span id="pp_NombreRing"></span><br/></h4>
Tocados: <span id="pp_Toc"></span><br/>
Eliminado: <span id="pp_Eli"></span><br/>
No Presentado: <span id="pp_NPr"></span><br/>
Tiempo final: <span id="pp_Tim"></span><br/>
<p>

</p>
Expand Down
14 changes: 12 additions & 2 deletions agility/livestream/perroenpista.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,21 @@ function parseEvent(entry) {
case "llamada":
// ajustamos logo y timestamp
$('#pp_Timestamp').html(entry.Timestamp);
var canvas = document.getElementById("pp_Logo");
ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ac_config.myImage.src="../ajax/database/clubFunctions.php?Operation=getLogoByPerro&Federation=0&Perro="+data['Dog'];
lista=['Drs','Nombre','NombreLargo','NombreGuia','NombreClub','NombreEquipo',"Categoria",'Grado'];
// no break;
// no break
case "aceptar":
lista=lista.concat(['Flt','Toc','Reh','Eli','NPr']);
lista=lista.concat(['Flt','Toc','Reh','Eli','NPr','Tim']);
break;
case "datos": // -1: no change; else data
if (data['Flt']>=0 ) lista=lista.concat(['Flt']);
if (data['Toc']>=0 ) lista=lista.concat(['Toc']);
if (data['Reh']>=0 ) lista=lista.concat(['Reh']);
if (data['Eli']>=0 ) lista=lista.concat(['Eli']);
if (data['NPr']>=0 ) lista=lista.concat(['NPr']);
break;
}
// rellenamos pagina
Expand Down

0 comments on commit 85cbfe7

Please sign in to comment.