### Programmatic Tool Activation Example Source: https://gojs.net/latest/api/symbols/RotatingTool.html Example demonstrating how to programmatically start the RotatingTool for a selected node. ```APIDOC ``` const node = ...; myDiagram.select(node); const adorn = node.findAdornment("Rotating"); const tool = myDiagram.toolManager.rotatingTool; // specify the rotation handle of the "Rotating" Adornment of the selected node tool.handle = adorn.elt(0); myDiagram.currentTool = tool; // starts the RotatingTool tool.doActivate(); // activates the RotatingTool ``` ``` -------------------------------- ### Programmatic Tool Activation Example Source: https://gojs.net/latest/api/symbols/LinkingTool.html Demonstrates how to programmatically start the LinkingTool to draw a new link, by setting the startObject and activating the tool. ```APIDOC ```javascript const tool = myDiagram.toolManager.linkingTool; tool.startObject = ...; // Set the starting object myDiagram.currentTool = tool; tool.doActivate(); ``` ``` -------------------------------- ### Create and Start a Manual Animation in GoJS Source: https://gojs.net/latest/api/symbols/Animation.html Use this snippet to create a new Animation instance, add objects and their properties to be animated, and then start the animation. This example animates a Node's position and a Shape's fill color simultaneously. ```javascript const node = myDiagram.nodes.first(); const shape = part.findObject("SHAPE"); // assumes this Node contains a go.Shape with .name = "SHAPE" const animation = new go.Animation(); // Animate this Node from its current position to (400, 500) animation.add(node, "position", node.position, new go.Point(400, 500)); // Animate the fill of the Shape within the Node, from its current color to blue animation.add(shape, "fill", shape.fill, "blue"); // Both of these effects will animate simultaneously when start() is called: animation.start(); ``` -------------------------------- ### Install RescalingTool Source: https://gojs.net/latest/api/symbols/RescalingTool.html Install the RescalingTool as a mouse-down tool by adding it to the diagram's `mouseDownTools` collection. ```typescript myDiagram.toolManager.mouseDownTools.add(new RescalingTool()); ``` -------------------------------- ### Shape Constructor Examples Source: https://gojs.net/latest/api/symbols/Shape.html Examples demonstrating how to create Shape objects using different configurations, including predefined figures and custom geometries. ```APIDOC ## Shape Constructor Examples ### Description Examples demonstrating how to create Shape objects using different configurations, including predefined figures and custom geometries. ### Code Examples ```javascript // A shape with the figure set to RoundedRectangle: new go.Shape({ figure: "RoundedRectangle", fill: "lightgreen" }) // Alternatively: new go.Shape("RoundedRectangle" { fill: "lightgreen" }) // A shape with a custom geometry: new go.Shape( { geometry: go.Geometry.parse("M120 0 L80 80 0 50z") }) // A shape with a custom geometry, using geometryString: new go.Shape( { geometryString: "F M120 0 L80 80 0 50z", fill: "lightgreen" }) // A common link template, using two shapes, the first for the link path and the second for the arrowhead // The first shape in a link is special, its geometry is set by the Link's routing, so it does not need a geometry or figure set manually myDiagram.linkTemplate = new go.Link() .add( new go.Shape({ strokeWidth: 2, stroke: 'gray' }), new go.Shape({ toArrow: "Standard", fill: 'gray', stroke: null }) ); ``` ``` -------------------------------- ### Programmatically Start LinkingTool Source: https://gojs.net/latest/api/symbols/LinkingTool.html Use this to programmatically initiate a user mouse-gesture for drawing a new link. Set the startObject property to define the starting point for findLinkablePort. ```javascript const tool = myDiagram.toolManager.linkingTool; tool.startObject = ...; myDiagram.currentTool = tool; tool.doActivate(); ``` -------------------------------- ### mouseUpTools Source: https://gojs.net/latest/api/symbols/ToolManager.html This 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: contextMenuTool, a ContextMenuTool; textEditingTool, a TextEditingTool; clickCreatingTool, a ClickCreatingTool; clickSelectingTool, a ClickSelectingTool. ```APIDOC ## mouseUpTools ### Description This 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: contextMenuTool, a ContextMenuTool; textEditingTool, a TextEditingTool; clickCreatingTool, a ClickCreatingTool; clickSelectingTool, a ClickSelectingTool. ### Type List ``` -------------------------------- ### SpotRotatingTool.canStart Source: https://gojs.net/latest/api/symbols/SpotRotatingTool.html Determines if the tool can start. In addition to the standard behavior of go.RotatingTool.canStart, this method also allows starting when the user begins dragging the 'MovingSpot' adornment/handle. ```APIDOC ## `Override` canStart(): boolean ### Description In addition to the standard behavior of go.RotatingTool.canStart, also start when the user starts dragging the "MovingSpot" adornment/handle. ### Returns boolean ``` -------------------------------- ### mouseMoveTools Source: https://gojs.net/latest/api/symbols/ToolManager.html This 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: linkingTool, a LinkingTool; draggingTool, a DraggingTool; dragSelectingTool, a DragSelectingTool; panningTool, a PanningTool. ```APIDOC ## mouseMoveTools ### Description This 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: linkingTool, a LinkingTool; draggingTool, a DraggingTool; dragSelectingTool, a DragSelectingTool; panningTool, a PanningTool. ### Type List ``` -------------------------------- ### doActivate Source: https://gojs.net/latest/api/symbols/LinkReshapingTool.html Starts the reshaping process by finding a reshape handle at the mouse down point. It sets up internal state for reshaping and starts a transaction. ```APIDOC ## doActivate ### Description Initiates the link reshaping operation. ### Method Signature `doActivate(): void` ### Returns void ``` -------------------------------- ### showsGuides Source: https://gojs.net/latest/api/symbols/GuidedDraggingTool.html Gets or sets whether the guidelines should be shown. Defaults to true. ```APIDOC ## showsGuides ### Description Gets or sets whether the guidelines should be shown. Defaults to true. ### Method accessor ### Returns boolean ``` -------------------------------- ### Animation.start Source: https://gojs.net/latest/api/symbols/Animation.html Starts the animation. All added animation effects will begin simultaneously. ```APIDOC ## start ### Description Starts the animation. All added animation effects will begin simultaneously. ``` -------------------------------- ### Install FreehandDrawingTool Source: https://gojs.net/latest/api/symbols/FreehandDrawingTool.html Install the FreehandDrawingTool as the first mouse down tool by inserting it into the diagram's mouseDownTools collection. ```typescript myDiagram.toolManager.mouseDownTools.insertAt(0, new FreehandDrawingTool()); ``` -------------------------------- ### Install LassoSelectingTool Source: https://gojs.net/latest/api/symbols/LassoSelectingTool.html Replace the default dragSelectingTool with LassoSelectingTool when initializing a GoJS diagram. ```javascript new go.Diagram("myDiagramDiv", { dragSelectingTool: new LassoSelectingTool(), . . . }) ``` -------------------------------- ### alternateNodeIndent Source: https://gojs.net/latest/api/symbols/TreeLayout.html Gets or sets the alternate indentation of the first child. The default value is zero. The value should be non-negative. This property is only sensible when the alignment is Start or End. Having a positive value is useful if you want to reserve space at the start of the row of children for some reason. For example, if you want to pretend the parent node is infinitely deep, you can set this to be the breadth of the parent node. This sets the alternateDefaults' property of the same name. ```APIDOC ## alternateNodeIndent ### Description Gets or sets the alternate indentation of the first child. ### Type number ### Default Value 0 ### Constraints Should be non-negative. ### Notes This property is only sensible when the alignment is `Start` or `End`. Having a positive value is useful if you want to reserve space at the start of the row of children for some reason. For example, if you want to pretend the parent node is infinitely deep, you can set this to be the breadth of the parent node. This property sets the `alternateDefaults.nodeIndent` property. ``` -------------------------------- ### Constructing and Configuring a Node Source: https://gojs.net/latest/api/symbols/Node.html This example demonstrates how to construct a Node with a specified type and initial properties. It then chains methods to add data binding and GraphObjects to the node. ```javascript const n = new go.Node("Auto", { margin: 5, background: "red" }) .bind("location", "loc", go.Point.parse) .add( new go.Shape("RoundedRectangle"), new go.TextBlock("Some Text") ); ``` -------------------------------- ### startPoint Source: https://gojs.net/latest/api/symbols/DraggingTool.html Gets or sets the mouse point from which parts start to move. The value is a Point in document coordinates. ```APIDOC ## startPoint : Point ### Description Gets or sets the mouse point from which parts start to move. The value is a Point in document coordinates. This property is normally set to the diagram's mouse-down point in doActivate, but may be set to a different point if parts are being copied from a different control. Setting this property does not raise any events. ``` -------------------------------- ### LassoSelectingTool.delay Accessor Source: https://gojs.net/latest/api/symbols/LassoSelectingTool.html Gets or sets the time in milliseconds the mouse must be stationary before the tool can start. The default is 175ms. ```APIDOC ## delay : number * Gets or sets the time in milliseconds for which the mouse must be stationary before this tool can be started. The default value is 175 milliseconds. Setting this property does not raise any events. ``` -------------------------------- ### Programmatically Start Resizing Source: https://gojs.net/latest/api/symbols/ResizingTool.html Demonstrates how to programmatically initiate the resizing of a selected node's resize object. ```APIDOC ## Programmatically Start Resizing This example shows how to programmatically start the resizing of the `Part.resizeObject` of an existing selected node. ### Method ```javascript const node = ...; myDiagram.select(node); const adorn = node.findAdornment("Resizing"); const tool = myDiagram.toolManager.resizingTool; // specify which resize handle of the "Resizing" Adornment of the selected node tool.handle = adorn.elt(...); myDiagram.currentTool = tool; // starts the ResizingTool tool.doActivate(); // activates the ResizingTool ``` ``` -------------------------------- ### canStart Method Source: https://gojs.net/latest/api/symbols/DragSelectingTool.html Determines if the tool can start based on the current diagram state and mouse event. ```APIDOC ## canStart ### canStart(): boolean #### Returns boolean - True if the tool can start, false otherwise. ``` -------------------------------- ### LassoSelectingTool.delay Accessor Source: https://gojs.net/latest/api/symbols/LassoSelectingTool.html Gets or sets the time in milliseconds the mouse must be stationary to start the tool. Default is 175ms. ```typescript : number ``` -------------------------------- ### doStart Source: https://gojs.net/latest/api/symbols/Tool.html Called when this tool becomes the current tool. Used for per-use initialization, such as setting up internal data structures or capturing the mouse. Should not be called directly by the user. ```APIDOC ## `Virtual`doStart ### Description The Diagram calls this method when this tool becomes the current tool; you should not call this method. Tool implementations should perform their per-use initialization here, such as setting up internal data structures, or capturing the mouse. Implementations of this method can look at Diagram.lastInput to get the mouse event and input state. You should not call this method -- only the Diagram.currentTool property setter should call this method. By default this method does nothing. 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, it is commonplace to also override doStop to clean up whatever you set up in this method. ### Returns void ``` -------------------------------- ### nodeIndentPastParent Source: https://gojs.net/latest/api/symbols/TreeLayout.html Gets or sets the fraction of this node's breadth added to nodeIndent for spacing at the start of the children. Default is 0.0. ```APIDOC ## nodeIndentPastParent : number ### Description Gets or sets the fraction of this node's breadth is added to nodeIndent to determine any spacing at the start of the children. The default value is 0.0 -- the only indentation is specified by nodeIndent. When the value is 1.0, the children will be indented past the breadth of the parent node. This property is only sensible when the alignment is Start or End. This sets the rootDefaults' property of the same name. ``` -------------------------------- ### wasTreeExpanded Property Source: https://gojs.net/latest/api/symbols/Node.html Gets or sets whether the subtree graph starting at this node had been collapsed by a call to `expandTree` on the parent node. ```APIDOC ## wasTreeExpanded ### Description Gets or sets whether the subtree graph starting at this node had been collapsed by a call to expandTree on the parent node. The initial value is false. `see` isTreeExpanded ### Type `boolean` ``` -------------------------------- ### Initialize an Overview Source: https://gojs.net/latest/api/symbols/Overview.html Create and initialize an Overview component, linking it to a main diagram. Ensure the target DIV elements for both the main diagram and the overview are defined in your HTML. ```javascript const myDiagram = new go.Diagram("myDiagramDIV"); . . . other initialization . . . // create and initialize the Overview: new go.Overview("myOverviewDIV").observed = myDiagram; ``` -------------------------------- ### Create a GoJS Diagram Source: https://gojs.net/latest/api/symbols/GraphObject.html Initializes a GoJS diagram with various configuration options. Use this to set up the diagram's behavior, appearance, and tools. ```javascript const diagram = new go.Diagram("myDiagramDiv", { // don't initialize some properties until after a new model has been loaded "InitialLayoutCompleted": loadDiagramProperties, allowZoom: false, // don't allow the user to change the diagram's scale "grid.visible": true, // display a background grid for the whole diagram "grid.gridCellSize": new go.Size(20, 20), // allow double-click in background to create a new node "clickCreatingTool.archetypeNodeData": { text: "Node" }, // allow Ctrl-G to call the groupSelection command "commandHandler.archetypeGroupData": { text: "Group", isGroup: true, color: "blue" }, "toolManager.hoverDelay": 100, // how quickly tooltips are shown // mouse wheel zooms instead of scrolls "toolManager.mouseWheelBehavior": go.WheelMode.Zoom, "commandHandler.copiesTree": true, // for the copy command "commandHandler.deletesTree": true, // for the delete command "draggingTool.dragsTree": true, // dragging for both move and copy "draggingTool.isGridSnapEnabled": true, layout: new go.TreeLayout( { angle: 90, sorting: go.TreeLayout.SortingAscending }) }); ``` -------------------------------- ### delay Accessor Source: https://gojs.net/latest/api/symbols/DragSelectingTool.html Gets or sets the time in milliseconds for which the mouse must be stationary before this tool can be started. The default value is 175 milliseconds. ```APIDOC ## delay : number ### Description Gets or sets the time in milliseconds for which the mouse must be stationary before this tool can be started. The default value is 175 milliseconds. Setting this property does not raise any events. ``` -------------------------------- ### Instantiate ZoomSlider with Options Source: https://gojs.net/latest/api/symbols/ZoomSlider.html Example of creating a new ZoomSlider instance, specifying alignment, size, button size, and orientation. Ensure the diagram variable 'myDiagram' is defined. ```javascript const zoomSlider = new ZoomSlider(myDiagram, { alignment: go.Spot.TopRight, alignmentFocus: go.Spot.TopRight, size: 150, buttonSize: 30, orientation: 'horizontal' }); ``` -------------------------------- ### allowDragOut Source: https://gojs.net/latest/api/symbols/Diagram.html Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element. The initial value is false. ```APIDOC ## allowDragOut ### Description Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element. The initial value is false. ### Type : boolean ``` -------------------------------- ### constructor Source: https://gojs.net/latest/api/symbols/AriaCommandHandler.html Creates and sets the Aria live region. Defines variables for node selection history and runs setup method. ```APIDOC ## constructor ### Description Creates and sets the Aria live region. Defines variables for node selection history and runs setup method. ### Parameters - **mode** (string) - Optional - The mode of the diagram, 'default', 'tree', or 'links'. Default mode: Arrow keys change selection to a new node, if possible, based on direction. Tree mode: Arrow keys change selection to a new node, if possible, based on tree relationships. Links mode: Arrow keys change selection to a new node, if possible, based on linked nodes. - **init** (Partial) - Optional ### Returns AriaCommandHandler ``` -------------------------------- ### Registering Theme Bindings Source: https://gojs.net/latest/api/symbols/ThemeBinding.html Register theme bindings by calling GraphObject.theme or other methods starting with 'theme'. This example shows a simple theme object. ```javascript { colors: { primary: 'red' } } ``` -------------------------------- ### doActivate Method Source: https://gojs.net/latest/api/symbols/DragSelectingTool.html Called when the tool is activated. It initializes the selection box and sets up necessary event listeners. ```APIDOC ## doActivate ### doActivate() This method is called when the tool is activated. It initializes the selection box and sets up necessary event listeners. ``` -------------------------------- ### alternateNodeIndentPastParent Source: https://gojs.net/latest/api/symbols/TreeLayout.html Gets or sets the fraction of this node's breadth is added to alternateNodeIndent to determine any spacing at the start of the children. The default value is 0.0 -- the only indentation is specified by alternateNodeIndent. When the value is 1.0, the children will be indented past the breadth of the parent node. This property is only sensible when the alignment is Start or End. ```APIDOC ## alternateNodeIndentPastParent ### Description Gets or sets the fraction of this node's breadth that is added to `alternateNodeIndent` to determine any spacing at the start of the children. ### Type number ### Default Value 0.0 ### Notes When the value is 1.0, the children will be indented past the breadth of the parent node. This property is only sensible when the alignment is `Start` or `End`. This property sets the `alternateDefaults.nodeIndentPastParent` property. ``` -------------------------------- ### graduatedStart Source: https://gojs.net/latest/api/symbols/Shape.html Gets or sets the fractional distance along the main shape of a "Graduated" Panel at which this kind of tick should start. The default is 0. Any new value should range from 0 to 1. ```APIDOC ## graduatedStart ### Description Gets or sets the fractional distance along the main shape of a "Graduated" Panel at which this kind of tick should start. The default is 0. Any new value should range from 0 to 1. ### Type number ``` -------------------------------- ### Initialize GoJS Diagram with Options Source: https://gojs.net/latest/api/symbols/Diagram.html Construct a new GoJS Diagram and configure various properties like zoom, animations, grid, tools, layout, and event listeners. This example demonstrates setting sub-properties of Diagram, such as those for the undoManager and commandHandler. ```javascript const myDiagram = new go.Diagram("myDiagramDiv", { allowZoom: false, "animationManager.isEnabled": false, "grid.visible": true, "grid.gridCellSize": new go.Size(20, 20), "clickCreatingTool.archetypeNodeData": { text: "Node" }, "commandHandler.archetypeNodeData": { text: "Group", isGroup: true, color: "blue" }, "commandHandler.copiesTree": true, "commandHandler.deletesTree": true, "toolManager.hoverDelay": 100, "toolManager.mouseWheelBehavior": go.WheelMode.Zoom, "draggingTool.dragsTree": true, "draggingTool.isGridSnapEnabled": true, layout: new go.TreeLayout( { angle: 90, sorting: go.TreeLayout.SortingAscending }), "undoManager.isEnabled": true, "ModelChanged": e => { if (e.isTransactionFinished) saveModel(); } }); ``` -------------------------------- ### Control Default Animations with canStart Source: https://gojs.net/latest/api/symbols/AnimationManager.html Customize which default animations are allowed to start by overriding the canStart method. This example shows how to disallow expand/collapse animations while permitting others, or to disallow all default animations. ```javascript myDiagram.animationManager.canStart = function(reason) { if (reason === "Expand Tree") return false; return true; } // disallow all default animations: myDiagram.animationManager.canStart = function(reason) { return false; } ``` -------------------------------- ### textAlign Source: https://gojs.net/latest/api/symbols/TextBlock.html Gets or sets the alignment location in the TextBlock's given space. Possible values are "start", "end", "left", "right", and "center". ```APIDOC ## textAlign ### Description Gets or sets the alignment location in the TextBlock's given space. The only possible values are `"start"`, `"end"`, `"left"`, `"right"`, and `"center"`. Any other value is invalid. This property is most pertinent when the TextBlock has multiple lines of text, or when the TextBlock is given a size that differs from the text's natural size (such as with desiredSize). In left-to-right writing systems, `"start"` and `"left"` are synonymous, as are `"end"` and `"right"`. The default is `"start"`. ### Type : "right" | "left" | "center" | "start" | "end" ``` -------------------------------- ### LassoSelectingTool.canStart Method Source: https://gojs.net/latest/api/symbols/LassoSelectingTool.html Checks if the tool can start based on current conditions. This method overrides the base Tool.canStart. ```APIDOC ## `Override`canStart * canStart(): boolean #### Returns boolean ``` -------------------------------- ### fromArrow Source: https://gojs.net/latest/api/symbols/Shape.html Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. Value must be a string. For bi-directional links the arrowhead name often starts with "Backward...". The default is "None". ```APIDOC ## fromArrow ### Description Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link. Value must be a string. For bi-directional links the arrowhead name often starts with "Backward...". The default is "None". Setting this property may also set the GraphObject.segmentIndex, GraphObject.segmentOrientation, and GraphObject.alignmentFocus properties. This shape should be an element of a Link. At most one of the following three properties may be set to a non-"None" value at the same time on the same shape: figure, toArrow, fromArrow. ### Type string ``` -------------------------------- ### Initialize GoJS List with a Collection Source: https://gojs.net/latest/api/symbols/List.html Shows how to create a new GoJS List and initialize it with elements from an existing collection, such as an Array or another GoJS Iterable. ```javascript new go.List(coll?: Iterable | Iterable) ``` -------------------------------- ### doActivate Source: https://gojs.net/latest/api/symbols/TextEditingTool.html Starts the text editing process for a TextBlock, initializing the text editor. ```APIDOC ## doActivate * doActivate(): void * Start editing the text for a textBlock. If TextEditingTool.textBlock is not already specified, this looks for one at the current mouse point. If none is found, this method does nothing. This method sets currentTextEditor. If TextBlock.textEditor is defined on the TextBlock it will use that as the value. By default, it uses the value of defaultTextEditor, which is an HTMLInfo showing an HTML textarea, with the CSS class `goTXarea`. If the currentTextEditor is an HTMLInfo, this method calls HTMLInfo.show on that instance. This sets Tool.isActive to true. Custom text editors should call TextEditingTool.acceptText to finish the edit by modifying the TextBlock and committing the edit transaction. Or call TextEditingTool.doCancel to abort the edit. #### Returns void ``` -------------------------------- ### mouseDownTools Source: https://gojs.net/latest/api/symbols/ToolManager.html This 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: actionTool, an ActionTool; relinkingTool, a RelinkingTool; linkReshapingTool, a LinkReshapingTool; rotatingTool, a RotatingTool; resizingTool, a ResizingTool. ```APIDOC ## mouseDownTools ### Description This 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: actionTool, an ActionTool; relinkingTool, a RelinkingTool; linkReshapingTool, a LinkReshapingTool; rotatingTool, a RotatingTool; resizingTool, a ResizingTool. ### Type List ``` -------------------------------- ### SnapLinkReshapingTool Constructor Source: https://gojs.net/latest/api/symbols/SnapLinkReshapingTool.html Initializes a new instance of the SnapLinkReshapingTool class. ```APIDOC ## constructor ### new SnapLinkReshapingTool(init?: Partial): SnapLinkReshapingTool #### Parameters * `Optional` init: Partial - An optional object for initializing properties. #### Returns SnapLinkReshapingTool - A new instance of SnapLinkReshapingTool. ``` -------------------------------- ### wrappingWidth Property Source: https://gojs.net/latest/api/symbols/GridLayout.html Gets or sets the width beyond which the layout will start a new row. The default is NaN, meaning to use the width of the diagram's panel's viewport. Infinity is a common value to produce a single row of parts, unless limited by wrappingColumn. The value must be positive or NaN. ```APIDOC ## wrappingWidth : number * Gets or sets the width beyond which the layout will start a new row. The default is NaN, meaning to use the width of the diagram's panel's viewport. Infinity is a common value to produce a single row of parts, unless limited by wrappingColumn. The value must be positive or NaN. If the new value is NaN, Layout.isViewportSized will be set to true. When Diagram.initialAutoScale or Diagram.autoScale are not None, it is common to set wrappingColumn and wrappingWidth to large values -- whatever seems reasonable given the number and size of the parts that will be laid out and the size of the viewport. ``` -------------------------------- ### assignTreeVertexValues Source: https://gojs.net/latest/api/symbols/TreeLayout.html Assigns final property values for a TreeVertex. This method is commonly overridden to provide tree layout properties for particular nodes. It is called after values have been inherited from other TreeVertexes, allowing examination and modification of related tree node values. This method should not walk the tree, as it is called for each TreeVertex in a depth-first manner starting at a root. An example is provided for squeezing children together based on their count. ```APIDOC ## assignTreeVertexValues `Virtual` assignTreeVertexValues(v: TreeVertex): void ### Description Assign final property values for a TreeVertex. This method is commonly overridden in order to provide tree layout properties for particular nodes. This method is called after values have been inherited from other TreeVertexes, so you can examine and modify the values of related tree nodes. Please read the Introduction page on Extensions for how to override methods and how to call this base method. However, when TreeVertex.alignment is TreeAlignment.BusBranching, changing the TreeVertex.sorting or TreeVertex.comparer properties in this method will have no effect. This method should not walk the tree, since it is called for each TreeVertex in a depth-first manner starting at a root. Here is an example where the children are squeezed together if there are many of them, but only on nodes that have no grandchildren. This makes use of two TreeVertex properties that are automatically computed for you, TreeVertex.childrenCount and TreeVertex.descendantCount. ```javascript class SqueezingTreeLayout extends go.TreeLayout { assignTreeVertexValues(v) { if (v.childrenCount > 6 && v.childrenCount === v.descendantCount) { v.alignment = go.TreeAlignment.BottomRightBus; v.layerSpacing = 10; v.rowSpacing = 0; } } } ``` If you need to assign TreeVertex values and also have them be "inherited" by the child vertexes, you should override initializeTreeVertexValues instead. However at the time that method is called, the computed properties of TreeVertex will not be available. #### Parameters * ##### v: TreeVertex #### Returns void ``` -------------------------------- ### canStart Method Source: https://gojs.net/latest/api/symbols/ClickSelectingTool.html Determines if the ClickSelectingTool can start. This tool can run whenever a click occurs and can be overridden for custom behavior. ```APIDOC ## canStart ### Description This tool can run whenever a click occurs. This method may be overridden. ### Signature `canStart(): boolean` ### Returns boolean - True if the tool can start, false otherwise. ``` -------------------------------- ### mouseDragOver Source: https://gojs.net/latest/api/symbols/Diagram.html Gets or sets the function to execute when the user is dragging the selection in the background of the Diagram during a DraggingTool drag-and-drop, not over any GraphObjects. If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null. Note that for a drag-and-drop that originates in a different diagram, the target diagram's selection collection will not be the parts that are being dragged. Instead the temporary parts being dragged can be found as the source diagram's DraggingTool.copiedParts. This function is called with Diagram.skipsUndoManager temporarily set to true, so that any changes to GraphObjects are not recorded in the UndoManager. You do not need to start and commit any transaction in this function. After calling this function the diagram will be updated immediately. For example, if you want to prevent the user from dropping Parts into the background of the diagram, and want to provide feedback about that during a drag: ``` myDiagram.mouseDragOver = e => { myDiagram.currentCursor = "no-drop"; } ``` `see` * mouseDrop * GraphObject.mouseDragEnter * GraphObject.mouseDragLeave ```APIDOC ## mouseDragOver ### Description Gets or sets the function to execute when the user is dragging the selection in the background of the Diagram during a DraggingTool drag-and-drop, not over any GraphObjects. If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null. Note that for a drag-and-drop that originates in a different diagram, the target diagram's selection collection will not be the parts that are being dragged. Instead the temporary parts being dragged can be found as the source diagram's DraggingTool.copiedParts. This function is called with Diagram.skipsUndoManager temporarily set to true, so that any changes to GraphObjects are not recorded in the UndoManager. You do not need to start and commit any transaction in this function. After calling this function the diagram will be updated immediately. For example, if you want to prevent the user from dropping Parts into the background of the diagram, and want to provide feedback about that during a drag: ``` myDiagram.mouseDragOver = e => { myDiagram.currentCursor = "no-drop"; } ``` ### Related * mouseDrop * GraphObject.mouseDragEnter * GraphObject.mouseDragLeave ### Type ((e: InputEvent) => void) ``` -------------------------------- ### Implement Node Context Menu on Mouse Enter Source: https://gojs.net/latest/api/symbols/GraphObject.html This example shows how to define a context menu Adornment that appears when the mouse enters a node. It also includes a mouseLeave handler on the Adornment to remove it when the mouse leaves the context menu area. ```javascript const nodeContextMenu = new go.Adornment("Spot", { background: "transparent" }).add( // to help detect when the mouse leaves the area new go.Placeholder(), new go.Panel("Vertical", { alignment: go.Spot.Right, alignmentFocus: go.Spot.Left }).add( go.GraphObject.build("Button") .add(new go.TextBlock("Command 1")) .set({ click: (e, obj) => { const node = obj.part.adornedPart; alert("Command 1 on " + node.data.text); node.removeAdornment("ContextMenuOver"); } }), go.GraphObject.build("Button") .add(new go.TextBlock("Command 2")) .set({ click: (e, obj) => { const node = obj.part.adornedPart; alert("Command 2 on " + node.data.text); node.removeAdornment("ContextMenuOver"); } }) ) ); ``` ```javascript myDiagram.nodeTemplate = new go.Node(..., { . . . mouseEnter: (e, node) => { nodeContextMenu.adornedObject = node; nodeContextMenu.mouseLeave = (ev, cm) => { node.removeAdornment("ContextMenuOver"); } node.addAdornment("ContextMenuOver", nodeContextMenu); } }).add( // Node elements ... ) ``` -------------------------------- ### mouseDrop Source: https://gojs.net/latest/api/symbols/Diagram.html Gets or sets the function to execute when the user drops the selection in the background of the Diagram at the end of a DraggingTool drag-and-drop, not onto any GraphObjects. If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null. For example, if you want to prevent the user from dropping Parts into the background of the diagram: ``` myDiagram.mouseDrop = e => { myDiagram.currentTool.doCancel(); } ``` `see` * mouseDragOver * GraphObject.mouseDrop ```APIDOC ## mouseDrop ### Description Gets or sets the function to execute when the user drops the selection in the background of the Diagram at the end of a DraggingTool drag-and-drop, not onto any GraphObjects. If this property value is a function, it is called with an InputEvent. It is called within the transaction performed by the DraggingTool. By default this property is null. For example, if you want to prevent the user from dropping Parts into the background of the diagram: ``` myDiagram.mouseDrop = e => { myDiagram.currentTool.doCancel(); } ``` ### Related * mouseDragOver * GraphObject.mouseDrop ### Type ((e: InputEvent) => void) ``` -------------------------------- ### Node Data Example Source: https://gojs.net/latest/api/symbols/Binding.html Example of node data structure used with GoJS bindings. ```javascript { key: 23, say: "hello!" } ``` -------------------------------- ### Initialize Palette with Options Source: https://gojs.net/latest/api/symbols/Palette.html Use this constructor to create a new Palette instance. You can optionally provide an HTML element or its ID for the palette's container, and a JavaScript object to set initial properties. ```javascript const myPalette = new Palette("myPaletteDiv", { allowZoom: false, "animationManager.isEnabled": false }); ``` ```javascript const myPalette = new Palette({ allowZoom: false, "animationManager.isEnabled": false }); ``` -------------------------------- ### Programmatically Starting RelinkingTool Source: https://gojs.net/latest/api/symbols/RelinkingTool.html Demonstrates how to programmatically initiate the RelinkingTool for a specific link and end. ```APIDOC ``` const tool = myDiagram.toolManager.relinkingTool; tool.originalLink = ...; // specify which Link to have the user reconnect tool.isForwards = true; // specify which end of the Link to reconnect myDiagram.currentTool = tool; // starts the RelinkingTool tool.doActivate(); // activates the RelinkingTool Copy ``` ``` -------------------------------- ### portSpot Source: https://gojs.net/latest/api/symbols/TreeLayout.html Gets or sets the spot that this node's port gets as its FromSpot. Default is Spot.Default. ```APIDOC ## portSpot : Spot ### Description Gets or sets the spot that this node's port gets as its FromSpot. The default value is Spot.Default. A value of Spot.Default will cause the TreeLayout to assign a FromSpot based on the parent node's TreeVertex.angle. If the value is other than NoSpot, it is just assigned. When path is Source, the port's ToSpot is set instead of the FromSpot. This sets the rootDefaults' property of the same name. ``` -------------------------------- ### resizeObjectName Source: https://gojs.net/latest/api/symbols/Part.html Gets or sets the name of the GraphObject that should get a resize handle when this part is selected. The value of this property affects the value of resizeObject. The initial value is an empty string, meaning the whole Part itself gets any resize handle. ```APIDOC ## resizeObjectName ### Description Gets or sets the name of the GraphObject that should get a resize handle when this part is selected. The value of this property affects the value of resizeObject. The initial value is an empty string, meaning the whole Part itself gets any resize handle. ### Type string ``` -------------------------------- ### doStart Source: https://gojs.net/latest/api/symbols/PolygonDrawingTool.html Starts a drawing transaction, captures the mouse, sets a crosshair cursor, and begins accumulating points for the temporary shape's geometry. ```APIDOC ## doStart ### Description Start a transaction, capture the mouse, use a "crosshair" cursor, and start accumulating points in the geometry of the temporaryShape. ### Method `doStart()` ### Returns void ``` -------------------------------- ### constructor Source: https://gojs.net/latest/api/symbols/GuidedDraggingTool.html Constructs a GuidedDraggingTool and sets up the temporary guideline parts. ```APIDOC ## constructor ### Description Constructs a GuidedDraggingTool and sets up the temporary guideline parts. ### Method constructor ### Parameters #### Path Parameters - **init** (Partial) - Optional - Initializes the GuidedDraggingTool with provided partial properties. #### Returns GuidedDraggingTool ``` -------------------------------- ### width Source: https://gojs.net/latest/api/symbols/GraphObject.html Gets or sets the desired width of this GraphObject in local coordinates. This just gets or sets the width component of the desiredSize. Default is NaN. ```APIDOC ## width ### Description Gets or sets the desired width of this GraphObject in local coordinates. This just gets or sets the width component of the desiredSize. Default is NaN. Size can also be constrained by setting minSize and maxSize. The width does not include any transformation due to scale or angle, nor any pen thickness due to Shape.strokeWidth if this is a Shape. If there is a containing Panel the Panel will determine the actual size. ``` -------------------------------- ### Programmatically Start Resizing Source: https://gojs.net/latest/api/symbols/ResizingTool.html Initiates the resizing process for a selected node's resize object. Ensure the node is selected and the correct resize handle is identified before activating the tool. ```javascript const node = ...; myDiagram.select(node); const adorn = node.findAdornment("Resizing"); const tool = myDiagram.toolManager.resizingTool; // specify which resize handle of the "Resizing" Adornment of the selected node tool.handle = adorn.elt(...); myDiagram.currentTool = tool; // starts the ResizingTool tool.doActivate(); // activates the ResizingTool ``` -------------------------------- ### height Source: https://gojs.net/latest/api/symbols/GraphObject.html Gets or sets the desired height of this GraphObject in local coordinates. This just gets or sets the height component of the desiredSize. Default is NaN. ```APIDOC ## height ### Description Gets or sets the desired height of this GraphObject in local coordinates. This just gets or sets the height component of the desiredSize. Default is NaN. Size can also be constrained by setting minSize and maxSize. The height does not include any transformation due to scale or angle, nor any pen thickness due to Shape.strokeWidth if this is a Shape. If there is a containing Panel the Panel will determine the actual size. ``` -------------------------------- ### Overview Constructors Source: https://gojs.net/latest/api/symbols/Overview.html Constructs a new Overview instance. An Overview can be initialized with a reference to a DIV element or its ID, or with initialization properties. ```APIDOC ## constructor Overview ### Description Initializes a new instance of the Overview class. ### Parameters * `Optional` div: string | Element - A reference to a DIV HTML element or its ID as a string. If no DIV is supplied, an Overview will be created in memory. * `Optional` init: Partial - Optional initialization properties. ### Returns Overview - A new Overview instance. ``` ```APIDOC ## constructor Overview ### Description Initializes a new instance of the Overview class with optional initialization properties. ### Parameters * `Optional` init: Partial - Optional initialization properties. ### Returns Overview - A new Overview instance. ``` -------------------------------- ### doActivate Method Source: https://gojs.net/latest/api/symbols/RotateMultipleTool.html Activates the tool, remembering the collective center point and initial positions of selected parts relative to that center. ```APIDOC ## `Override`doActivate * doActivate(): void * Calls go.RotatingTool.doActivate, and then remembers the center point of the collection, and the initial distances and angles of selected parts to the center. #### Returns void ``` -------------------------------- ### Constructor Source: https://gojs.net/latest/api/symbols/CurvedLinkReshapingTool.html Initializes a new instance of the CurvedLinkReshapingTool class. ```APIDOC ## constructor ### Description Initializes a new instance of the CurvedLinkReshapingTool class. ### Signature `new CurvedLinkReshapingTool(init?: Partial): CurvedLinkReshapingTool` ### Parameters * `init` (Partial) - Optional initialization object. ### Returns `CurvedLinkReshapingTool` - A new instance of the CurvedLinkReshapingTool. ``` -------------------------------- ### doMouseUp Source: https://gojs.net/latest/api/symbols/ToolManager.html Manages mouse up events by iterating through `mouseUpTools` to find and start the appropriate tool. If no tool can start, it deactivates the ToolManager. This method can be overridden. ```APIDOC ## doMouseUp ### Description Manages mouse up events by iterating through `mouseUpTools` to find and start the appropriate tool. If no tool can start, it deactivates the ToolManager. This method can be overridden. ### Method `Virtual``Override` doMouseUp(): void ### Returns void ``` -------------------------------- ### SpotRotatingTool Constructor Source: https://gojs.net/latest/api/symbols/SpotRotatingTool.html Initializes a new instance of the SpotRotatingTool class. The constructor accepts an optional partial initialization object. ```APIDOC ## new SpotRotatingTool(init?: Partial): SpotRotatingTool ### Parameters * `Optional` init: Partial ### Returns SpotRotatingTool ``` -------------------------------- ### findLinksByExample Source: https://gojs.net/latest/api/symbols/Diagram.html Searches for Links by matching their data against provided example objects. Examples can include values, regular expressions, or predicate functions for flexible matching. ```APIDOC ## findLinksByExample ### Description Search for Links by matching the Link data with example data holding values, RegExps, or predicates. See the documentation of findNodesByExample for how the example data can match data of bound Parts. ### Parameters #### Path Parameters * **examples** (...ObjectData[]) - Required - One or more JavaScript Objects whose properties are either predicates to be applied or RegExps to be tested or values to be compared to the corresponding data property value. ### Returns Iterator `see` findNodesByExample ``` -------------------------------- ### portSpot Source: https://gojs.net/latest/api/symbols/TreeVertex.html Gets or sets the spot that this node's port gets as its FromSpot, if setsPortSpot is true and the node has only a single port. The default value is Spot.Default. ```APIDOC ## portSpot ### Description Gets or sets the spot that this node's port gets as its FromSpot, if setsPortSpot is true and the node has only a single port. The default value is Spot.Default. This inherited property is initialized in the TreeLayout.initializeTreeVertexValues pass. A value of Spot.Default will cause the TreeLayout to assign a FromSpot based on the parent node's TreeVertex.angle. If the value is other than NoSpot, it is just assigned. When TreeLayout.path is TreePath.Source, the port's ToSpot is set instead of the FromSpot. ### Type Spot ``` -------------------------------- ### standardPinchZoomStart Source: https://gojs.net/latest/api/symbols/Tool.html Initiates pinch-zooming on multi-touch devices. This method is called by ToolManager.doMouseDown when multi-touch input is detected and canStartMultiTouch returns true. ```APIDOC ## standardPinchZoomStart ### Description Initiates pinch-zooming on multi-touch devices. This is called by ToolManager.doMouseDown if the Diagram.lastInput has InputEvent.isMultiTouch set to true and canStartMultiTouch returns true. This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method. ### Method void ### Parameters None ``` -------------------------------- ### doStart Source: https://gojs.net/latest/api/symbols/TextEditingTool.html Initiates the text editing process, attempting to activate the tool if a TextBlock is available. ```APIDOC ## doStart * doStart(): void * This calls TextEditingTool.doActivate if there is a textBlock set. doActivate attempts to set textBlock if it is null. #### Returns void ```