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

Mittwoch, 6. Juni 2018, 18:06

Style attribute in a style element

Hi,

I do find it's always annoying to apply several styles to a single element. Example :

Quellcode

1
<hotspot name="whatever" style="style1|style2" ... />


Especially as I have half my hotspots with 'style1|style2' and the other half with 'style1|style3'. (style1 is like some base style to apply to all my hotspots)


Krpano documentation says it's possible to have a style in any xml element.

Let's try inheritance of styles then :


Quellcode

1
2
<style name="style1" ... />
<style name="style2" style="style1" .../>


I would expect that if I apply "style2" somewhere, both "style1" and "style2" would be applied, just like style1|style2.


So I tested


Quellcode

1
2
3
<style name="style1" ... />
<style name="style2" style="style1" .../>
<hotspot name="whatever" style="style2" .../>



and ... it works! "style2" seems to be now working just like a "style1|style2"! => GREAT !


However, when tracing the hotspot.style content with a simple "trace(hotspot[whatever].style)", it gives me "style1" !?!? it should give me style="style2" for things to be right, as it's what I entered in the xml.

Is the kind of style inheritance I'm doing supported ? or is it just working "zum Glück"...it's what I suspect...


Thanks
PS: it's so close to working fine! just that trace(hotspot[].style) not working...

2

Mittwoch, 6. Juni 2018, 19:35

Hi,

that 'style' attribute is a special feature of the xml parser from krpano and works like this:
- when a xml element has a style attribute, then all attributes of the related <style> are copied to that xml element

See also here:
https://krpano.com/docu/xml/#style

That means in your case, all attributes from style1 are copied to style2 and so style2 contains both.

Best regards,
Klaus

3

Dienstag, 12. Juni 2018, 19:40

Thanks. I get the point, so it means what I'm doing is not supported.


Else it should work differently for the style attribute itself, as we have some really weird stuff at the end:

in the xml

Quellcode

1
<hotspot name="whatever" style="style2"/>


at the end:

Quellcode

1
trace(hotspot[whatever].style) : "style1" 
(not really true is it?)

I asked for a style2 hotspot and what I finally have is a style="style1" one (with attributes from style2 though). If I decide to loop on all style2 hotspots, I won't find any, only style1 everywhere!

Would you have a way round to have at the end trace(ht.style) = "style2" as what I asked for in the xml ?

Thanks
(I could do a <hotspot name="whatever" style="sup" realstyle="sup"/>, and onxmlcomplete I could loop on all hotspots/layers and replace style by realstyle...but it looks dirty doesn't it?)