link and relink

  • Hi,

    Not sure to fully understand the relink feature.

    From what I understand if a attribute use link in a style then it will only work if the linked var is defined in the style, not in the hotspot or layer that has this style (not sure to be clear...)

    Thought that relink was for that but it doesn't work.

    Let's say I have a hotspot with a width defined and I want to link the height in the style linked to it's width

    <hotspot style="hs_style" width="200"/>

    <style name="hs_style" height="link:width:width *2"/>

    it there a way to make it work ?
    Klaus could you post some example with relink ?
    Many thanks

  • Hi,

    your code is already a nice example for the 'relink' usage! *thumbup*

    It would be fully correct this way:

    Code
    <style name="hs_style" height="relink:width:width*2" />
    <hotspot style="link:hs_style" width="200" />

    The <hotspot> links to 'hs_style' <style> and the height there uses 'relink:' to link to the width of the <hotspot>.
    Without 'relink:' and a normal 'link:' it would link to a 'width' attribute defined at the <style> and not at the <hotspot>.

    With the 'relink:' it would be as the 'link:' was defined directly at the hotspot.
    That means it would be the same as this code:

    Code
    <hotspot width="200" height="link:width:width*2" />


    But unfortunately here a big BUT - there is a minor bug here (I have just noticed it now when testing this case). That code is correct and intended to work, but the linking to attributes that are defined at the same object, is currently not working! At the moment it wrongly links to a global 'width' variable in this case. It's unfortunately a pretty stupid, typo-like bug... not sure how I missed that... It is fixed now for the next release (1.22.2).

    Although a little workaround would be possible for the moment: by using a dynamic link() call:

    Code
    <style name="hs_style" oncreate.addevent="link(height,width:width*2);" />

    Best regards,
    Klaus

  • klaus.krpano November 15, 2024 at 10:45 PM

    Added the Label Bug
  • klaus.krpano November 15, 2024 at 10:45 PM

    Added the Label Fixed

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!