Code snippet test

If you want to get the first fault tree in my ExampleFaultTrees object, then the following code is for you:

var exampleFaultTrees = new ExampleFaultTrees();
topNode = exampleFaultTrees.getFaultTree(0);


You first need to instantiate an ExampleFaultTrees object and then you can ask it for the zeroth element in its internal array of fault trees.

You can then simply call the topNode’s draw function, giving it the 2d context of the canvas as a parameter to draw to.

topNode.draw(context);


Thank you

Your post has been submitted and will be published once it has been approved.