Hi again,
I've got a more self contained example.
In this one, I am setting the north position, and adding a hotspot at the current pano position, sending an ajax request to save the position, and then removing the hotspot.
This seems to be producing the same error when it didn't before, so it's entirely possible something else in my code is causing the issue but it's hard to see what it code be since all of this logic is contained within one function.
|
Quellcode
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
function setNorth() {
var pano = document.getElementById('pano'); var h = pano.get("view.hlookat");
var v = pano.get("view.vlookat");
var name = "hs" + ((Date.now() + Math.random()) | 0);
console.log(name);
pano.call("addhotspot(" + name + ")");
pano.set("hotspot[" + name + "].id", name);
pano.set("hotspot[" + name + "].uuid", name);
pano.set("hotspot[" + name + "].name", name);
pano.set("hotspot[" + name + "].url", 'compass-calibration.png');
pano.set("hotspot[" + name + "].ath", h);
pano.set("hotspot[" + name + "].atv", v);
// save
$.ajax({
type: 'POST',
url: '/set-north',
dataType: 'json',
data: { north: JSON.stringify(h) } })
.done(function(data) {
toastr.success('North position set, the calibration hotspot will now be removed');
// remove north hotspot
setTimeout(function() {
console.log('remove north');
console.log(name);
pano.call('removehotspot(' + name + '));'); }, 3000);
});
}
|
Interestingly, in my first example, if I remove the temporary hotspot immediately after adding it, no error is produced
Apologies for any bad formatting, it's tricky to align it for some reason.
Cheers,
Martin