fix simulator y value

This commit is contained in:
Peli de Halleux 2017-02-06 14:41:24 -08:00
parent 991aa40f19
commit 0c0c1cdd73

View File

@ -1728,7 +1728,7 @@ namespace pxsim.visuals {
let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3); let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3);
let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023))); let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023)));
let y = Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023))); let y = - Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023)));
let z2 = 1023 * 1023 - x * x - y * y; let z2 = 1023 * 1023 - x * x - y * y;
let z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2))); let z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2)));