HolePuzzlePanel

Extends: module:Activity.ActivityPanel

Source: HolePuzzle.js:98

The ActivityPanel where HolePuzzle activities are played


Constructor

new HolePuzzlePanel( act: module:Activity.Activity, ps: module:JClicPlayer.JClicPlayer, $div?: external:jQuery, ): HolePuzzlePanel

HolePuzzlePanel constructor

Parameters


Instance Methods

clear()

Miscellaneous cleaning operations

buildVisualComponents()

Prepares the visual components of the activity

initActivity()

Basic initialization procedure

updateContent(dirtyRegion: module:AWT.Rectangle)

Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.

Parameters

  • dirtyRegion (module:AWT.Rectangle) — Specifies the area to be updated. When null,
    it's the whole panel.

setDimension( preferredMaxSize: module:AWT.Dimension, ): module:AWT.Dimension

Sets the real dimension of this panel.

Parameters

Returns

setBounds(rect: module:AWT.Rectangle)

Sets the size and position of this activity panel

Parameters

buildAccessibleComponents()

Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.

processEvent(event: external:Event): boolean

Main handler used to process mouse, touch, keyboard and edit events

Parameters

Returns

  • boolean

setBounds(rect: module:AWT.Rectangle)

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#setBounds

Overrides: module:Activity.ActivityPanel#setBounds

Sets the size and position of this activity panel

Parameters

buildVisualComponents()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#buildVisualComponents

Overrides: module:Activity.ActivityPanel#buildVisualComponents

Prepares the visual components of the activity

updateContent(dirtyRegion: module:AWT.Rectangle)

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#updateContent

Overrides: module:Activity.ActivityPanel#updateContent

Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.

Parameters

  • dirtyRegion (module:AWT.Rectangle) — Specifies the area to be updated. When null,
    it's the whole panel.

playEvent(event: string)

Inherited from module:Activity.ActivityPanel#playEvent

Overrides: module:Activity.ActivityPanel#playEvent

Plays the specified event sound

Parameters

  • event (string) — The type of event to be performed

initActivity()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#initActivity

Overrides: module:Activity.ActivityPanel#initActivity

Basic initialization procedure

startActivity()

Inherited from module:Activity.ActivityPanel#startActivity

Overrides: module:Activity.ActivityPanel#startActivity

Called when the activity starts playing

activityReady()

Inherited from module:Activity.ActivityPanel#activityReady

Overrides: module:Activity.ActivityPanel#activityReady

Called by JClicPlayer when this activity panel is fully visible, just after the
initialization process.

showHelp()

Inherited from module:Activity.ActivityPanel#showHelp

Overrides: module:Activity.ActivityPanel#showHelp

Displays help about the activity

setDimension( preferredMaxSize: module:AWT.Dimension, ): module:AWT.Dimension

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#setDimension

Overrides: module:Activity.ActivityPanel#setDimension

Sets the real dimension of this panel.

Parameters

Returns

attachEvents()

Inherited from module:Activity.ActivityPanel#attachEvents

Overrides: module:Activity.ActivityPanel#attachEvents

Attaches the events specified in the events member to the $div member

attachEvent($obj: external:jQuery, evt: string)

Inherited from module:Activity.ActivityPanel#attachEvent

Overrides: module:Activity.ActivityPanel#attachEvent

Attaches a single event to the specified object

Parameters

  • $obj (external:jQuery) — The object to which the event will be attached
  • evt (string) — The event name

processEvent(event: external:Event): boolean

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#processEvent

Overrides: module:Activity.ActivityPanel#processEvent

Main handler used to process mouse, touch, keyboard and edit events

Parameters

Returns

  • boolean

fitTo( proposed: module:AWT.Rectangle, bounds: module:AWT.Rectangle, )

Inherited from module:Activity.ActivityPanel#fitTo

Overrides: module:Activity.ActivityPanel#fitTo

Fits the panel within the proposed rectangle. The panel can occupy more space, but always
not surpassing the bounds rectangle.

Parameters

buildAccessibleComponents()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#buildAccessibleComponents

Overrides: module:Activity.ActivityPanel#buildAccessibleComponents

Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.

forceFinishActivity()

Inherited from module:Activity.ActivityPanel#forceFinishActivity

Overrides: module:Activity.ActivityPanel#forceFinishActivity

Forces the ending of the activity.

finishActivity(result: boolean)

Inherited from module:Activity.ActivityPanel#finishActivity

Overrides: module:Activity.ActivityPanel#finishActivity

Ordinary ending of the activity, usually called form processEvent

Parameters

  • result (boolean) — true if the activity was successfully completed, false otherwise

setAndPlayMsg(msgCode: string, eventSoundsCode?: string)

Inherited from module:Activity.ActivityPanel#setAndPlayMsg

Overrides: module:Activity.ActivityPanel#setAndPlayMsg

Sets the message to be displayed in the skin message box and optionally plays a sound event.

Parameters

  • msgCode (string) — Type of message (initial, final, finalError...)
  • eventSoundsCode (string, optional) — Optional name of the event sound to be played.

end()

Inherited from module:Activity.ActivityPanel#end

Overrides: module:Activity.ActivityPanel#end

Ends the activity

clear()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#clear

Overrides: module:Activity.ActivityPanel#clear

Miscellaneous cleaning operations

enableCounters( eTime: boolean, eScore: boolean, eActions: boolean, )

Inherited from module:Activity.ActivityPanel#enableCounters

Overrides: module:Activity.ActivityPanel#enableCounters

Enables or disables the three counters (time, score and actions)

Parameters

  • eTime (boolean) — Whether to enable or disable the time counter
  • eScore (boolean) — Whether to enable or disable the score counter
  • eActions (boolean) — Whether to enable or disable the actions counter

shuffle( bg: Array.<module:boxes/ActiveBoxBag.ActiveBoxBag>, visible: boolean, fitInArea: boolean, )

Inherited from module:Activity.ActivityPanel#shuffle

Overrides: module:Activity.ActivityPanel#shuffle

Shuffles the contents of the activity

Parameters

  • bg (Array.<module:boxes/ActiveBoxBag.ActiveBoxBag>) — The sets of boxes to be shuffled
  • visible (boolean) — The shuffle process must be animated on the screen (not yet implemented!)
  • fitInArea (boolean) — Shuffled pieces cannot go out of the current area

invalidate(rect: module:AWT.Rectangle)

Inherited from module:AWT.Container#invalidate

Overrides: module:Activity.ActivityPanel#invalidate

Adds the provided rectangle to the invalidated area.

Parameters

update()

Inherited from module:AWT.Container#update

Overrides: module:Activity.ActivityPanel#update

Updates the invalidated area

getBounds(): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#getBounds

Overrides: module:Activity.ActivityPanel#getBounds

Gets the enclosing Rectangle of this Shape.

Returns

equals(r: module:AWT.Shape): boolean

Inherited from module:AWT.Rectangle#equals

Overrides: module:Activity.ActivityPanel#equals

Checks if two shapes are equivalent.

Parameters

Returns

  • boolean

clone(): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#clone

Overrides: module:Activity.ActivityPanel#clone

Clones this Rectangle

Returns

scaleBy(delta: Point | Dimension): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#scaleBy

Overrides: module:Activity.ActivityPanel#scaleBy

Multiplies the dimension of the Shape by the specified delta amount.

Parameters

  • delta (Point | Dimension) — Object containing the X and Y ratio to be scaled.

Returns

grow(dx: number, dy: number): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#grow

Overrides: module:Activity.ActivityPanel#grow

Expands the boundaries of this shape. This affects the current position and dimension.

Parameters

  • dx (number) — The amount to grow (or decrease) in horizontal direction
  • dy (number) — The amount to grow (or decrease) in vertical direction

Returns

getOppositeVertex(): module:AWT.Point

Inherited from module:AWT.Rectangle#getOppositeVertex

Overrides: module:Activity.ActivityPanel#getOppositeVertex

Gets the module:AWT.Point corresponding to the lower-right vertex of the Rectangle.

Returns

add(shape: module:AWT.Shape): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#add

Overrides: module:Activity.ActivityPanel#add

Adds the boundaries of another shape to the current one

Parameters

Returns

getCoords(): string

Inherited from module:AWT.Rectangle#getCoords

Overrides: module:Activity.ActivityPanel#getCoords

Gets a string with the co-ordinates of the upper-left and lower-right vertexs of this rectangle,
(with values rounded to int)

Returns

  • string

getAttributes(): object

Inherited from module:AWT.Rectangle#getAttributes

Overrides: module:Activity.ActivityPanel#getAttributes

Gets a object with the basic attributes needed to rebuild this instance excluding functions,
parent references, constants and also attributes retaining the default value.
The resulting object is commonly usued to serialize elements in JSON format.

Returns

  • object

setAttributes(data: object): module:AWT.Rectangle

Inherited from module:AWT.Rectangle#setAttributes

Overrides: module:Activity.ActivityPanel#setAttributes

Reads the properties of this Rectangle from a data object

Parameters

  • data (object) — The data object to be parsed

Returns

moveBy(delta: Point | Dimension): module:AWT.Shape

Inherited from module:AWT.Shape#moveBy

Overrides: module:Activity.ActivityPanel#moveBy

Shifts the shape a specified amount in horizontal and vertical directions

Parameters

Returns

moveTo(newPos: module:AWT.Point): module:AWT.Shape

Inherited from module:AWT.Shape#moveTo

Overrides: module:Activity.ActivityPanel#moveTo

