class RadioHud{ constructor(){ this.DefaultMargin = 1.5; } SetLocation(value){ this.location = value; if(value.vertical == "left"){ document.getElementById("radiostates").style.left = 0; } else if(value.vertical == "middle"){ document.getElementById("radiostates").style.right = 0; document.getElementById("radiostates").style.left = 0; document.getElementById("radiostates").style.marginLeft = "auto"; document.getElementById("radiostates").style.marginRight = "auto"; } else{ document.getElementById("radiostates").style.right = 0; } if(value.horizontal == "top"){ document.getElementById("radiostates").style.top = 0; } else if(value.horizontal == "middle"){ document.getElementById("radiostates").style.top = 0; document.getElementById("radiostates").style.bottom = 0; document.getElementById("radiostates").style.marginTop = "auto"; document.getElementById("radiostates").style.marginBottom = "auto"; } else{ document.getElementById("radiostates").style.bottom = 0; } } SetExtraMargins(value){ if(this.location.vertical != "middle"){ document.getElementById("radiostates").style.marginLeft = value.left + this.DefaultMargin + "%"; document.getElementById("radiostates").style.marginRight = value.right + this.DefaultMargin + "%"; } if(this.location.horizontal != "middle"){ document.getElementById("radiostates").style.marginTop = value.top + this.DefaultMargin + "%"; document.getElementById("radiostates").style.marginBottom = value.bottom + this.DefaultMargin + "%"; } } DrawInfo(radioDetails){ document.getElementById("radiostates_info").innerHTML = `
${radioDetails.vehicle ?? ""} | |
${radioDetails.radio ?? radioDetails.radio_default} |