Class EditorSettings

Editor settings is a class for holding the default and custom settings for stencils and connector types.

Hierarchy

Constructors

Properties

_colors: Map<string, Map<ColorType, string>> = ...

Stores a collection of color settings grouped by context (type or module name).

_contextStrings: Map<string, Map<string, string>> = ...

Stores arbitrary string settings grouped by context (eg. some module, stencil type, etc.).

_fontFamily: Map<string, string> = ...

A collection of font family settings for different contexts (type or module names).

defaultBackgroundColor: string = '#fff'

Default background color.

defaultBackgroundColorSet: ColorSet = ...

Default background color set.

defaultColor: string = '#000'

Default color.

defaultFillColor: string = '#ccc'

Default fill color.

defaultFillColorSet: ColorSet = ...

Default fill color set.

defaultFontFamilies: FontFamily[] = ...

Default collection of font families.

defaultFontFamily: string = 'Helvetica, Arial, sans-serif'

Default font family.

defaultFontSize: FontSize = ...

Default font size.

defaultStrokeColor: string = ...

Default stroke (line) color.

defaultStrokeColorSet: ColorSet = ...

Default stroke (line, outline) color set.

defaultStrokeDasharray: string = ''

Default stroke dash array.

See

MDN stroke-dasharray docs for details.

defaultStrokeDasharrays: string[] = ...

Default stroke dash array collection.

See

MDN stroke-dasharray docs for details.

defaultStrokeWidth: string = '1'

Default stroke width.

defaultStrokeWidths: string[] = ...

Array of default stroke width options (in pixels).

defaultTextColor: string = ...

Default text (font) color.

defaultTextColorSet: ColorSet = ...

Default colors for text.

Methods

  • Returns a color setting by provided context and type of color.

    Parameters

    • context: string

      type or module name

    • type: ColorType

      color kind (text, fill, stroke, etc.)

    Returns string

    CSS color string for the context-type pair or the default color for the type.

  • Returns a contextual color set.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • type: ColorType

      type of color (fill, stroke, text, etc.)

    Returns ColorSet

    contextual color set.

  • Returns an arbitrary string setting for provided context and setting name.

    Example

    dashhArray = settings.getContextString('DiamondStencil', 'strokeDashArray');
    

    Parameters

    • context: string

      type or module name (or other context collection)

    • name: string

      setting name

    Returns undefined | string

    string setting for context-name pair or undefined, if not found.

  • Returns a string array setting for provided context and setting name.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • name: string

      setting name.

    Returns undefined | string[]

    string array setting value.

  • Gets the stroke dash array setting for the provided type (context) or the default stroke dash array, if not found.

    Parameters

    • context: string

      type or module name (or other context)

    Returns string

    stroke dash array for the context or the defaultStrokeDasharray.

  • Returns a contextual dash array.

    See

    MDN stroke-dasharray docs for details.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    Returns string[]

    dash array.

  • Returns a contextual collection of font families.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    Returns FontFamily[]

    collection of font families for the context.

  • Returns special font family for the provided context or the default font family.

    Parameters

    • context: string

      type or module name (or other context)

    Returns string

    custom font family for the context or defaultFontFamily

  • Returns stroke width for the specified context (type or module name) or the default stroke width.

    Parameters

    • context: string

      type or module name

    Returns string

    stroke width for the context or defaultStrokeWidth

  • Returns a contextual stroke width collection setting.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    Returns string[]

    stroke width collection (in pixels)

  • Sets contextual color setting value.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • type: ColorType

      type of color (text, stroke, fill, etc.)

    • color: string

      string color value.

    Returns void

  • Sets a contextual color set.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • type: ColorType

      type of color (fill, stroke, text, etc.)

    • colorSet: ColorSet

      color set value.

    Returns void

  • Sets custom dash array for the provided context (type or module name).

    Parameters

    • context: string

      type or module name

    • value: string

      dash array value

    Returns void

  • Sets a contextual dash array setting.

    See

    MDN stroke-dasharray docs for details.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • value: string[]

      dash array value

    Returns void

  • Sets a contextual collection of font families.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • value: FontFamily[]

      array of font families.

    Returns void

  • Sets custom font family for the specified context.

    Parameters

    • context: string

      type or module name

    • value: string

      font family string

    Returns void

  • Sets custom font size for the supplied context.

    Parameters

    • context: string

      type or module name

    • value: FontSize

      font size value

    Returns void

  • Sets an arbitrary string setting for some context (type or module name) and setting name.

    Parameters

    • context: string

      type or module name (or some other context)

    • name: string

      setting name

    • value: string

      setting value

    Returns void

  • Sets the contextual string array setting.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • name: string

      setting name.

    • value: string[]

      string array setting value.

    Returns void

  • Sets custom stroke width for the provided context (type or module name).

    Parameters

    • context: string

      type or module name

    • value: string

      stroke width value

    Returns void

  • Sets a contextual stroke width collection setting.

    Parameters

    • context: string

      setting group (stencil or connector type, etc.)

    • value: string[]

      stroke width array.

    Returns void

Generated using TypeDoc