added search param to load_panorama
This commit is contained in:
parent
e1f5c6ebe2
commit
833e2e7572
@ -7,6 +7,7 @@ const MOVE_PIECES = 1/32;
|
|||||||
let ctx;
|
let ctx;
|
||||||
let canvas;
|
let canvas;
|
||||||
let img; //THE PANORAMA IMAGE
|
let img; //THE PANORAMA IMAGE
|
||||||
|
let img_url = "";
|
||||||
|
|
||||||
//CURRENT IMAGE STATE
|
//CURRENT IMAGE STATE
|
||||||
let x1 = WIDTH / 2;
|
let x1 = WIDTH / 2;
|
||||||
@ -15,6 +16,8 @@ let turn = 0; //NEGATIVE MEANS IT IS TURNED LEFT FROM CENTER, POSITIVE IS RIGHT
|
|||||||
|
|
||||||
function load_panorama()
|
function load_panorama()
|
||||||
{
|
{
|
||||||
|
check_param();
|
||||||
|
|
||||||
ASPECT_RATIO = 1 / ASPECT_RATIO; //FLIP THE RATIO COZ I AM FUCKING DUMB
|
ASPECT_RATIO = 1 / ASPECT_RATIO; //FLIP THE RATIO COZ I AM FUCKING DUMB
|
||||||
|
|
||||||
canvas = document.getElementById('panorama');
|
canvas = document.getElementById('panorama');
|
||||||
@ -30,7 +33,7 @@ function load_panorama()
|
|||||||
ctx.drawImage(img, x1, 0, x2, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW A HALF OF img
|
ctx.drawImage(img, x1, 0, x2, img.height, 0, 0, WIDTH, WIDTH * ASPECT_RATIO); //DRAW A HALF OF img
|
||||||
};
|
};
|
||||||
|
|
||||||
img.src = './img/test.jpg';
|
img.src = img_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function turn_left()
|
function turn_left()
|
||||||
@ -67,3 +70,17 @@ function turn_right()
|
|||||||
|
|
||||||
turn++;
|
turn++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function check_param()
|
||||||
|
{
|
||||||
|
let params = new URLSearchParams(window.location.search);
|
||||||
|
img_url = params.get("img");
|
||||||
|
|
||||||
|
if (img_url == null)
|
||||||
|
{
|
||||||
|
alert("This link seems to be corrupted!");
|
||||||
|
//TODO: Return
|
||||||
|
}
|
||||||
|
|
||||||
|
img_url = './img/' + img_url + '.jpg'; //TODO: Change
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user