2023-05-28 16:04:04 +02:00
|
|
|
const points =
|
|
|
|
[
|
2023-05-28 16:16:56 +02:00
|
|
|
[1240, 625, "1;2", 9, 16]
|
2023-05-28 16:04:04 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
const tolerance = 3;
|
|
|
|
|
|
|
|
window.onload = function()
|
|
|
|
{
|
|
|
|
document.querySelector("img").onclick = (e) =>
|
|
|
|
{
|
|
|
|
let x = e.pageX - e.target.offsetLeft;
|
|
|
|
let y = e.pageY - e.target.offsetTop;
|
|
|
|
|
|
|
|
for (let i = 0; i < points.length; i++)
|
|
|
|
{
|
|
|
|
if
|
|
|
|
(
|
2023-05-28 16:16:56 +02:00
|
|
|
((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))
|
2023-05-28 16:04:04 +02:00
|
|
|
)
|
|
|
|
{
|
2023-05-28 16:16:56 +02:00
|
|
|
move(points[i][2], points[i][3], points[i][4]);
|
2023-05-28 16:04:04 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-28 16:16:56 +02:00
|
|
|
function open_panorama(img, x, y)
|
2023-05-28 16:04:04 +02:00
|
|
|
{
|
2023-05-28 16:16:56 +02:00
|
|
|
open("./res/panorama.html?img=" + img + "&aspect_x=" + x + "&aspect_y=" + y, "_self");
|
2023-05-28 16:04:04 +02:00
|
|
|
}
|
|
|
|
|
2023-05-28 16:16:56 +02:00
|
|
|
function move(img, x, y)
|
2023-05-28 16:04:04 +02:00
|
|
|
{
|
|
|
|
if (!img.includes(";"))
|
|
|
|
{
|
2023-05-28 16:16:56 +02:00
|
|
|
open_panorama(img, x, y);
|
2023-05-28 16:04:04 +02:00
|
|
|
} else
|
|
|
|
{
|
|
|
|
let imgs = img.split(";");
|
2023-05-28 16:16:56 +02:00
|
|
|
open_panorama(imgs[Math.floor(Math.random() * imgs.length)], x, y);
|
2023-05-28 16:04:04 +02:00
|
|
|
}
|
2023-05-24 12:01:54 +02:00
|
|
|
}
|