Documentation

Points and Lines

Description

A Points and Lines addon enables you to present a set of points on a plane where by choosing two points you can draw or remove a segment connecting the two points. This can be used as an activity or as a presentation/simulation.

The Addon supports both click & click and drag & drop operating methods. You may choose a more convenient gesture depending on the situation and the device being used.

Properties

Property name Description
Is visible Enables to hide or show the module.
Points' coordinates Here you define the points' coordinates. Put the coordinates in brackets and separate them with a comma. Put each point in a new line, for example:
[30,60]
[70,120]
[50,200]
Points' indexes This property allows to add indexes to the points. Separate the indexes with commas, e.g. A, B, C, D, E. Remember that the number of indexes must be equal to the number of points.
If left empty, the points will appear without indexes.
Starting lines This property allows to define the segments that will be visible at the beginning.
Define a segment by writing the numbers of its endpoints separated with a dash (points are numbered in the order they appear in the Points' coordinates). Definitions of different segments should be comma separated.
If you want the line to be nonremovable, add an asterisk (*) after the second point.
e.g.: 1-2, 1-3, 1-4*
Answer This property allows to define the segments that are to be drawn as an answer. Define the segment by writing the numbers of its endpoints separated with a dash (points are numbered in the order they appear in the Points' coordinates). Definitions of different segments should be comma separated.
Is activity Enables to define whether the module is an activity or not.
Is disabled Allows to disable the module so that it won't be possible to select any point.
Blocked lines This property allows to define the segments that cannot be drawn.
Define a segment by writing the numbers of its endpoints separated with a dash (points are numbered in the order they appear in the Points' coordinates). Definitions of different segments should be comma separated.
Block wrong answers With this option checked, wrong answers are removed and the "on wrong" event is sent.
Single Connection With this option checked, only one line can go out from a point.

Events

The Points and Lines addon sends ValueChanged type events to Event Bus when a line is drawn or removed.

Field name Description
source module ID
item the name of the line defined as: line_ponit1_point2
value 1 when a line is drawn, 0 when a line is removed
score 1 if the added line should be drawn or if the removed line should be removed, otherwise 0

When a user makes all lines properly without any error, the addon sends the 'ALL OK' event.

Field name Description
item all
value N/A
score N/A

Supported commands

Command name Params Description
show --- Shows the addon.
hide --- Hides the addon.
reset --- Resets the addon.
enable --- Enables the addon.
disable --- Disables the addon.
isAllOK --- Returns true if all lines are made correctly and there are no mistakes, otherwise false.
markAsCorrect --- Mark the addon as correct.
markAsWrong --- Mark the addon as wrong.
markAsNeutral --- Mark the addon as neutral.
isConnected --- index1, index2 (integers from 1 to the number of points defined)
Returns true if the points 'index1' and 'index2' are connected with a line, otherwise false.
isEmpty --- Returns true if no line was added or removed by a student, otherwise false.
isAttempted --- Returns true if any segment is selected.

Scoring

Points and Lines addon allows to create exercises. To set the module in an excercise mode, choose the 'Is activity' property. If the addon is not in an excercise mode, all of the below methods return 0!

Property Description
maxScore The sum of all lines given in the 'Answer' property that are not defined in the 'Starting lines' property and the lines provided in 'Starting lines' (not marked with an asterisk) that are not defined in 'Answer'.
score The sum of all drawn lines given in the 'Answer' property that are not defined in the 'Starting lines' property and the removed lines entered in 'Starting lines' (not marked with an asterisk) that are not defined in 'Answer'.
errorCount The sum of all drawn lines that are not defined in the 'Answer' property or the 'Starting lines' property and the removed lines given both in 'Starting lines' and 'Answer'.

CSS classes

Class name Description
.pointslines DIV containing the points
.disabled additional class for a disabled addon
.point_container DIV element, a child of pointslines adding more styling possibilities
.point indicates the look of the point
.point_index indicates the look of the index of the point
.line indicates the look of the line
.selected additional class for a selected point
.correct additional class for pointslines for an activity solved correctly
.wrong additional class for pointslines for an activity not solved completely
.noremovable additional class for a nonremovable line
.correctLine additional class for a correct line
.wrongLine additional class for a wrong line

Demo presentation

Demo presentation contains examples on how to use the Points and Lines addon.