Sie sind nicht angemeldet.

Lieber Besucher, herzlich willkommen bei: krpano.com Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.

1

Donnerstag, 5. September 2013, 03:27

Out of the loop

Hi Klaus!
Why in krpano no escape of the loop?
I can stop the cycle only through interaction with the user.
And it only works if the loop "asyncfor"
Is it possible some decision early exit without interaction?

Quellcode

1
2
3
4
5
6
7
8
<events onmousedown="breakall();" />

<action name="test">
    asyncfor(set(i,0), i LT 200, inc(i),
      trace('i = ', i);
      if(i GT 10, breakall()); // does not work
    );
</action>


Sorry for the many questions!
Thank you!

2

Donnerstag, 5. September 2013, 07:51

I have found a workaround.
But Is there a more native way?

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
<action name="test">
    showlog();
    asyncfor(set(i,0), i LT 20, inc(i),
      if(i == 10, js(pass()); );	  
      trace('i = ', i);
    );
</action>
----------
<script>
    function pass() {
      krpano().call("breakall();");
    }
</script>

Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »nosferatu« (5. September 2013, 08:30)


Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

3

Montag, 9. September 2013, 01:40

Use a second action to check if a variable has been set.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

4

Montag, 9. September 2013, 07:03

Use a second action to check if a variable has been set.

sachagriffin, thanks for the reply!
Can you write an example?
I do not quite understand...

Thank You!

5

Samstag, 14. September 2013, 23:42

Who can comment on this.
Why it does not work?

Quellcode

1
if(i == 10, breakall());

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

6

Sonntag, 15. September 2013, 00:36

Because those are queued actions. You need stopall()

http://krpano.com/docu/actions/#breakall

http://krpano.com/docu/actions/#stopall
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

7

Sonntag, 15. September 2013, 08:45

sachagriffin sorry, but it does not work:

Quellcode

1
2
3
4
5
showlog();
asyncfor(set(i,0), i LT 50, inc(i),
  if(i == 20, stopall());
  trace('i = ', i);
);

stopall() and breakall() do not work inside the loop.
Only through

Quellcode

1
krpano().call("breakall();");

Unfortunately there is no information about the syntax breakall and stopall.
Could you bring the right example?
Thank you!

8

Montag, 16. September 2013, 17:29

Hi,

sorry, neither stopall nor breakall are indented to work for asyncfor or asyncloop.
The next loop call will be added to the internal queue after executing the inner code, so it can't be removed by any of these calls.

I would recommend using a 'stop' condition, e.g. in your case set 'i' to 50 to stop the loop.

Alternatively a - delayedcall(0,breakall()); - might also work, but the 'stop condition' would be the better solution.

Best regards,
Klaus

9

Montag, 16. September 2013, 19:43

Klaus, thank you!
This works fine *smile*

Quellcode

1
2
3
4
5
showlog();
asyncfor(set(i,0), i LT 50, inc(i),
  trace('i = ', i);
  if(i == 20, set(i,50));
);

Is there any future plans to implement a function to break cycle in krpano, as in JavaScript?

10

Dienstag, 17. September 2013, 15:05

Is there any future plans to implement a function to break cycle in krpano, as in JavaScript?
Yes, there are already plans for a completely new and more functional actions-system, but that's more something for 'krpano 2.0' or so. The whole action system is internally only one single module which could be optionally (e.g. for version=2.0 in the xml) swapped-out to a newer one (with slightly different syntax and keywords), and this is what is planed for future version.

Extending the current action system with more basic functionality is a bit difficult, because in such case it's almost impossible to keep the compatibility with the current actions-codes. Therefore a new actions system with new own rules would be probably the better solution. But more about this when that would be ready, that will probably still need some time.

Best regards,
Klaus

11

Dienstag, 17. September 2013, 19:53

Oh, that's great!! *rolleyes* *w00t* *squint*