# Class SpotRotatingTool

GoJS® Diagramming Components
version 3.0.14
by Northwoods Software®

This is an extension and not part of the main GoJS library. Note that the API for this class may change at any time. If you intend to use an extension in production, you should copy the code to your own source directory. See the Extensions intro page for more information.

#### Hierarchy

- RotatingTool
  - SpotRotatingTool

A custom RotatingTool that also supports the user moving the point about which the object is rotated.

Typical usage:

      new go.Diagram(. . .,
        {
          rotatingTool: new SpotRotatingTool(),
          . . .
        })

This tool uses two separate Adornments -- the regular one holding the rotation handle and an additional one named "MovingSpot" that holds the handle for interactively moving the go.RotatingTool.rotationPoint by changing the go.Part.rotationSpot.

If you want to experiment with this extension, try the Spot Rotating sample.

#####
Index

### Constructors

constructor

### Methods

canStart
computeAdornmentLocation
shiftRotationPoint
updateAdornments

#####
Inherited Index

### Accessors

RotatingTool.adornedObject
RotatingTool.handle
RotatingTool.handleAngle
RotatingTool.handleArchetype
RotatingTool.handleDistance
RotatingTool.originalAngle
RotatingTool.rotationPoint
RotatingTool.snapAngleEpsilon
RotatingTool.snapAngleMultiple
Tool.diagram
Tool.isActive
Tool.isEnabled
Tool.name
Tool.transactionResult

### Methods

RotatingTool.computeRotate
RotatingTool.computeRotationPoint
RotatingTool.doDeactivate
RotatingTool.rotate
RotatingTool.stopTransaction
Tool.canStartMultiTouch
Tool.cancelWaitAfter
Tool.doKeyDown
Tool.doKeyUp
Tool.doMouseDown
Tool.doMouseWheel
Tool.doStart
Tool.doStop
Tool.doWaitAfter
Tool.findToolHandleAt
Tool.isBeyondDragSize
Tool.standardMouseClick
Tool.standardMouseOver
Tool.standardMouseSelect
Tool.standardMouseWheel
Tool.standardPinchZoomMove
Tool.standardPinchZoomStart
Tool.standardWaitAfter
Tool.startTransaction
Tool.stopTool

## Constructors

### constructor

- new SpotRotatingTool(init?: Partial<SpotRotatingTool>): SpotRotatingTool

- #### Parameters

  - ##### `Optional` init: Partial<SpotRotatingTool>

  #### Returns SpotRotatingTool

## Methods

### `Override` canStart

- canStart(): boolean

- In addition to the standard behavior of go.RotatingTool.canStart, also start when the user starts dragging the "MovingSpot" adornment/handle.

  #### Returns boolean

  boolean

### `Override` computeAdornmentLocation

- computeAdornmentLocation(obj: GraphObject): Point

- Change the positioning of the "Rotating" Adornment to adapt to the rotation point potentially being well outside of the object being rotated.

  This assumes that go.RotatingTool.handleAngle is zero.

  #### Parameters

  - ##### obj: GraphObject

    the object being rotated

  #### Returns Point

  Point in document coordinates

### `Virtual` shiftRotationPoint

- shiftRotationPoint(): void

- This is called by mouse moves and mouse up events when the handle being dragged is "MovingSpot". This needs to update the go.Part.rotationSpot and go.RotatingTool.rotationPoint properties.

  For each of the X and Y directions, when the handle is within the bounds of the rotated object, the new rotation Spot will be purely fractional; when it is outside the Spot will be limited to a fraction of zero or one (whichever is closer) and an absolute offset that places the rotation point where the handle is.

  #### Returns void

### `Override` updateAdornments

- updateAdornments(part: Part): void

- In addition to updating the standard "Rotating" Adornment, this updates a "MovingSpot" Adornment that the user may drag in order to move the go.RotatingTool.rotationPoint.

  #### Parameters

  - ##### part: Part

  #### Returns void

Copyright © 1998-2024 by Northwoods Software Corporation.