Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GeometryReshapingTool

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. Extensions can be found in the GoJS kit under the extensions or extensionsTS folders. See the Extensions intro page for more information.

Hierarchy

  • Tool
    • GeometryReshapingTool

The GeometryReshapingTool class allows for a Shape's Geometry to be modified by the user via the dragging of tool handles. This does not handle Links, whose routes should be reshaped by the LinkReshapingTool. The reshapeObjectName needs to identify the named Shape within the selected Part. If the shape cannot be found or if its Shape.geometry is not of type Geometry.Path, this will not show any GeometryReshaping Adornment. At the current time this tool does not support adding or removing PathSegments to the Geometry.

If you want to experiment with this extension, try the Geometry Reshaping sample.

Index

Constructors

constructor

  • Constructs a GeometryReshapingTool and sets the handle and name of the tool.

    Returns GeometryReshapingTool

Properties

Read-only adornedShape : Shape | null

  • Gets the Shape that is being reshaped. This must be contained within the selected Part.

Read-only handle : GraphObject | null

handleArchetype : GraphObject

  • A small GraphObject used as a reshape handle for each segment. The default GraphObject is a small blue diamond.

Read-only originalGeometry : Geometry | null

  • This read-only property remembers the original value for Shape.geometry, so that it can be restored if this tool is cancelled.

reshapeObjectName : string

  • The name of the GraphObject to be reshaped.

Methods

Override canStart

  • canStart(): boolean
  • This tool may run when there is a mouse-down event on a reshape handle.

    Returns boolean

computeReshape

  • This is called by doMouseMove and doMouseUp to limit the input point before calling reshape. By default, this doesn't limit the input point.

    Parameters

    • p: Point

      the point where the handle is being dragged.

    Returns Point

Override doActivate

  • doActivate(): void
  • Start reshaping, if findToolHandleAt finds a reshape handle at the mouse down point.

    If successful this sets handle to be the reshape handle that it finds and adornedShape to be the Shape being reshaped. It also remembers the original geometry in case this tool is cancelled. And it starts a transaction.

    Returns void

Override doCancel

  • doCancel(): void
  • Restore the shape to be the original geometry and stop this tool.

    Returns void

Override doDeactivate

  • doDeactivate(): void
  • This stops the current reshaping operation with the Shape as it is.

    Returns void

Override doMouseMove

  • doMouseMove(): void
  • Call reshape with a new point determined by the mouse to change the geometry of the adornedShape.

    Returns void

Override doMouseUp

  • doMouseUp(): void
  • Reshape the Shape's geometry with a point based on the most recent mouse point by calling reshape, and then stop this tool.

    Returns void

reshape

  • reshape(newPoint: Point): void

Override updateAdornments

  • updateAdornments(part: Part): void