Sie sind nicht angemeldet.

360boy

Fortgeschrittener

  • »360boy« ist der Autor dieses Themas

Beiträge: 249

Wohnort: Mexico City

Beruf: Virtual tours, Krpano coding, Graphic Design, Photographer, Panographer

  • Nachricht senden

1

Freitag, 10. November 2017, 16:30

Defining URLs through CALC expression

Hello there!

I'm struggling by defining URL's automatically with CALC action. My current code is:

Quellcode

1
2
3
4
5
6
7
	<style name="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn" url="calc:'%HTMLPATH%/thumbs/' + name + '.png'"/>

        <hotspot name="hs1" style="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn"/>
        <hotspot name="hs2" style="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn"/>
        <hotspot name="hs3" style="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn"/>
        <hotspot name="hs4" style="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn"/>
        <hotspot name="hs5" style="thumbstyle" attribute1="val1" attribute2="val2" ... attributen="valn"/>


But then I get a krpano report of URLs being defined as: "/thumbs/undefined.png"

So, my question is how to refer to a layer/hotspot name inside a "calc:" expression.

Thanks! *thumbup*

Luis

2

Montag, 13. November 2017, 22:45

Hi,

that's not possible!

The 'get:' an 'calc:' are special values for xml-attributes that will be resolved during the xml parsing - see here:
https://krpano.com/docu/xml/#xmlget

So when there is just a 'calc:name' - that 'name' would refer to a global variable named 'name' - but as there no such variable 'undefined' will be returned.

Additionally that 'calc:' will only refer to the attribute value itself, there is no context like <style> at this time.

The style="..." attributes will be resolved in a later step where the 'get:' and 'calc:' attributes where already resolved, so using a 'calc:' in a style for later usage in <hotspot> isn't possible.

That <style> is a just collection of attributes that will be set for an other element, but it can't be used as template-engine.

I understand what you're trying to do, but that's not possible this way.
Consider using dynamic action code (e.g. addhotspot calls) - this way you have more possibilities and more flexibility.

Best regards,
Klaus

360boy

Fortgeschrittener

  • »360boy« ist der Autor dieses Themas

Beiträge: 249

Wohnort: Mexico City

Beruf: Virtual tours, Krpano coding, Graphic Design, Photographer, Panographer

  • Nachricht senden

3

Donnerstag, 16. November 2017, 17:23

I see, thanks Klaus for your very detailed explanation, still learning how to use calc: and get: as I feel they can be very useful.

A bit more of documentation and examples on those wouldn't be bad so others can have as well a clearer picture about them.

Best *thumbup*

Luis