Sie sind nicht angemeldet.

Douglas Rhiner

Fortgeschrittener

  • »Douglas Rhiner« ist der Autor dieses Themas

Beiträge: 141

Wohnort: San Anselmo, CA

Beruf: Code-Slave

  • Nachricht senden

1

Freitag, 11. März 2011, 17:27

get("view.hlookat") results greater than 360

When retrieving the hlookat value of a panorama with....

var hlookat = Number( krpano().get("view.hlookat") );


...I get a value that, if continuing to spin, will increase to well beyond ±360.

Why does this occur when hlookat "takes" values of 0 to ±180?

Is there code / a fix for this?

2

Freitag, 11. März 2011, 19:09

copy(cur_hlookat,view.hlookat);
mod(cur_hlookat,cur_hlookat,360);

3

Freitag, 11. März 2011, 20:54

Hi Douglas Rhiner,

You can use the adjusthlookat(desthlookat) action...

Quellcode

1
2
adjusthlookat(view.hlookat);
get(view.hlookat);


Hope this help...

SAlut.

4

Freitag, 11. März 2011, 22:33

You can use the adjusthlookat(desthlookat) action...


i did not know that exsisted. thanks michel.

Douglas Rhiner

Fortgeschrittener

  • »Douglas Rhiner« ist der Autor dieses Themas

Beiträge: 141

Wohnort: San Anselmo, CA

Beruf: Code-Slave

  • Nachricht senden

5

Donnerstag, 23. Juni 2011, 17:25

Hate to have to bring this back from the dead but I'm still having issues with the correct syntax to get this to work. *wacko*
Part of the issue is that this needs to be an external call to krpano.

Here is the script I'm using to get the hlookat value:

function getlookat()
{
var hlookat = Number( krpano().get("view.hlookat") );
document.getElementById("hlookat_a").value = hlookat.toFixed(2);
}

I've tried:

var hlookat = Number( krpano().get(adjusthlookat("view.hlookat"));

And other variations to no avail.
Anyone have any suggestions?

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

6

Donnerstag, 23. Juni 2011, 19:16

adjustlookat is a action/function which you are trying to get. You need to call the action first, and then get the view.hlookat.

krpano.call('adjustlookat(view.hlookat)");
var hlookat = krpano.get("view.hlookat");

btw if you define krpano like this:

var krpano = function(){
return document.getElementById("the_krpano_object");
}

you can call krpano like this:
krpano.call()
and krpano.get() , krpano.set()

without the () after krpano(). Saves some bytes :P

7

Mittwoch, 11. Dezember 2019, 23:57

This code works ok

mod(cur_hlookat,cur_hlookat,360);
if(cur_hlookat LT -180, ADD(cur_hlookat,360));


and you have the corrrect value of the hlookat in the cur_hlookat (between -180 and 180)

Tuur

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

Beruf: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Nachricht senden

9

Dienstag, 13. Oktober 2020, 19:14

mod(cur_hlookat,cur_hlookat,360);
if(cur_hlookat LT -180, ADD(cur_hlookat,360));


and you have the corrrect value of the hlookat in the cur_hlookat (between -180 and 180)

*thumbsup* its work!

Ähnliche Themen