Options
All
  • Public
  • Public/Protected
  • All
Menu

External module lib/utils/pathUtils

Index

Functions

getCanvasCommands

getInstructionsBoundingRect

  • Gets the bounding box of an array of PathInstructions that form a path. For performance reasons, this algorithm will only use the path endpoints and will not account for any curves that might go outside of the bounding box.

    Parameters

    • instructions: Array<IPathInstruction>

      An array containing SVG Path instructions

    Returns GlyphBoundingRect

    The bounding rect of the instruction set

instructionsToDataString

  • Converts separate path instructions (as returned by parsePathData()) back to a single path data string that can be applied as an svg 'd' attribute

    Parameters

    Returns string

invertInstructionsY

  • Inverts the Y-axis of an array of PathInstructions. Useful for SVG Fonts, where the Y-axis is in the opposite direction as an HTML SVG document. note: mutates the array in-place

    Parameters

    Returns Array<IPathInstruction>

    The original array with mutated y params

parsePathData

  • Parses an SVG Path data string into an array of separate instructions. For more info on Path Data see: http://www.w3.org/TR/SVG/paths.html#PathData

    Parameters

    • d: string

      The data string to parse.

    • Default value invertY: boolean = false

      If true, will invert all y coordinates. Defaults to false

    Returns Array<IPathInstruction>

    An array of instructions, containing a single letter as command and an array of integers for parameters.

Object literals

SVG_COMMAND_MAP

SVG_COMMAND_MAP: object

C

C: SVGCommandDef = new SVGCommandDef('bezierCurveTo', 6)

H

H: SVGCommandDef = new SVGCommandDef('lineTo', 1, true, false)

L

L: SVGCommandDef = new SVGCommandDef('lineTo')

M

M: SVGCommandDef = new SVGCommandDef('moveTo')

Q

Q: SVGCommandDef = new SVGCommandDef('quadraticCurveTo', 4)

S

S: SVGCommandDef = new SVGCommandDef('bezierCurveTo', 4)

T

T: SVGCommandDef = new SVGCommandDef('quadraticCurveTo', 2)

V

V: SVGCommandDef = new SVGCommandDef('lineTo', 1, false)

Z

Z: SVGCommandDef = new SVGCommandDef('lineTo', 0, false, false)

Generated using TypeDoc