Class ShapeModel<T, P>Abstract

Type Parameters

Hierarchy (view full)

Constructors

  • Creates a new shape

    Type Parameters

    • T extends Shape<ShapeConfig> | Group = Shape<ShapeConfig> | Group
    • P extends ShapeConfig = ShapeConfig

    Parameters

    • board: Board

      The [[Board]]

    • node: T

      The shape node

    • config: ShapeConfig = {}

      The [[ShapeConfig | Config]]

    Returns ShapeModel<T, P>

Properties

config: ShapeConfig

Represents the configuration of the shape

node: T

Represents the shape's node

Accessors

  • get filters(): Filters[]
  • Returns a list of the shape's filters

    Returns Filters[]

  • get group(): Nullable<string>
  • Returns group id of the shape

    Returns Nullable<string>

  • set group(name): void
  • Adds the shape to the given group name

    Parameters

    Returns void

  • get isActive(): boolean
  • Returns whether the shape is active or not

    Returns boolean

  • get isDeleted(): boolean
  • Returns whether the shape is deleted or not

    Returns boolean

  • get isInvisible(): boolean
  • Returns whether the shape is invisible or not

    Returns boolean

  • get isSelectable(): boolean
  • Returns whether the shape is selectable or not

    Returns boolean

  • set isSelectable(selectable): void
  • Updates the selectable behavior of the shape

    Parameters

    • selectable: boolean

    Returns void

  • get isVisible(): any
  • Returns whether the shape is visible or not

    Returns any

  • get name(): string
  • Returns name of the shape

    Returns string

  • get type(): string
  • Returns type of the shape

    Returns string

Methods

  • Adds filter or filters to the selected shapes

    Parameters

    Returns void

  • Deletes the shape.

    This action can undo with [[ShapeModel.undelete]] method

    Returns void

  • Deselects the shape

    Returns void

  • Destroys a deleted shape

    Returns void

  • Flips the shape horizontally

    Returns void

  • Flips the shape vertically

    Returns void

  • Returns whether the shape belongs to a group

    Returns boolean

  • Returns height of the shape

    Returns number

  • Makes the shape hidden if is visible

    Returns Shape<ShapeConfig> | Group

  • Removes a filter or list of filters from the selected shapes

    Parameters

    Returns void

  • Rotates the node around its center without transforming

    Parameters

    • theta: number

      The rotation angle

    Returns void

  • Returns scale value of the shape

    Returns undefined | Vector2d

  • Returns scaleX value of the shape

    Returns number

  • Returns scaleY value of the shape

    Returns number

  • Adds the shape to the selections

    Returns void

  • Makes the shape visible if is hidden

    Returns Shape<ShapeConfig> | Group

  • Updates attributes of the shape with animation effect

    Parameters

    • attributes: Partial<P> & {
          duration: number;
      } & Partial<{
          onFinish: (() => void);
          onUpdate: (() => void);
      }>

      The list of attributes

    Returns void

  • Undeletes a deleted shape

    Returns void

  • Updates attributes of the shape

    Parameters

    • attributes: Partial<P>

      The list of attributes

    Returns void

  • Returns width of the shape

    Returns number

  • Returns x position of the shape

    Returns number

  • Returns y position of the shape

    Returns number