Options
All
  • Public
  • Public/Protected
  • All
Menu
classdesc

A helper for adding vertices to and remove vertices from Bézier paths. By default the 'delete' key is used to remove vertices or paths.

For convenience this helper is capable of handling multiple paths which are kept in an array.

Demo

Hierarchy

  • BezierPathInteractionHelper

Index

Constructors

constructor

Properties

Private _keyHandler

_keyHandler: KeyHandler

Private _mouseEnterListener

_mouseEnterListener: () => void

Type declaration

    • (): void
    • Returns void

Private _mouseHandler

_mouseHandler: MouseHandler

Private _mouseLeaveListener

_mouseLeaveListener: () => void

Type declaration

    • (): void
    • Returns void

Private _touchHandler

_touchHandler: AlloyFinger

Private allowPathRemoval

allowPathRemoval: boolean

Private autoAdjustPaths

autoAdjustPaths: boolean

Private currentA

currentA: Vertex

Private currentB

currentB: Vertex

Private currentDistance

currentDistance: number

Private currentPathIndex

currentPathIndex: number

Private currentT

currentT: number

Private maxDetectDistance

maxDetectDistance: number

Private mouseIsOver

mouseIsOver: boolean

Private onPathRemoved

onPathRemoved: OnPathRemoved

Private onPointerMoved

onPointerMoved: OnPointerMoved

Private onVertexInserted

onVertexInserted: OnVertexInserted

Private onVerticesDeleted

onVerticesDeleted: OnVerticesDeleted

Private paths

paths: Array<BezierPath>

Private pb

member

{PlotBoilerplate} pb

memberof

BezierPathInteractionHelper

instance

Methods

Private _clearMoveEvent

  • _clearMoveEvent(): void

Private _handleDelete

  • _handleDelete(): void

Private _handleDeleteOnPath

  • _handleDeleteOnPath(pathIndex: number): boolean

Private _handleMoveEvent

  • _handleMoveEvent(posX: number, posY: number): void

Private _handleSingleVertexDelete

  • _handleSingleVertexDelete(): Array<number>

Private _installKeyListener

Private _installMouseListener

Private _installTouchListener

  • _installTouchListener(): AlloyFinger

Private _locatePath

Private _removeDefaultPathListeners

  • _removeDefaultPathListeners(path: BezierPath): void

Private _replacePathAt

  • _replacePathAt(pathIndex: number, newPath: BezierPath): void

Private _updateMinDistance

  • _updateMinDistance(): void

addPath

  • Manually add a path to this helper. Note that if autoAdjustPaths==true then listeners will be installed to the path's vertices to keep the path smooth at all times.

    method

    addPath

    instance
    memberof

    BezierPathInteractionHelper

    Parameters

    Returns boolean

    Duplicate path instances cannot be added; function will return false if path already exists.

destroy

  • destroy(): void
  • This function should invalidate any installed listeners and invalidate this object. After calling this function the object might not hold valid data any more and should not be used any more.

    method

    destroy

    instance
    memberof

    BezierPathInteractionHelper

    Returns void

removePath

  • Manually remove a path from this helper. Note that this method ignores the allowPathRemoval option.

    method

    removePath

    instance
    memberof

    BezierPathInteractionHelper

    Parameters

    Returns boolean

    Returns false if the path could not be found.

removePathAt

  • removePathAt(pathIndex: number): void
  • Remove the path at the given index.

    method

    removePathAt

    instance
    memberof

    BezierPathInteractionHelper

    Parameters

    • pathIndex: number

      The index of the path (must be inside bounds, see this.paths array).

    Returns void

update

  • update(): void
  • Update the inner status by running the distance calculation again with the current settings.

    Call this if any of the properties changed (like maxDetecDistance).

    method

    update

    instance
    memberof

    BezierPathInteractionHelper

    Returns void

Static addPathVertexDragEndListeners

  • A helper function to add drag-end listeners to all vertices of the given path.

    static
    method

    addPathVertexDragEndListeners

    memberof

    BezierPathInteractionHelper

    Parameters

    • path: BezierPath

      The Bézier path to add vertex listeners to.

    • vertexDragEndListener: VertListener

      The drag listeners to add to each path vertex.

    Returns void

    void

Static addPathVertexDragListeners

  • A helper function to add drag listeners to all vertices of the given path.

    static
    method

    addPathVertexDragListeners

    memberof

    BezierPathInteractionHelper

    Parameters

    • path: BezierPath

      The Bézier path to add vertex listeners to.

    • vertexDragListener: VertListener

      The drag listeners to add to each path vertex.

    Returns void

    void

Static addPathVertexDragStartListeners

  • A helper function to add drag-start listeners to all vertices of the given path.

    static
    method

    addPathVertexDragStartListeners

    memberof

    BezierPathInteractionHelper

    Parameters

    • path: BezierPath

      The Bézier path to add vertex listeners to.

    • vertexDragStartListener: VertListener

      The drag listeners to add to each path vertex.

    Returns void

    void

Static removePathVertexDragEndListeners

Static removePathVertexDragListeners

  • A helper function to remove drag listeners to all vertices of the given path.

    static
    method

    removePathVertexDragListeners

    memberof

    BezierPathInteractionHelper

    Parameters

    • path: BezierPath

      The Bézier path to remove vertex listeners from.

    • vertexDragListener: VertListener

      The drag listeners to remove from each path vertex.

    Returns void

    void

Static removePathVertexDragStartListeners

Static setPathAutoAdjust

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Private property
  • Private method
  • Static property
  • Static method

Generated using TypeDoc