module:Tutorial(appInstance, onTutorialClosedopt)

Display and manage the tutorial

new module:Tutorial(appInstance, onTutorialClosedopt)

Parameters:
Name Type Attributes Description
appInstance App

instance of App for this tutorial

onTutorialClosed function <optional>

callback function when user closes or finishes the tutorial

Members

$tutorialContent :Array

jQuery element for the dynamic part of the tutorial popup (text and buttons that are dependent on the current state of the tutorial)

$tutorialWindow :jQuery.element

jQuery element containing the tutorial popup

appInstance :App

instance of App for this tutorial

currentStep :Number

helper variable for the step property, stores current state of the tutorial (step 0 means that tutorial is closed)

step

get the current step of the tutorial, this number corresponds to the index in the this.steps array that contains the function for the last displayed step

step

change the current step of the tutorial, 0 means "stop the tutorial"

steps :Array

array of functions that represent intividual steps in the tutorial by default populated with step 0 that closes the tutorial

Methods

closeWindow(onTutorialClosedopt)

close the tutorial window

Parameters:
Name Type Attributes Description
onTutorialClosed function <optional>

callback function that is called when the tutorial is closed

displayWindow()

display the tutorial window

next()

go to the next step of the tutorial

onBoxMoved()

tutorial hook, called when a box is moved

onBoxRotated()

tutorial hook, called when a box is rotated

onCanvasMoved()

tutorial hook, called when the canvas is moved

onCanvasZoomed()

tutorial hook, called when the canvas is zoomed

onChangeInputBoxState()

tutorial hook, called when user changes the state of an input box

onContextMenuOpened()

tutorial hook, called when the context menu is opened

onElementAdded()

tutorial hook, called when a new element is added

onElementRemoved()

tutorial hook, called when a box is removed

onOutputBoxTrue()

tutorial hook, called when an output box value is set to on

prev()

go to the previous step of the tutorial

resetHooks()

reset all tutorial hooks

setUpTutorial()

set up the tutorial: reset all tutorial hooks and define the order of tutorial steps

start()

start the tutorial

stepAddBoxes()

tutorial step: add input box, output box and a NOT gate

stepFinish()

tutorial step: ask the user if they want to clean the canvas before closing the tutorial

stepMoveBoxes()

tutorial step: move the boxes

stepMoveCanvas()

tutorial step: move the canvas

stepRemoveBox()

tutorial step: remove a box

stepWelcome()

tutorial step: display context menu

stepWiring()

tutorial step: create an invertor

stepZoomCanvas()

tutorial step: zoom the canvas

stop()

stop the tutorial

switchInputBox()

tutorial step: change the state of an input box

windowChoice(…choices)

add buttons with choices to the tutorial window

Parameters:
Name Type Attributes Description
choices object <repeatable>

each choice is an object in with a string property text and a function property func

windowContent(…text)

set the tutorial window text content

Parameters:
Name Type Attributes Description
text string <repeatable>

each string is a separate paragraph