You do not normally need to create an instance of this tool because one already exists as the Diagram.toolManager, which you can modify.
The Tool.name of this tool is "ToolManager".
The constructor produces a ToolManager that manages no tools. Call initializeStandardTools to create various tools, initialize the tool properties such as draggingTool, and initialize the three mouse tool lists with those newly created tools.
Optional
init: Partial<ToolManager>Gets or sets the mode-less ActionTool, normally one of the mouseDownTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less ClickCreatingTool, normally one of the mouseUpTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less ClickSelectingTool, normally one of the mouseUpTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less ContextMenuTool, normally one of the mouseUpTools.
You can disable this tool by setting its Tool.isEnabled property to false.
This read-only property returns the currently showing tooltip, or null if there is none.
Gets or sets the mode-less DragSelectingTool, normally one of the mouseMoveTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the distance in view coordinates within which a mouse down-and-up is considered a click and beyond which a mouse movement is considered a drag. The default value is 2 pixels horizontally and vertically for mouse events, and increases by 6 pixels for touch events. This value is used by Tool.isBeyondDragSize.
Gets or sets the mode-less DraggingTool, normally one of the mouseMoveTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the ToolManager's touch pinching behavior. Allowed values are GestureMode values. The default value is GestureMode.Zoom.
If you want to control whether a single finger touch movement causes a pan (i.e. scroll) of the diagram's contents or scrolls the page, consider either disabling the PanningTool by setting its property Tool.isEnabled to false or by setting PanningTool.bubbles to true.
Gets or sets the time between when the mouse stops moving and a hold event, in milliseconds. The default value is 850 milliseconds.
Gets or sets the time between when the mouse stops moving and a hover event, in milliseconds. This value affects the delay before GraphObject.toolTips are shown. The default value is 850 milliseconds.
Set toolTipDuration to control how long a tooltip will remain visible.
Gets or sets the mode-less LinkReshapingTool, normally one of the mouseDownTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less LinkingTool, normally one of the mouseMoveTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Readonly
mouseThis read-only property returns the list of Tools that might be started upon a mouse or finger press event. When the ToolManager handles a mouse-down or touch-down event in doMouseDown, it searches this list in order, starting the first tool for which Tool.canStart returns true.
This list may be modified, but it must not be modified while any tool is handling events.
initializeStandardTools installs the following tools, in order:
Readonly
mouseThis read-only property returns the list of Tools that might be started upon a mouse or finger move event. When the ToolManager handles a mouse-move or touch-move event in doMouseMove, it searches this list in order, starting the first tool for which Tool.canStart returns true.
This list may be modified, but it must not be modified while any tool is handling events.
initializeStandardTools installs the following tools, in order:
Readonly
mouseThis read-only property returns the list of Tools that might be started upon a mouse or finger up event. When the ToolManager handles a mouse-up or touch-up event in doMouseUp, it searches this list in order, starting the first tool for which Tool.canStart returns true.
This list may be modified, but it must not be modified while any tool is handling events.
initializeStandardTools installs the following tools, in order:
Gets or sets the ToolManager's mouse wheel behavior. Allowed values are WheelMode values.
The default value is WheelMode.Scroll.
Gets or sets the mode-less PanningTool, normally one of the mouseMoveTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less RelinkingTool, normally one of the mouseDownTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less ResizingTool, normally one of the mouseDownTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less RotatingTool, normally one of the mouseDownTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets the mode-less TextEditingTool, normally one of the mouseUpTools.
You can disable this tool by setting its Tool.isEnabled property to false.
Gets or sets how long a tool tip is visible. The default value is 5000 milliseconds.
This is used by showToolTip to determine how long to wait before calling hideToolTip.
Set hoverDelay to control how long the mouse should stay stationary before it shows a tooltip.
Virtual
Override
doThis just calls CommandHandler.doKeyDown on the diagram's Diagram.commandHandler.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doThis just calls CommandHandler.doKeyUp on the diagram's Diagram.commandHandler.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doIterate over the mouseDownTools list and start the first tool for which its Tool.canStart predicate returns true.
Starting a tool replaces the Diagram.currentTool with the new tool. Successfully doing so also activates the new tool by calling Tool.doActivate and passes on the mouse-down event to it by calling Tool.doMouseDown.
Not finding any startable tools causes this tool manager to activate, thereby enabling the mouse-move and mouse-up behaviors and starts detection of a mouse-hold event after holdDelay milliseconds.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
doImplement the standard behavior for mouse hover and mouse hold events, called by doWaitAfter when the mouse has not moved for a period of time.
If there has been no mouse down, the timer is set for hoverDelay milliseconds. If it executes, it calls any GraphObject.mouseHover function on the object at the mouse or on any of its containing panels, or it calls any Diagram.mouseHover function for a background mouse-hover event.
If there had been a mouse down, the timer is set for holdDelay milliseconds. If it executes, it calls any GraphObject.mouseHold function on the object at the mouse or on any of its containing panels, or it calls any Diagram.mouseHold function for a background mouse-held-down event.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doIterate over the mouseMoveTools list and start the first tool for which its Tool.canStart predicate returns true.
Starting a tool replaces the Diagram.currentTool with the new tool. Successfully doing so also activates the new tool by calling Tool.doActivate and passes on the mouse-move event to it by calling Tool.doMouseMove.
If no tool is found and activated, this:
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doIterate over the mouseUpTools list and start the first tool for which its Tool.canStart predicate returns true.
Starting a tool replaces the Diagram.currentTool with the new tool. Successfully doing so also activates the new tool by calling Tool.doActivate and passes on the mouse-up event to it by calling Tool.doMouseUp.
If no startable tool is found it deactivates this tool manager, to get ready for a mouse-down and ignore mouse-move and mouse-up events.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doThe diagram will call this method as the mouse wheel is rotated.
By default this just calls Tool.standardMouseWheel. This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
doImplement the standard behavior for tooltips, called by doWaitAfter when the mouse has not moved for a period of time.
This looks for a GraphObject at the latest mouse point. If it finds an object, it checks for a GraphObject.toolTip. If it has none, this method searches up the visual tree for a containing Panel that does have a tooltip.
If it didn't find any object, this looks for a Diagram.toolTip.
If it eventually finds a tooltip, this calls showToolTip. Otherwise this calls hideToolTip.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
Override
doImplement the standard behavior for when the mouse has not moved for a period of time. This is due to an expired timer started by calling Tool.standardWaitAfter.
This calls doMouseHover and, if not mouse-down, doToolTip. Afterwards, if the event that called Tool.standardWaitAfter was a touch event, this simulates a right click, enabling context menu functionality and other actions on touch devices.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
The event that caused standardWaitAfter. In this override, if it is a touch event and the Diagram.lastInput event is not handled (InputEvent.handled set to false), then this method will simulate a right click.
Virtual
findFind a mouse tool of a given name. This searches the mouseDownTools, mouseMoveTools, and mouseUpTools lists.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
the type of tool, such as "Dragging" or "ClickSelecting".
a Tool whose Tool.name exactly matches the given name, or null if no such tool is found in any of the three lists.
Virtual
hideHide any tooltip.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
initializeInitialize the three mouse tool lists with instances of the standard tools. This adds new instances of tools to the following three mouse tool lists: mouseDownTools, mouseMoveTools, or mouseUpTools. This also sets the various tool properties of this ToolManager to those newly created tools. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
Virtual
positionThis is called by showToolTip to position the part within the viewport. It normally goes just below the cursor. But if the mouse is too close to the right edge or the bottom edge of the viewport, it is positioned left and/or above the cursor.
This method only operates if the tooltip, an Adornment, does not have a Adornment.placeholder. When there is a Placeholder in the tooltip, that Adornment is automatically positioned so that the Placeholder is positioned at the adorned object, the second argument to this method.
This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
If you override this method to position the tooltip, the tooltip has already been measured but not arranged, so you can use its GraphObject.measuredBounds width and height but not its GraphObject.actualBounds.
The GraphObject getting the tooltip, or null if the tooltip is for the diagram background.
Virtual
replaceReplace a mouse tool of a given name with a new tool, or remove an existing tool (if the newtool is null). This searches the mouseDownTools, mouseMoveTools, and mouseUpTools lists. The new tool is inserted into the same list in which the same-named tool is found, at the same position as the old tool. However, if no existing tool with the given name is present, this does not add the new tool to any list, since it cannot know where it should be added. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
the type of tool, such as "Dragging" or "ClickSelecting".
If null, any tool that the search finds will just be removed from the list in which it was found.
the old tool that was replaced by the new one; this is null if none was found and the new tool was not added to any mouse tool list
Virtual
showShow a tooltip Adornment or HTMLInfo. This is called by doToolTip once that method has found a tooltip to display.
This calls positionToolTip to make it easier to customize how the tooltip is positioned relative to the object with the tooltip.
This method may be overridden, but you should consider calling this base method in order to get all of its functionality. Please read the Introduction page on Extensions for how to override methods and how to call this base method.
The GraphObject getting the tooltip; this is null if the tooltip is being shown for the diagram background.
Static
Readonly
GestureStatic
Readonly
GestureStatic
Readonly
GestureStatic
Readonly
WheelStatic
Readonly
WheelStatic
Readonly
Wheel
This special Tool is responsible for managing all of the Diagram's mode-less tools, which you can access as the Diagram.toolManager.
Mode-less tools are tools that are present in one of the following lists: mouseDownTools, mouseMoveTools, or mouseUpTools. This ToolManager tool is normally the Diagram.defaultTool, so it is also usually the Diagram.currentTool when the user is doing "nothing".
When this tool is running as the current tool, it handles mouse-down, mouse-move, and mouse-up events and the corresponding touch events. For each event it iterates over each of the tools in the corresponding list, calling the tool's Tool.canStart predicate. If that predicate returns true, it starts that tool by making it the diagram's current tool. It then activates the tool and passes on the event to the tool by calling the corresponding method (either Tool.doMouseDown, Tool.doMouseMove, or Tool.doMouseUp).
Because this tool is typically the one running as the diagram's current tool when the user isn't "doing" anything, this tool can also handle other events, such as mouse wheel events and keyboard commands.
Keyboard events are just passed on to the Diagram.commandHandler's CommandHandler.doKeyDown or CommandHandler.doKeyUp method.
This tool also is responsible for showing tooltips. Tooltip Adornments may be declared as any GraphObject.toolTip, or as the Diagram.toolTip if the mouse or finger remains motionless in the background of the diagram. You can set toolTipDuration to control how long the tooltip remains visible after being motionless.
This tool does not utilize any tool handles. This tool does not conduct any transactions. But of course some of the tools that the ToolManager starts can show tool handles and/or conduct their own transactions.