You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

1

Friday, March 11th 2011, 5:27pm

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?

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Friday, March 11th 2011, 7:09pm

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

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

3

Friday, March 11th 2011, 8:54pm

Hi Douglas Rhiner,

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

Source code

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


Hope this help...

SAlut.

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

4

Friday, March 11th 2011, 10:33pm

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


i did not know that exsisted. thanks michel.

  • "Douglas Rhiner" started this thread

Posts: 99

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

5

Thursday, June 23rd 2011, 5:25pm

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

Professional

Posts: 1,003

Location: Netherlands

Occupation: Web developer

  • Send private message

6

Thursday, June 23rd 2011, 7:16pm

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

Wednesday, December 11th 2019, 11:57pm

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

Sage

Posts: 3,285

Location: Netherlands

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

  • Send private message

8

Thursday, December 12th 2019, 10:25am

Hi,

adjusthlookat(180);
Should work nice/do the job
https://krpano.com/docu/actions/#adjusthlookat

Tuur *thumbsup*
http://www.virtualtuur.com
Skype:studiotuur