From 1341fde11b354c76abe39b5559830ada5e6a06d3 Mon Sep 17 00:00:00 2001 From: Sylvain Gay Date: Fri, 16 Jun 2023 17:29:45 +0200 Subject: [PATCH] Issue #16 Done config.js to change the offset --- sample_config.js | 6 +++++- traque.js | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sample_config.js b/sample_config.js index d262b62..eec7ba3 100644 --- a/sample_config.js +++ b/sample_config.js @@ -14,5 +14,9 @@ module.exports = { "port": 9000, "key": "certif/server.key", "cert": "certif/server.crt", - "validator": validator + "validator": validator, + + // Offset for the randomization of the blurred status + "lat_ofs": 0.0005, + "long_ofs": 0.0005, } diff --git a/traque.js b/traque.js index c9961b4..1ba1b50 100644 --- a/traque.js +++ b/traque.js @@ -162,7 +162,12 @@ function color(team){ // apparent information of a team, for other only function apparent_info(equipe){ if(equipe.state.shown){ - return {"id": equipe.id, "color": color(equipe), "position": equipe.pos}; + if(equipe.state.blurred) + return {"id": equipe.id, "color": color(equipe), + "position": [parseFloat(equipe.pos[0])+config.lat_ofs*(Math.random()*2-1), + parseFloat(equipe.pos[1])+config.long_ofs*(Math.random()*2-1)]}; + else + return {"id": equipe.id, "color": color(equipe), "position": equipe.pos}; } else { return {"id": equipe.id, "color": color(equipe), "position": [0,0]}; }