Sie sind nicht angemeldet.

1

Donnerstag, 12. Juli 2012, 11:09

Why is the onviewchange event disabled ?

Hi,

I've implemented a compas on my VT ; the code is inspired from the "compass" included in the KRPano examples.

I use the "onviewchange" event to update the compass heading,

It works fine in most cases, except during "moveto" and "movetohotspot" actions ;

I've tried setting "nonblocking" to true in the moveto actions, but it didn't change anything...

Any suggestions ?

Thanks for your help

Philippe

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

2

Donnerstag, 12. Juli 2012, 11:45

I dont know about the onviewchange being disabled, but non blocking parameter is only for lookto function.

3

Freitag, 13. Juli 2012, 08:41

Yes, I know that, so I've tried using the lookto non blocking funtion, but it does'nt seem to change anything...

4

Freitag, 13. Juli 2012, 08:46

oops, in my initial post I mentionned "moveto" and "movetohotspot" actions. Its a misprint *sad* , I meant "lookto" and "looktohotspot" instead ; and the only one of these with a non blocking parameter is "lookto".

But anyway, the problem is still there, and I have no explanation yet...

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

5

Freitag, 13. Juli 2012, 09:54

try downloading the newest krpano.swf and/or try an older version. Make an example with just the onviewchange event

Quellcode

1
2
3
4
<krpano onstart="showlog(); moveto(90,0);" >
<events onviewchange="trace(view.hlookat)" />
<preview type="grid()" />
</krpano>

6

Freitag, 13. Juli 2012, 10:26

I think I'm slowly going somewhere :

Quellcode

1
lookto(x,y,field,smooth(100,100,100))
is blocking so that view.hlookat is not updated until lookto is done

Quellcode

1
2
lookto(x,y,field,smooth(100,100,100),true,true);
nextaction();
is nonblocking : view.hlookat is updated while lookto is running.

However, in this case, since it is nonblocking, nextaction() is executed while the lookto is running, so that it's a mess. I've tried :

Quellcode

1
 lookto(x,y,field,smooth(100,100,100),true,true,WAIT)
to wait for the end of the lookto action but it doesn't work.

right now the only solution I have is :

Quellcode

1
2
lookto(x,y,field,smooth(100,100,100),true,true); 
delayedcall(2.0,nextaction());

but that's really not satisfying, because I don't know what the delay must be : it depends on how long the lookto action could last, and that is unknown.

What I nead is some way to wait until the lookto action is ended.

Right now I've no idea how to do this *confused*

7

Freitag, 13. Juli 2012, 10:48

I've found the answer ; its so simple I feel stupid about it *cry* :

Of course, the "donecall" of the nonblocking lookto is called when the action is .... done !

So that the answer is

Quellcode

1
lookto(x,y,field,smooth(100,100,100),true,true,nextaction());

and this works perfectly : nextaction() is run only when lookto is finished, and view.hlookat is updated since lookto is now nonblocking.

Now I whish there was a nonblocking looktohotspot ; well I'll have to rewrite the code anyway, so...

Thanks for your stimulating help, Zephyr

Philippe

Zephyr

Profi

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

8

Freitag, 13. Juli 2012, 12:59

I sometime throw in a delayedcall(0, doaction()); when actions start to soon.

about the looktohotspot:

%1 = hotspot name
%2 = field of view

Quellcode

1
2
3
<action name="lookto_hotspot">
lookto(get(hotspot[%1].ath),get(hotspot[%1].atv), %2,smooth(100,100,100),true,true,nextaction());
</action>


or differently you add a third parameter with the nextaction() in it or have the nextaction as property in the hotspot.