You are not logged in.

jpdeglet69

Intermediate

  • "jpdeglet69" started this thread

Posts: 212

Location: France

Occupation: VR Maker and Document Management Expert

  • Send private message

1

Saturday, December 3rd 2016, 12:50pm

Javascript, Zero value, side effect?

Hi,

Did anyone else find out a "0" value problem under KrPano / JavaScript?

After a while, in my case: after the 6th scene loading...

Real sequential code
set(_i, 0); (or def(_i, integer, 0); )
trace('brut: ', get(_i));
fround(get(_i), '_i');
trace('rounded: ', get(_i));


Trace production:
INFO: brut: 0.001
INFO: rounded: 0.001


With
<action name="fround" type="Javascript"><![CDATA[
var _varg = args[1];
var _vtgt = args[2];
var _round = parseFloat(_varg).toFixed(0);
krpano.set(_vtgt, _round);
]]></action>


Under Javascript, the 0.001 was/is a known problem, normaly solved with fround similar function. not under Krpano.
I saw the problem under Chrome/FireFox (Mac OS) and IE/FireFox (Windows 7, 8...)

The problem is really important for array access based on "for" loop
for(set(_i, 0), _i LT _imax, inc(_i),
...
);
_i starts at 0.001 value, so imagine array_name[get(_i)].value *cry*
Best regards,
JPhD
VR-GuideĀ®/Eleana CEO
https://vr-guide.online

This post has been edited 3 times, last edit by "jpdeglet69" (Dec 3rd 2016, 1:51pm)


2

Sunday, December 4th 2016, 8:17pm

Hi,

that seems to be a bug in the HTML5-VR Audio Plugin - inside its xml code I have found this line:

Source code

1
if(%3 == 0, set(%3, 0.001));

And that code means - when called with '0' as third parameter, it creates a variable named '0' and sets it to the value '0.001'.

And that might be the reason for that strange behavior in your code.

Best regards,
Klaus

jpdeglet69

Intermediate

  • "jpdeglet69" started this thread

Posts: 212

Location: France

Occupation: VR Maker and Document Management Expert

  • Send private message

3

Sunday, December 4th 2016, 10:10pm

Following my analysis today and our mail exchange,
Thanks a lot, Klaus, to have verified in the plugin code.
Best regards,
JPhD
VR-GuideĀ®/Eleana CEO
https://vr-guide.online

spacerywirtualne

Professional

Posts: 984

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

4

Monday, December 5th 2016, 9:56am

Hi,
Thank you for identifying the problem. Today I update plugin.


best regards,
Piotr
Your own online, cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube

cms4vr team *thumbsup*