added aspect ratio to every point
This commit is contained in:
parent
7b88652257
commit
d56cda9572
@ -75,12 +75,15 @@ function check_param()
|
||||
{
|
||||
let params = new URLSearchParams(window.location.search);
|
||||
img_url = params.get("img");
|
||||
x = params.get("aspect_x");
|
||||
y = params.get("aspect_y");
|
||||
|
||||
if (img_url == null)
|
||||
if (img_url == null || x == null || y == null)
|
||||
{
|
||||
alert("This link seems to be corrupted!");
|
||||
open("../index.html", "_self");
|
||||
}
|
||||
|
||||
img_url = 'http://207.180.212.190/fht/fabrika_imgs/' + img_url + '.jpg'; //TODO: Change
|
||||
ASPECT_RATIO = x / y;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
const points =
|
||||
[
|
||||
[1240, 625, "1;2"]
|
||||
[1240, 625, "1;2", 9, 16]
|
||||
];
|
||||
|
||||
const tolerance = 3;
|
||||
@ -16,30 +16,30 @@ window.onload = function()
|
||||
{
|
||||
if
|
||||
(
|
||||
(Math.abs(x - points[i][0]) <= tolerance || -Math.abs(x - points[i][0]) >= tolerance) &&
|
||||
(Math.abs(y - points[i][1]) <= tolerance || -Math.abs(y - points[i][1]) >= tolerance)
|
||||
((Math.abs(x - points[i][0]) <= tolerance || -Math.abs(x - points[i][0]) >= tolerance) &&
|
||||
(Math.abs(y - points[i][1]) <= tolerance || -Math.abs(y - points[i][1]) >= tolerance))
|
||||
)
|
||||
{
|
||||
move(points[i][2]);
|
||||
move(points[i][2], points[i][3], points[i][4]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function open_panorama(img)
|
||||
function open_panorama(img, x, y)
|
||||
{
|
||||
open("./res/panorama.html?img=" + img, "_self");
|
||||
open("./res/panorama.html?img=" + img + "&aspect_x=" + x + "&aspect_y=" + y, "_self");
|
||||
}
|
||||
|
||||
function move(img)
|
||||
function move(img, x, y)
|
||||
{
|
||||
if (!img.includes(";"))
|
||||
{
|
||||
open_panorama(img);
|
||||
open_panorama(img, x, y);
|
||||
} else
|
||||
{
|
||||
let imgs = img.split(";");
|
||||
open_panorama(imgs[Math.floor(Math.random() * imgs.length)]);
|
||||
open_panorama(imgs[Math.floor(Math.random() * imgs.length)], x, y);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user