Class StencilBaseEditor

The core stencil editor class for most stencil types.

Hierarchy

Constructors

Properties

_connectorOutline?: SVGPathElement

Outline displayed in "connect" mode.

_container: SVGGElement

SVG container for the stencil's and editor's visual elements.

_controlBox: SVGGElement = ...

SVG group holding editor's control box.

_gripBox: SVGGElement = ...

SVG group holding resize grips.

_isFocused: boolean = false

Is stencil in focus?

_isSelected: boolean = false

Is stencil selected?

_language: Language

Language (localization) subsystem.

_overlayContainer: HTMLDivElement

Overlay container for HTML elements like text editors, etc.

_portBox: SVGGElement = ...

SVG group for holding connector ports.

_state: StencilEditorState = 'new'

Editor's state.

_stencil: StencilBase

Stencil being edited.

_stencilType: typeof StencilBase

Type of the edited stencil.

_suppressStencilCreateEvent: boolean = false

When set to true stencilcreate event isn't fired.

activeGrip?: ResizeGrip

Currently active grip.

manipulationStartHeight: number = 0

Height at the start of manipulation.

manipulationStartLeft: number = 0

x coordinate of the top-left corner at the start of manipulation.

manipulationStartTop: number = 0

y coordinate of the top-left corner at the start of manipulation.

manipulationStartWidth: number = 0

Width at the start of manipulation.

manipulationStartX: number = 0

x coordinate of the pointer at the start of manipulation.

manipulationStartY: number = 0

y coordinate of the pointer at the start of manipulation.

offsetX: number = 0

Pointer's horizontal distance from the top left corner.

offsetY: number = 0

Pointer's vertical distance from the top left corner.

onStencilChanged?: ((stencilEditor) => void)

Type declaration

    • (stencilEditor): void
    • Fired when stencil changes.

      Parameters

      Returns void

onStencilCreated?: ((stencilEditor) => void)

Type declaration

    • (stencilEditor): void
    • Fired when stencil is created.

      Parameters

      Returns void

portConnectors: Map<PortLocation, PortConnector> = ...

Collection of ports.

resizeGrips: Map<GripLocation, ResizeGrip> = ...

Resize grips.

Accessors

  • get container(): SVGGElement
  • Returns the SVG container for the stencil's and editor's visual elements.

    Returns SVGGElement

  • get isFocused(): boolean
  • Returns true if the stencil is in focus.

    Returns boolean

  • get isSelected(): boolean
  • Returns true if the stencil is selected.

    Returns boolean

  • get overlayContainer(): HTMLDivElement
  • Overlay container for HTML elements like text editors, etc.

    Returns HTMLDivElement

Methods

  • Unfocus the stencil.

    Returns void

  • Creates a stencil at specified location.

    Parameters

    • point: IPoint

      location at which to create the stencil.

    Returns void

  • Handles a double-click event.

    Parameters

    • point: IPoint

      pointer location.

    • Optional target: EventTarget

      pointer event target.

    Returns void

  • Deselect the stencil.

    Returns void

  • Finds a resize grip by the target visual.

    Parameters

    • target: SVGGraphicsElement

      event target.

    Returns undefined | ResizeGrip

    resize grip or undefined if not found.

  • Puts the stencil editor in focus.

    Returns void

  • Returns a port under the current pointer.

    Parameters

    • ev: null | PointerEvent

      pointer event.

    • exact: boolean = true

      if true, returns the port exactly under the pointer, otherwise - closest.

    • zoomLevel: number = 1

      current zoom level.

    Returns undefined | PortConnector

    target port.

  • Hides the control box.

    Returns void

  • Hides the port box.

    Returns void

  • Initial actions when manipulation starts.

    Parameters

    • point: IPoint

      pointer location

    Returns void

  • Handles manipulation.

    Parameters

    • point: IPoint

      pointer location.

    Returns void

  • Moves the stencil to specified location.

    Parameters

    • Optional x: number

      horizontal location.

    • Optional y: number

      vertical location.

    Returns void

  • Returns true if the element belongs to the stencil or the editor.

    Parameters

    • el: null | EventTarget

      target element.

    Returns boolean

    true if the element belongs to the stencil or editor.

  • Handles a pointerdown event.

    Parameters

    • point: IPoint

      pointer location.

    • Optional target: EventTarget

      event target element.

    Returns void

  • Parameters

    Returns void

  • Resizes the stencil.

    Parameters

    • point: IPoint

      pointer location.

    Returns void

  • Restores the stencil from previously saved state.

    Parameters

    Returns void

  • Scales the editor and stencil.

    Parameters

    • scaleX: number

      horizontal scale factor.

    • scaleY: number

      vertical scale factor.

    Returns void

  • Select the stencil.

    Returns void

  • Adjusts stencil and editor size.

    Returns void

  • Creates visuals for the stencil and editor.

    Returns void

  • Shows the control box.

    Returns void

  • Shows the port box.

    Returns void

  • Switches the stencil editor out of the connect mode.

    Returns void

  • Switches the stencil editor to connect mode.

    Returns void

Generated using TypeDoc