Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - ICascadePath Interface

Hierarchy

Index

Properties

$initial

$initial: any

The initial context object of the cascade.

$reset

$reset: function

Use the $original as the $result.

Type declaration

    • (): this
    • Returns this

$result

$result: any

The current final value of the cascade.

Methods

addTo

  • Add a path to a model. This is basically equivalent to:

    parentModel.paths[pathId] = childPath;
    

    with additional checks to make it safe for cascading.

    Parameters

    • parentModel: IModel

      The model to add to.

    • pathId: string

      The id of the path.

    • Optional overwrite: boolean

      (default false) Optional flag to overwrite any path referenced by pathId. Default is false, which will create an id similar to pathId.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

alterLength

  • alterLength(distance: number, useOrigin?: boolean): ICascadePath
  • Alter a path by lengthening or shortening it.

    Parameters

    • distance: number

      Numeric amount of length to add or remove from the path. Use a positive number to lengthen, negative to shorten. When shortening: this function will not alter the path and will return null if the resulting path length is less than or equal to zero.

    • Optional useOrigin: boolean

      (default false) Optional flag to alter from the origin instead of the end of the path.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading), or null if the path could not be altered.

breakAtPoint

  • Breaks a path in two. The supplied path will end at the supplied pointOfBreak, a new path is returned which begins at the pointOfBreak and ends at the supplied path's initial end point. For Circle, the original path will be converted in place to an Arc, and null is returned.

    Parameters

    • pointOfBreak: IPoint

      The point at which to break the path.

    Returns ICascadePath

    this cascade container, this.$result will be A new path of the same type, when path type is line or arc. Returns null for circle.

center

clone

  • Create a clone of a path. This is faster than cloneObject.

    Parameters

    • Optional offset: IPoint

      Optional point to move path a relative distance.

    Returns ICascadePath

    this cascade container, this.$result will be Cloned path.

copyProps

  • Copy the schema properties of one path to another.

    Parameters

    • destPath: IPath

      The destination path to copy property values to.

    Returns ICascadePath

    this cascade container, this.$result will be The source path.

layer

  • Set the layer of a path. This is equivalent to:

    pathContext.layer = layer;
    

    Parameters

    • layer: string

      The layer name.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

mirror

  • Create a clone of a path, mirrored on either or both x and y axes.

    Parameters

    • mirrorX: boolean

      Boolean to mirror on the x axis.

    • mirrorY: boolean

      Boolean to mirror on the y axis.

    Returns ICascadePath

    this cascade container, this.$result will be Mirrored path.

move

  • Move a path to an absolute point.

    Parameters

    • origin: IPoint

      The new origin for the path.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

moveRelative

  • Move a path's origin by a relative amount.

    Parameters

    • delta: IPoint

      The x & y adjustments as a point object.

    • Optional subtract: boolean

      Optional boolean to subtract instead of add.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

rotate

  • Rotate a path.

    Parameters

    • angleInDegrees: number

      The amount of rotation, in degrees.

    • Optional rotationOrigin: IPoint

      (default [0, 0]) The center point of rotation.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

scale

  • Scale a path.

    Parameters

    • scaleValue: number

      The amount of scaling.

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

zero

  • Move a path so its bounding box begins at [0, 0].

    Returns ICascadePath

    this cascade container, this.$result will be The original path (for cascading).

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc