The ShapeController is responsible for all communication regarding Shapes. Methods inside this controller can be called by window.SDK.shape.{method-name}

Methods

  • This method will set the visibility of the shape fill.

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • enableFill: boolean

      Whether the shape fill is visible.

    Returns Promise<EditorResponse<null>>

  • This method will set the visibility of the shape stroke.

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • enableStroke: boolean

      Whether the shape stroke is visible.

    Returns Promise<EditorResponse<null>>

  • This method will set the flag to change the way the rectangle shape corners will be changed: all at once or separately.

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • allCornersSame: boolean

      the new flag that you want to set to the shapeFrame.

    Returns Promise<EditorResponse<null>>

  • This method will set the radius for all corners of the rectangle and polygon shapes

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • radius: number

      A radius to update all corners at once;

    Returns Promise<EditorResponse<null>>

  • This method will set the radius for the bottom left corner of the rectangle shape

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • radius: number

      A radius to update the bottom left corner;

    Returns Promise<EditorResponse<null>>

  • This method will set the radius for the bottom right corner of the rectangle shape

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • radius: number

      A radius to update the bottom right corner;

    Returns Promise<EditorResponse<null>>

  • This method will set the radius for the top left corner of the rectangle shape

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • radius: number

      A radius to update the top left corner;

    Returns Promise<EditorResponse<null>>

  • This method will set the radius for the top right corner of the rectangle shape

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • radius: number

      A radius to update the top right corner;

    Returns Promise<EditorResponse<null>>

  • This method sets the shape source (geometry) of a shape frame, e.g. its type (rectangle, ellipse, polygon or custom), corner radius, polygon side count or, for a custom shape, its path. Note that the path of a custom shape is expressed in coordinates relative to the frame (0 to 1), not absolute units.

    This is the counterpart of FrameController.setFrameContainerShape, which sets the mask/crop shape of an image frame's container instead of a shape frame's own geometry. Both accept the same ShapeFrameSource shape.

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • source: ShapeFrameSource

      the new shape source to set on the shape frame.

    Returns Promise<EditorResponse<null>>

  • This method will set the shape stroke weight of a specified shape frame.

    Parameters

    • id: string

      the id of the shapeFrame that needs to get updated.

    • strokeWeight: number

      the new shape stroke weight that you want to set to the shapeFrame.

    Returns Promise<EditorResponse<null>>