getattributes usage

  • Hi,

    I would like to browse attributes of a given hotspot to copy only a subset of them to another hotspot. Like copyattributes() but with a way to say "copy this, not that". I tried to run around the getattributes() function, but I couldn't get it work from krpano itself.

    Best shot I could give was to copy paste it, but the result looks so ugly...

    I'm sure I got the wrong way... I'm new to using js/krpano together, it's tough to get into it when one is not a js expert.

    Thanks

    Florian

    5 Mal editiert, zuletzt von lerayfle (7. Februar 2019 um 17:57)

  • Hi Florian,
    I'm solving this issue by following code. It's part of my current Work In Proggress so please focus on the tagattributes in the panotag_settings:

    Code
    <panotag_settings ... 
    tagattributes="'name', 'newname', 'style', 'title', 'subtitle', 'note', 'tagstate', 'scenename', 'tagfileurl', 'ath', 'atv', 'tagsize'" 
    />


    How I use it in krpano JS action see my snipet below. First I create an Array, and then I use the array to copy, or so:


    Hoping it helps!
    Pavel

  • Hi,

    Thanks

    I don't really get what the _action_callback is for, nor approx 50% of your code, your example is way beyond my js knowledge lol.

    However I think your line with the getArray() method inspires me.


    Code
    krpano.get(datasrc).getArray().forEach(function(tag){...

    I need to check that.

    Huge thanks,

    Florian

  • Florian,
    Sorry for perplexing you, but what copies attributes from tagAttrArr is just here:

    Code
    tagAttrArr.forEach(function(tagattr){
      if (hotspotObj[tagattr]) tagObj[tagattr] = hotspotObj[tagattr] + "";	//convert to string!
      });


    Pavel

  • Thank you for that precision!

    My initial request was to manage to use getattributes(), which I still haven't managed to do *sad*
    Of course -your code shows it, , we can code it back from scratch. It's just that well, I wanted to use the higher level functions krpano was providing.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!