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. Extensions can be found in the GoJS kit under the extensions
(for loading via script tags),extensionsTS
(UMD modules), or extensionsJSM
(ES6 modules) folders. See the Extensions intro page for more information.
You do not normally need to create an instance of this tool because one already exists as the ToolManager.rotatingTool, which you can modify.
The Tool.name of this tool is "Rotating".
In addition to the standard behavior of RotatingTool.canStart, also start when the user starts dragging the "MovingSpot" adornment/handle.
boolean
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 RotatingTool.handleAngle is zero.
the object being rotated
Point in document coordinates
This is called by mouse moves and mouse up events when the handle being dragged is "MovingSpot". This needs to update the Part.rotationSpot and 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.
In addition to updating the standard "Rotating" Adornment, this updates a "MovingSpot" Adornment that the user may drag in order to move the RotatingTool.rotationPoint.
A custom RotatingTool that also supports the user moving the point about which the object is rotated.
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 RotatingTool.rotationPoint by changing the Part.rotationSpot.