Sie sind nicht angemeldet.

jpdeglet69

Fortgeschrittener

  • »jpdeglet69« ist der Autor dieses Themas

Beiträge: 215

Wohnort: France

Beruf: VR Maker and Document Management Expert

  • Nachricht senden

1

Samstag, 3. Dezember 2016, 12:50

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://eleana.online

Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »jpdeglet69« (3. Dezember 2016, 13:51)


2

Sonntag, 4. Dezember 2016, 20:17

Hi,

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

Quellcode

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

Fortgeschrittener

  • »jpdeglet69« ist der Autor dieses Themas

Beiträge: 215

Wohnort: France

Beruf: VR Maker and Document Management Expert

  • Nachricht senden

3

Sonntag, 4. Dezember 2016, 22:10

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://eleana.online

Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

4

Montag, 5. Dezember 2016, 09:56

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


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

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*