You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

nealshail

Beginner

  • "nealshail" started this thread

Posts: 10

Location: Brighton, UK

  • Send private message

1

Monday, September 28th 2015, 11:24pm

Get parent node object in child node

Hi, I'm developing two html5 javascript plugins which has a relationship between them e.g.

Source code

1
2
3
4
<plugin name="parentNodePlugin" url="myplugin,js" role="parent">
	<plugin name="childNodePlugin" url="myotherplugin.js" role="child" >
	<plugin name="normalPlugin url="something.png">
</plugin>

In this example there is a parent/child relationship between childNodePlugin and parentNodePlugin.

In my plugin code how can in get access to the actual parent object from the child?
At the moment i can only see a text string with the name of the plugin.
When i try to use krpano.get() i always get a null returned?

Source code

1
2
3
4
5
6
local.registerplugin = function(krpanointerface, pluginpath, pluginobject)    {
	krpano = krpanointerface; 
	plugin = pluginobject; 
	console.log(plugin.parent)  // prints out 'parentNodePlugin' from the child node. 
	console.log(krpano.get(plugin.parent)) // null  from the child node.
    };

Is there another way or another interface i should use to find the parent node object?

many thanks
/Neal

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Tuesday, September 29th 2015, 6:20am

Source code

1
console.log(krpano.get(plugin[childNodePlugin].parent))
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour