Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SnapPuzzlePiece

Represents a piece and the related slot. Note: When a piece is dropped in the correct slot, the piece is automatically disabled

Hierarchy

  • SnapPuzzlePiece

Index

Constructors

constructor

Properties

Protected completed

completed: boolean = false

The piece is completed

pieceDropped

pieceDropped: SnapPuzzlePiece

Piece dropped in the slot of this piece

pieceDroppedInto

pieceDroppedInto: SnapPuzzlePiece

Slot in which this piece has been dropped

pieceEl

pieceEl: JQuery

Jquery element of the piece

Protected pieceNativeEl

pieceNativeEl: Element

Native element of the piece

Protected puzzle

Puzzle instance for which the piece belongs

slotEl

slotEl: JQuery

Jquery element of the slot

Protected slotNativeEl

slotNativeEl: Element

Native element of the slot

x

x: number

X position

y

y: number

Y position

Static DATA_KEY

DATA_KEY: string = "snapPuzzlePiece"

Key to store the instance related to the dom elements using $.data

Methods

Protected disable

  • disable(): void

Protected enable

  • enable(): void
  • For internal use only Enable the drag&drop if the piece has not been completed yet. If the piece is complete the drag&drop will not be enabled To enable the widget use SnapPuzzleGame.enable instead

    Returns void

Protected initDraggable

  • initDraggable(): void

Protected initDroppable

  • initDroppable(): void

Protected onDrop

  • onDrop(e: any, ui: any, triggerEvent?: boolean): void
  • Invoked when a piece is dropped in this slot When a piece is dropped in the correct slot, the piece is automatically disabled

    Parameters

    • e: any
    • ui: any
    • Default value triggerEvent: boolean = true

    Returns void

Protected onRevert

  • onRevert(slot: JQuery): void
  • Invoked when a piece is reverted. Revert the state classes

    Parameters

    • slot: JQuery

    Returns void

Protected onStart

  • onStart(e: any, ui: any): void
  • Invoked when a piece starts to been dragged. Resets the classes

    Parameters

    • e: any
    • ui: any

    Returns void

Protected out

  • out(e: any, ui: any): void
  • Invoked when a piece exists from the bounds of a slot. Resets the classes

    Parameters

    • e: any
    • ui: any

    Returns void

Protected over

  • over(e: any, ui: any): void
  • Invoked when the piece is over a slot. Add the correct/incorrect classes This function is invoked only when the feedbackOnHover option is true

    Parameters

    • e: any
    • ui: any

    Returns void

refresh

  • refresh(): void

reset

  • reset(): void

Protected resolveRevert

  • resolveRevert(target: any): boolean
  • Resolve if the dropped piece must be revertd

    Parameters

    • target: any

    Returns boolean

solve

Generated using TypeDoc