Moves this shape to a new position

Parameters

Returns

getShape(rect: module:AWT.Rectangle): module:AWT.Shape

Inherited from module:AWT.Shape#getShape

Overrides: module:Activity.ActivityPanel#getShape

Gets a clone of this shape moved to the pos component of the rectangle and scaled
by its dim value.

Parameters

  • rect (module:AWT.Rectangle) — The rectangle to be taken as a base for moving and scaling
    this shape.

Returns

contains(_p: module:AWT.Point): boolean

Inherited from module:AWT.Shape#contains

Overrides: module:Activity.ActivityPanel#contains

Checks if the provided module:AWT.Point is inside this shape.

Parameters

Returns

  • boolean

intersects(_r: module:AWT.Rectangle): boolean

Inherited from module:AWT.Shape#intersects

Overrides: module:Activity.ActivityPanel#intersects

Checks if the provided Rectangle r intersects with this shape.

Parameters

Returns

  • boolean

fill( ctx: external:CanvasRenderingContext2D, dirtyRegion?: module:AWT.Rectangle, ): external:CanvasRenderingContext2D

Inherited from module:AWT.Shape#fill

Overrides: module:Activity.ActivityPanel#fill

Fills the Shape with the current style in the provided HTML canvas context

Parameters

Returns

stroke( ctx: external:CanvasRenderingContext2D, ): external:CanvasRenderingContext2D

Inherited from module:AWT.Shape#stroke

Overrides: module:Activity.ActivityPanel#stroke

Draws this shape in the provided HTML canvas 2D rendering context.

Parameters

Returns

preparePath( ctx: external:CanvasRenderingContext2D, ): external:CanvasRenderingContext2D

Inherited from module:AWT.Shape#preparePath

Overrides: module:Activity.ActivityPanel#preparePath

Prepares an HTML canvas 2D rendering context with a path that can be used to stroke a line,
to fill a surface or to define a clipping region.

Parameters

Returns

clip( ctx: external:CanvasRenderingContext2D, fillRule?: string, ): external:CanvasRenderingContext2D

Inherited from module:AWT.Shape#clip

Overrides: module:Activity.ActivityPanel#clip

Creates a clipping region on the specified HTML canvas 2D rendering context

Parameters

  • ctx (external:CanvasRenderingContext2D) — The rendering context
  • fillRule (string, optional, default: "'nonzero'") — Can be 'nonzero' (default when not set) or 'evenodd'

Returns

isRect(): boolean

Inherited from module:AWT.Shape#isRect

Overrides: module:Activity.ActivityPanel#isRect

Shorthand method for determining if a Shape is an Rectangle

Returns

  • boolean

toString(): string

Inherited from module:AWT.Shape#toString

Overrides: module:Activity.ActivityPanel#toString

Overwrites the original 'Object.toString' method with a more descriptive text

Returns

  • string

setBounds(rect: module:AWT.Rectangle)

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#setBounds

Overrides: module:Activity.ActivityPanel#setBounds

Sets the size and position of this activity panel

Parameters

buildVisualComponents()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#buildVisualComponents

Overrides: module:Activity.ActivityPanel#buildVisualComponents

Prepares the visual components of the activity

updateContent(dirtyRegion: module:AWT.Rectangle)

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#updateContent

Overrides: module:Activity.ActivityPanel#updateContent

Updates the graphic content of this panel.
This method will be called from module:AWT.Container#update when needed.

Parameters

  • dirtyRegion (module:AWT.Rectangle) — Specifies the area to be updated. When null,
    it's the whole panel.

initActivity()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#initActivity

Overrides: module:Activity.ActivityPanel#initActivity

Basic initialization procedure

setDimension( preferredMaxSize: module:AWT.Dimension, ): module:AWT.Dimension

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#setDimension

Overrides: module:Activity.ActivityPanel#setDimension

Sets the real dimension of this panel.

Parameters

Returns

processEvent(event: external:Event): boolean

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#processEvent

Overrides: module:Activity.ActivityPanel#processEvent

Main handler used to process mouse, touch, keyboard and edit events

Parameters

Returns

  • boolean

buildAccessibleComponents()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#buildAccessibleComponents

Overrides: module:Activity.ActivityPanel#buildAccessibleComponents

Builds the accessible components needed for this ActivityPanel
This method is called when all main elements are placed and visible, when the activity is ready
to start or when resized.

clear()

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#clear

Overrides: module:Activity.ActivityPanel#clear

Miscellaneous cleaning operations

Static Methods

buildShape(data: object): module:AWT.Shape

Inherited from module:AWT.Shape

Builds a shape based on the provided data object.
Data should contain a 'type' member, specifying the type of shape requested ('rect', 'ellipse', 'rectangle' or 'path')

Parameters

  • data (object) — Specific data for this shape

