new Calibrator(callbackWhenClosed, showWhenReady)

Setup of the calibrator object

Parameters

Name Type Optional Description

callbackWhenClosed

function()

 

function to call when the calibrator is dismissed. An object containing relevant calibration information is passed as argument.

showWhenReady

Boolean

 

If true, the calibrator is displayed after templates are loaded.

Properties

public

callbackWhenClosed  function()

Function called after the user closes the calibrator. Argument sent to the callback is an object with keys

  • status
    • 0 the calibrator did not finish normally
    • 1 calibrator finish normally
  • diagonalSize
    • diagonal size in inches
  • diagonalSizeInPx
    • diagonal size in inches
  • distanceFromScreenInCm
    • distance from the screen in cm (calibrator.distanceFromScreen)
  • pixelsPerInch
    • computed pixel density in pixels per inch
  • pixelsPerDegree
    • computed pixels per degree

container  object

Container element reference

currentImage

Get the current image key

Returns

string 

image key as stored in calibrator.IMAGES

currentImageScaledWidthInPx

Returns the scaled width depending on the selected scale factor (imageRatio) and maximum scaling of the image.

Returns

Number 

Scaled width in pixel

diagonalSize

Screen physical diagonal size in inches

Returns

Number 

Number of inches on the screen's diagonal

diagonalSizeInCm

Physical diagonal size of the screen in cm.

Returns

Number 

Number of cm on the screen's diagonal

diagonalSizeInPx

Returns Diagonal of the screen in pixels. Depends on the resolution of the screen. We are always able to compute it.

Returns

Number 

Number of pixels on the screen diagonal

constant public

distanceFromScreen  Number

Distance of the subject from the screen in cm, default to 50 cm (arm length)

imageRatio

Current image scale ratio

Returns

Number 

Ratio between 0 and 1 (this ratio will then be multiplied by the maximum scaling factor for each image to produce the observed size)

pixelsPerCm

Return the screen pixel per cm

Returns

Number 

Pixel per cm

pixelsPerDegree

Returns the pixels per degree as a function of pixel density of the screen and subject's distance from the screen

Returns

Number 

Pixel per degree

pixelsPerInch

Return the screen pixel per inches

Returns

Number 

Pixel per inches

Methods

callbackNow(status)

Function called when calibrator is dismissed. Call the callbackWhenClosed function if it was provided, else just print the result of the calibrator in the console.

Parameter

Name Type Optional Description

status

Number

 

0 for an early exit. 1 for a normal exit.

canvasResized()

Function handling canvas resize and redraw

public

hide() → undefined

Hides the calibrator.

Returns

undefined 

public

show() → undefined

Shows the calibrator.

Returns

undefined 

public

toggle() → undefined

Toggle the display of the calibrator.

Returns

undefined 

public

toggleInfo() → undefined

Toggle display of the information div.

Returns

undefined