JSFiddle - React, Tailwind, and code Playground
by Michael Prosser
JavaScript
var sections = Array(
{x_min:-3000,x_max:3000,z_min:-5000,z_max:5000}, // center start
{x_min:-3000,x_max:3000,z_min:5000,z_max:10000}, // center forward
{x_min:-3000,x_max:3000,z_min:-10000,z_max:-5000} // center forward
);
section = 0;
x = 0;
z = 0;
function map_sections(x,z){
var match_found = false;
for(i=0;i<sections.length;i++){
var obj = sections[i];
if(x >= obj.x_min && x <= obj.x_max){
if(z >= obj.z_min && z <= obj.z_max){
match_found = true;
if(section != i){
for(j=0;j<sections.length;j++){
if(j != i){
// turn off others
}
}
// add class to current
}
alert("added class to section" + i);
break;
}
}
}
if(!match_found){
alert("NO MATCHES");
}
}
map_sections(0,-10000);