Returns

Instance Fields

bg: module:boxes/ActiveBoxBag.ActiveBoxBag

The ActiveBoxBag object containing the information to be displayed in the panel.

parkBg: module:boxes/ActiveBoxGrid.ActiveBoxGrid

An auxiliary box bag with only one box, used to store the "missing piece" of
the puzzle.

hiddenBox: module:boxes/ActiveBox.ActiveBox

The hidden cell

hiddenBoxIndex: number

Index of the hidden cell on the ActiveBagContent

events: Array.<string>

List of mouse, touch and keyboard events intercepted by this panel

act: module:Activity.Activity

Inherited from module:Activity.ActivityPanel#act

Overrides: module:Activity.ActivityPanel#act

The Activity this panel is related to

$div: external:jQuery

Inherited from module:Activity.ActivityPanel#$div

Overrides: module:Activity.ActivityPanel#$div

The jQuery div element used by this panel

$canvas: external:jQuery

Inherited from module:Activity.ActivityPanel#$canvas

Overrides: module:Activity.ActivityPanel#$canvas

The jQuery main canvas element used by this panel

accessibleCanvas: boolean

Inherited from module:Activity.ActivityPanel#accessibleCanvas

Overrides: module:Activity.ActivityPanel#accessibleCanvas

Always true, since canvas hit regions have been deprecated!
See: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Hit_regions_and_accessibility

skin: module:skins/Skin.Skin

Inherited from module:Activity.ActivityPanel#skin

Overrides: module:Activity.ActivityPanel#skin

The realized current Skin

$animatedBg: external:jQuery

Inherited from module:Activity.ActivityPanel#$animatedBg

Overrides: module:Activity.ActivityPanel#$animatedBg

Background element (currently a span) used to place animated GIFs when needed

$animatedBgB: external:jQuery

Inherited from module:Activity.ActivityPanel#$animatedBgB

Overrides: module:Activity.ActivityPanel#$animatedBgB

Additional background element for animated GIFs, used in associations

solved: boolean

Inherited from module:Activity.ActivityPanel#solved

Overrides: module:Activity.ActivityPanel#solved

true when the activity is solved, false otherwise

bgImage: external:HTMLImageElement

Inherited from module:Activity.ActivityPanel#bgImage

Overrides: module:Activity.ActivityPanel#bgImage

The realized image used as a background

playing: boolean

Inherited from module:Activity.ActivityPanel#playing

Overrides: module:Activity.ActivityPanel#playing

true while the activity is playing

firstRun: boolean

Inherited from module:Activity.ActivityPanel#firstRun

Overrides: module:Activity.ActivityPanel#firstRun

true if the activity is running for first time (not due to a click on the replay button)

currentItem: number

Inherited from module:Activity.ActivityPanel#currentItem

Overrides: module:Activity.ActivityPanel#currentItem

Currently selected item. Used in some types of activities.

bc: module:boxes/BoxConnector.BoxConnector

Inherited from module:Activity.ActivityPanel#bc

Overrides: module:Activity.ActivityPanel#bc

The object used to connect cells and other elements in some types of activity

ps: module:JClicPlayer.JClicPlayer

Inherited from module:Activity.ActivityPanel#ps

Overrides: module:Activity.ActivityPanel#ps

The PlayStation used to realize media objects and communicate with the player services
(usually a JClicPlayer

minimumSize: module:AWT.Dimension

Inherited from module:Activity.ActivityPanel#minimumSize

Overrides: module:Activity.ActivityPanel#minimumSize

The minimum size of this kind of ActivityPanel

preferredSize: module:AWT.Dimension

Inherited from module:Activity.ActivityPanel#preferredSize

Overrides: module:Activity.ActivityPanel#preferredSize

The preferred size of this kind of ActivityPanel

events: Array.<string>

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#events

Overrides: module:Activity.ActivityPanel#events

List of mouse, touch and keyboard events intercepted by this panel

invalidatedRect: module:AWT.Rectangle

Inherited from module:AWT.Container#invalidatedRect

Overrides: module:Activity.ActivityPanel#invalidatedRect

The currently "invalidated" area

type: string

Inherited from module:AWT.Rectangle#type

Overrides: module:Activity.ActivityPanel#type

Shape type id

dim: module:AWT.Dimension

Inherited from module:AWT.Rectangle#dim

Overrides: module:Activity.ActivityPanel#dim

The Dimension of the Rectangle

pos: module:AWT.Point

Inherited from module:AWT.Shape#pos

Overrides: module:Activity.ActivityPanel#pos

The current position of the shape

events: Array.<string>

Inherited from module:activities/puzzles/HolePuzzle.HolePuzzlePanel#events

Overrides: module:Activity.ActivityPanel#events

List of mouse, touch and keyboard events intercepted by this panel