This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Type definitions for GoJS v1.7 | |
// Project: https://gojs.net | |
// Definitions by: Northwoods Software <https://github.com/NorthwoodsSoftware> | |
// Definitions: https://github.com/NorthwoodsSoftware/GoJS | |
/* Copyright (C) 1998-2017 by Northwoods Software Corporation. */ | |
declare namespace go { | |
/** A number in place of a Margin object is treated as a uniform Margin with that thickness */ | |
export type MarginLike = Margin | number; | |
/** A string in place of a Brush object is treated as a Solid Brush of that color. */ | |
export type BrushLike = Brush | string; | |
/** A Key is the type of the unique identifier managed by Models for each node data object. */ | |
export type Key = string | number; | |
/** Either name a property or get/set the value of a property of an object. */ | |
export type PropertyAccessor = string | ((data: any, newval: any) => any); | |
/** A constructor */ | |
export type Constructor = new (...args: Array<any>) => Object; | |
/** | |
* An adornment is a special kind of Part that is associated with another Part, | |
* the Adornment.adornedPart. | |
* Adornments are normally associated with a particular GraphObject in the adorned part -- | |
* that is the value of .adornedObject. | |
* However, the .adornedObject may be null, in which case the .adornedPart will also be null. | |
*/ | |
export class Adornment extends Part { | |
/** | |
* @param {EnumValue=} type if not supplied, the default Panel type is Panel.Position. | |
*/ | |
constructor(type?: EnumValue); | |
/**Gets or sets the GraphObject that is adorned.*/ | |
adornedObject: GraphObject; | |
/**This read-only property returns the Part that contains the adorned object.*/ | |
adornedPart: Part; | |
/**This read-only property returns a Placeholder that this Adornment may contain in its visual tree.*/ | |
placeholder: Placeholder; | |
} | |
/** | |
* This class handles animations in a Diagram. Each Diagram has one, the Diagram.animationManager. | |
*/ | |
export class AnimationManager { | |
/**You do not normally need to create an instance of this class because one already exists as the Diagram.animationManager, which you can modify.*/ | |
constructor(); | |
/**Gets or sets the duration for animations, in milliseconds. The default value is 600 milliseconds.*/ | |
duration: number; | |
/**This read-only property is true when the AnimationManager is currently animating.*/ | |
isAnimating: boolean; | |
/**Gets or sets whether this AnimationManager operates. The default value is true.*/ | |
isEnabled: boolean; | |
/** Gets or sets whether an animation is performed on an initial layout. The default value is true.*/ | |
isInitial: boolean; | |
/**This read-only property is true when the animation manager is in the middle of an animation tick.*/ | |
isTicking: boolean; | |
/** | |
* Stops any running animation and updates the Diagram to its final state. | |
*/ | |
stopAnimation(): void; | |
} | |
/** | |
* The Diagram.commandHandler implements various | |
* commands such as CommandHandler.deleteSelection or CommandHandler.redo. | |
* The CommandHandler includes keyboard event handling to interpret | |
* key presses as commands. | |
*/ | |
export class CommandHandler { | |
/** | |
* The constructor produces a CommandHandler with the default key bindings. | |
*/ | |
constructor(); | |
/**Gets or sets a data object that is copied by .groupSelection when creating a new Group. The default value is null. The value must be an Object or null.*/ | |
archetypeGroupData: any; | |
/**Gets or sets whether copySelection should also copy Links that connect with selected Nodes.*/ | |
copiesConnectedLinks: boolean; | |
/**Gets or sets whether copySelection and copyToClipboard copy the node data property whose value is the containing group data's key. The default value is false.*/ | |
copiesGroupKey: boolean; | |
/**Gets or sets whether copySelection and copyToClipboard copy the node data property whose value is the tree-parent node data's key. The default value is false.*/ | |
copiesParentKey: boolean; | |
/**Gets or sets whether .copySelection should also copy subtrees. The default value is false.*/ | |
copiesTree: boolean; | |
/**Gets or sets the Diagram.scale set by resetZoom. The default value is 1.0.*/ | |
defaultScale: number; | |
/**Gets or sets whether .deleteSelection should also delete subtrees. The default value is false.*/ | |
deletesTree: boolean; | |
/**Gets or sets whether .deleteSelection should also delete links that are connected with deleted nodes. The default value is true.*/ | |
deletesConnectedLinks: boolean; | |
/**This read-only property returns the Diagram that is using this CommandHandler.*/ | |
diagram: Diagram; | |
/**Gets or sets the predicate that determines whether or not a node may become a member of a group. The default predicate is null, which is equivalent to simply returning true.*/ | |
memberValidation: (g: Group, p: Part) => boolean; | |
/**Gets or sets the amount by which .decreaseZoom and .increaseZoom change the Diagram.scale. The default value is 1.05 (5%).*/ | |
zoomFactor: number; | |
/** | |
* Make sure all of the unnested Parts in the given collection are removed from any containing Groups. | |
* @param {Iterable<Part>} coll a collection of Parts. | |
* @param {boolean=} check whether to call .isValidMember to confirm that changing the Part to be a top-level Part is valid. | |
*/ | |
addTopLevelParts(coll: Iterable<Part>, check?: boolean): boolean; | |
/** | |
* This predicate controls whether the user can collapse expanded Groups. | |
* @param {Group=} group if supplied, ignore the selection and consider collapsing this particular Group. | |
*/ | |
canCollapseSubGraph(group?: Group): boolean; | |
/** | |
* This predicate controls whether the user can collapse expanded subtrees of Nodes. | |
* @param {Node=} node if supplied, ignore the selection and consider collapsing this particular Node. | |
*/ | |
canCollapseTree(node?: Node): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .copySelection command. | |
*/ | |
canCopySelection(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .cutSelection command. | |
*/ | |
canCutSelection(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .decreaseZoom command. | |
* @param {number=} factor This defaults to 1/.zoomFactor. The value should be less than one. | |
*/ | |
canDecreaseZoom(factor?: number): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .deleteSelection command. | |
*/ | |
canDeleteSelection(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .editTextBlock command. | |
* @param {TextBlock=} textblock the TextBlock to consider editing. | |
*/ | |
canEditTextBlock(textblock?: TextBlock): boolean; | |
/** | |
* This predicate controls whether the user can expand collapsed Groups. | |
* @param {Group=} group if supplied, ignore the selection and consider expanding this particular Group. | |
*/ | |
canExpandSubGraph(group?: Group): boolean; | |
/** | |
* This predicate controls whether the user can expand collapsed subtrees of Nodes. | |
* @param {Node=} node if supplied, ignore the selection and consider expanding this particular Node. | |
*/ | |
canExpandTree(node?: Node): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .groupSelection command. | |
*/ | |
canGroupSelection(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .increaseZoom command. | |
* @param {number=} factor This defaults to .zoomFactor. The value should be greater than one. | |
*/ | |
canIncreaseZoom(factor?: number): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .pasteSelection command. | |
*/ | |
canPasteSelection(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .redo command. | |
*/ | |
canRedo(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .resetZoom command. | |
* @param {number=} newscale This defaults to 1. The value should be greater than zero. | |
*/ | |
canResetZoom(newscale?: number): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the scrollToPart command. | |
* This returns false if there is no argument Part and there are no selected Parts. | |
* @param {Part=} part This defaults to the first selected Part of Diagram.selection | |
* This returns true if Diagram.allowHorizontalScroll and Diagram.allowVerticalScroll are true. | |
*/ | |
canScrollToPart(part?: Part): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .selectAll command. | |
*/ | |
canSelectAll(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .showContextMenu command. | |
* @param {GraphObject|Diagram=} obj a GraphObject or Diagram with a contextMenu defined. | |
* If none is given, this method will use the first selected object, or else the Diagram. | |
*/ | |
canShowContextMenu(obj?: GraphObject | Diagram): boolean; | |
/** | |
* This predicate controls whether the user may stop the current tool. | |
*/ | |
canStopCommand(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .undo command. | |
*/ | |
canUndo(): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .ungroupSelection command. | |
* @param {Group=} group if supplied, ignore the selection and consider ungrouping this particular Group. | |
*/ | |
canUngroupSelection(group?: Group): boolean; | |
/** | |
* This predicate controls whether or not the user can invoke the .zoomToFit command. | |
*/ | |
canZoomToFit(): boolean; | |
/** | |
* Collapse all expanded selected Groups. | |
* @param {Group=} group if supplied, ignore the selection and collapse this particular Group. | |
*/ | |
collapseSubGraph(group?: Group): void; | |
/** | |
* Collapse all expanded selected Nodes. | |
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree. | |
*/ | |
collapseTree(node?: Node): void; | |
/** | |
* Copy the currently selected parts, Diagram.selection, from the Diagram into the clipboard. | |
*/ | |
copySelection(): void; | |
/** | |
* This makes a copy of the given collection of Parts and stores it in a static variable acting as the clipboard. | |
* @param {Iterable<Part>} coll A collection of Parts. | |
*/ | |
copyToClipboard(coll: Iterable<Part>): void; | |
/** | |
* Execute a .copySelection followed by a .deleteSelection. | |
*/ | |
cutSelection(): void; | |
/** | |
* Decrease the Diagram.scale by a given factor. | |
* @param {number=} factor This defaults to 1/.zoomFactor. The value should be less than one. | |
*/ | |
decreaseZoom(factor?: number): void; | |
/** | |
* Delete the currently selected parts from the diagram. | |
*/ | |
deleteSelection(): void; | |
/** | |
* This is called by tools to handle keyboard commands. | |
*/ | |
doKeyDown(): void; | |
/** | |
* This is called by tools to handle keyboard commands. | |
*/ | |
doKeyUp(): void; | |
/** | |
* Start in-place editing of a TextBlock in the selected Part. | |
* @param {TextBlock=} textblock the TextBlock to start editing. | |
*/ | |
editTextBlock(textblock?: TextBlock): void; | |
/** | |
* Expand all collapsed selected Groups. | |
* @param {Group=} group if supplied, ignore the selection and expand this particular Group. | |
*/ | |
expandSubGraph(group?: Group): void; | |
/** | |
* Expand all collapsed selected Nodes. | |
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree. | |
*/ | |
expandTree(node?: Node): void; | |
/** | |
* Add a copy of .archetypeGroupData and add it to the diagram's model to create a new Group and then add the selected Parts to that new group. | |
*/ | |
groupSelection(): void; | |
/** | |
* Increase the Diagram.scale by a given factor. | |
* @param {number=} factor This defaults to .zoomFactor. The value should be greater than one. | |
*/ | |
increaseZoom(factor?: Number): void; | |
/** | |
* This predicate is called to determine whether a Node may be added as a member of a Group. | |
* @param {Group} group this may be null if the node is being added as a top-level node. | |
* @param {Part} part a Part, usually a Node, possibly another Group, but not a Link or an Adornment. | |
*/ | |
isValidMember(group: Group, part: Part): boolean; | |
/** | |
* If the clipboard holds a collection of Parts, and if the Model.dataFormat matches that stored in the clipboard, this makes a copy of the clipboard's parts and adds the copies to this Diagram. | |
*/ | |
pasteFromClipboard(): Set<Part>; | |
/** | |
* Copy the contents of the clipboard into this diagram, and make those new parts the new selection. | |
* @param {Point=} pos Point at which to center the newly pasted parts; if not present the parts are not moved. | |
*/ | |
pasteSelection(pos?: Point): void; | |
/** | |
* Call UndoManager.redo. | |
*/ | |
redo(): void; | |
/** | |
* Set the Diagram.scale to a new scale value, by default 1. | |
* @param {number=} newscale This defaults to 1. The value should be greater than zero. | |
*/ | |
resetZoom(newscale?: number): void; | |
/** | |
* This command scrolls the diagram to make a highlighted or selected Part visible in the viewport. | |
* Call this command repeatedly to cycle through the Diagram.highlighteds collection, | |
* if there are any Parts in that collection, or else in the Diagram.selection collection, | |
* scrolling to each one in turn. | |
* <p> | |
* This is normally invoked by the <code>Space</code> keyboard shortcut. | |
* If there is no argument and there is no highlighted or selected Part, this command does nothing. | |
* @param {Part=} part This defaults to the first highlighted Part of Diagram.highlighteds, | |
* or, if there are no highlighted Parts, the first selected Part. | |
*/ | |
scrollToPart(part?: Part): void; | |
/** | |
* Select all of the selectable Parts in the diagram. | |
*/ | |
selectAll(): void; | |
/** | |
* Open the context menu of a given GraphObject. | |
* The given GraphObject must have a GraphObject.contextMenu | |
* defined in order to show anything. | |
* @param {GraphObject|Diagram=} obj a GraphObject or Diagram with a contextMenu defined. | |
* If none is given, this method will use the first selected object, or else the Diagram. | |
*/ | |
showContextMenu(obj?: GraphObject | Diagram): void; | |
/** | |
* Cancel the operation of the current tool. | |
*/ | |
stopCommand(): void; | |
/** | |
* Call UndoManager.undo. | |
*/ | |
undo(): void; | |
/** | |
* Remove the group from the diagram without removing its members from the diagram. | |
* @param {Group=} group if supplied, ignore the selection and consider ungrouping this particular Group. | |
*/ | |
ungroupSelection(group?: Group): void; | |
/** | |
* Change the Diagram.scale so that the Diagram.documentBounds fits within the viewport. | |
*/ | |
zoomToFit(): void; | |
} | |
/** | |
* A Diagram is associated with an HTML DIV element. Constructing a Diagram creates | |
* an HTML Canvas element which it places inside of the given DIV element, in addition to several helper divs. | |
* GoJS will manage the contents of this DIV, and the contents should not be modified otherwise, | |
* though the given DIV may be styled (background, border, etc) and positioned as needed. | |
*/ | |
export class Diagram { | |
/** | |
* Construct an empty Diagram for a particular DIV HTML element. | |
* @param {HTMLDivElement} div A reference to a DIV HTML element in the DOM. | |
* If no DIV is supplied one will be created in memory. The Diagram's Diagram.div property | |
* can then be set later on. | |
*/ | |
constructor(div: HTMLDivElement); | |
/** | |
* Construct an empty Diagram for a particular DIV HTML element. | |
* @param {string=} div The ID of a DIV element in the DOM. | |
* If no DIV identifier is supplied one will be created in memory. The Diagram's Diagram.div property | |
* can then be set later on. | |
*/ | |
constructor(div?: string); | |
/**Gets or sets whether the user may copy to or paste parts from the internal clipboard.*/ | |
allowClipboard: boolean; | |
/**Gets or sets whether the user may copy objects.*/ | |
allowCopy: boolean; | |
/**Gets or sets whether the user may delete objects from the Diagram.*/ | |
allowDelete: boolean; | |
/**Gets or sets whether the user may start a drag-and-drop in this Diagram, possibly dropping in a different element.*/ | |
allowDragOut: boolean; | |
/**Gets or sets whether the user may end a drag-and-drop operation in this Diagram.*/ | |
allowDrop: boolean; | |
/**Gets or sets whether the user may group parts together.*/ | |
allowGroup: boolean; | |
/**Gets or sets whether the user is allowed to use the horizontal scrollbar.*/ | |
allowHorizontalScroll: boolean; | |
/**Gets or sets whether the user may add parts to the Diagram.*/ | |
allowInsert: boolean; | |
/**Gets or sets whether the user may draw new links.*/ | |
allowLink: boolean; | |
/**Gets or sets whether the user may move objects.*/ | |
allowMove: boolean; | |
/**Gets or sets whether the user may reconnect existing links.*/ | |
allowRelink: boolean; | |
/**Gets or sets whether the user may reshape parts.*/ | |
allowReshape: boolean; | |
/**Gets or sets whether the user may resize parts.*/ | |
allowResize: boolean; | |
/**Gets or sets whether the user may rotate parts.*/ | |
allowRotate: boolean; | |
/**Gets or sets whether the user may select objects.*/ | |
allowSelect: boolean; | |
/**Gets or sets whether the user may do in-place text editing.*/ | |
allowTextEdit: boolean; | |
/**Gets or sets whether the user may undo or redo any changes.*/ | |
allowUndo: boolean; | |
/**Gets or sets whether the user may ungroup existing groups.*/ | |
allowUngroup: boolean; | |
/**Gets or sets whether the user is allowed to use the vertical scrollbar.*/ | |
allowVerticalScroll: boolean; | |
/**Gets or sets whether the user may zoom into or out of the Diagram.*/ | |
allowZoom: boolean; | |
/**This read-only property returns the AnimationManager for this Diagram.*/ | |
animationManager: AnimationManager; | |
/**Gets or sets the autoScale of the Diagram, controlling whether or not the Diagram's bounds automatically scale to fit the view.*/ | |
autoScale: EnumValue; | |
/**Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's autoScrollRegion.*/ | |
autoScrollRegion: MarginLike; | |
/**Gets or sets the function to execute when the user single-primary-clicks on the background of the Diagram.*/ | |
click: (e: InputEvent) => void; | |
/**Gets or sets the CommandHandler for this Diagram.*/ | |
commandHandler: CommandHandler; | |
/**Gets or sets the content alignment Spot of this Diagram, to be used in determining how parts are positioned when the .viewportBounds width or height is smaller than the .documentBounds.*/ | |
contentAlignment: Spot; | |
/**Gets or sets the function to execute when the user single-secondary-clicks on the background of the Diagram.*/ | |
contextClick: (e: InputEvent) => void; | |
/**This Adornment or HTMLInfo is shown when the use context clicks in the background.*/ | |
contextMenu: Adornment | HTMLInfo; | |
/**Gets or sets the current cursor for the Diagram, overriding the .defaultCursor.*/ | |
currentCursor: string; | |
/**Gets or sets the current tool for this Diagram that handles all input events.*/ | |
currentTool: Tool; | |
/**Gets or sets the cursor to be used for the Diagram when no GraphObject specifies a different cursor.*/ | |
defaultCursor: string; | |
/**Gets or sets the default tool for this Diagram that becomes the current tool when the current tool stops.*/ | |
defaultTool: Tool; | |
/**Gets or sets the Diagram's HTMLDivElement, via an HTML Element ID.*/ | |
div: HTMLDivElement; | |
/**This read-only property returns the model-coordinate bounds of the Diagram.*/ | |
documentBounds: Rect; | |
/**Gets or sets the function to execute when the user double-primary-clicks on the background of the Diagram.*/ | |
doubleClick: (e: InputEvent) => void; | |
/**Gets or sets the most recent mouse-down InputEvent that occurred.*/ | |
firstInput: InputEvent; | |
/**Gets or sets a fixed bounding rectangle to be returned by .documentBounds and .computeBounds.*/ | |
fixedBounds: Rect; | |
/**Gets or sets the scrollMode of the Diagram.*/ | |
scrollMode: EnumValue; | |
/**Gets or sets the Margin (or number for a uniform Margin) that describes a scrollable area that surrounds the document bounds, allowing the user to scroll into empty space.*/ | |
scrollMargin: MarginLike; | |
/**Gets or sets the function used to determine the position that this Diagram can be scrolled or moved to.*/ | |
positionComputation: (d: Diagram, p: Point) => Point; | |
/**Gets or sets the function used to determine the scale that this Diagram can be set to.*/ | |
scaleComputation: (d: Diagram, s: number) => number; | |
/**Gets or sets a Panel of type Panel.Grid acting as the background grid extending across the whole viewport of this diagram.*/ | |
grid: Panel; | |
/**Gets or sets the default selection Adornment template, used to adorn selected Groups.*/ | |
groupSelectionAdornmentTemplate: Adornment; | |
/**Gets or sets the default Group template used as the archetype for group data that is added to the .model.*/ | |
groupTemplate: Group; | |
/**Gets or sets a Map mapping template names to Groups.*/ | |
groupTemplateMap: Map<string,Group>; | |
/**Gets or sets whether the Diagram has a horizontal Scrollbar.*/ | |
hasHorizontalScrollbar: boolean; | |
/**Gets or sets whether the Diagram has a vertical Scrollbar.*/ | |
hasVerticalScrollbar: boolean; | |
/**This read-only property returns the read-only collection of highlighted Parts.*/ | |
highlighteds: Set<Part>; | |
/**Gets or sets the initialAutoScale of the Diagram.*/ | |
initialAutoScale: EnumValue; | |
/**Gets or sets the initial content alignment Spot of this Diagram, to be used in determining how parts are positioned initially relative to the viewport.*/ | |
initialContentAlignment: Spot; | |
/**Gets or sets the spot in the document's area that should be coincident with the .initialViewportSpot of the viewport when the document is first initialized.*/ | |
initialDocumentSpot: Spot; | |
/**Gets or sets the initial coordinates of this Diagram in the viewport, eventually setting the .position.*/ | |
initialPosition: Point; | |
/**Gets or sets the initial scale of this Diagram in the viewport, eventually setting the .scale.*/ | |
initialScale: number; | |
/**Gets or sets the spot in the viewport that should be coincident with the .initialDocumentSpot of the document when the document is first initialized.*/ | |
initialViewportSpot: Spot; | |
/**Gets or sets whether the user may interact with the Diagram.*/ | |
isEnabled: boolean; | |
/**Gets or sets whether the Diagram's Diagram.model is Model.isReadOnly.*/ | |
isModelReadOnly: boolean; | |
/**Gets or sets whether this Diagram's state has been modified.*/ | |
isModified: boolean; | |
/**Gets or sets whether mouse events initiated within the Diagram will be captured.*/ | |
isMouseCaptured: boolean; | |
/**Gets or sets whether the Diagram may be modified by the user, while still allowing the user to scroll, zoom, and select.*/ | |
isReadOnly: boolean; | |
/**Gets or sets whether the Diagram tree structure is defined by links going from the parent node to their children, or vice-versa.*/ | |
isTreePathToChildren: boolean; | |
/**Gets or sets the last InputEvent that occurred.*/ | |
lastInput: InputEvent; | |
/**Gets an iterator for this Diagram's Layers.*/ | |
layers: Iterator<Layer>; | |
/**Gets or sets the Layout used to position all of the top-level nodes and links in this Diagram.*/ | |
layout: Layout; | |
/**Returns an iterator of all Links in the Diagram.*/ | |
links: Iterator<Link>; | |
/**Gets or sets the default selection Adornment template, used to adorn selected Links.*/ | |
linkSelectionAdornmentTemplate: Adornment; | |
/**Gets or sets the default Link template used as the archetype for link data that is added to the .model.*/ | |
linkTemplate: Link; | |
/**Gets or sets a Map mapping template names to Links.*/ | |
linkTemplateMap: Map<string,Link>; | |
/**Gets or sets the largest value that .scale may take.*/ | |
maxScale: number; | |
/**Gets or sets the maximum number of selected objects.*/ | |
maxSelectionCount: number; | |
/**Gets or sets the smallest value greater than zero that .scale may take.*/ | |
minScale: number; | |
/**Gets or sets the Model holding data corresponding to the data-bound nodes and links of this Diagram.*/ | |
model: Model; | |
/**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.*/ | |
mouseDragOver: (e: InputEvent) => void; | |
/**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.*/ | |
mouseDrop: (e: InputEvent) => void; | |
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram while holding down a button, not over any GraphObjects.*/ | |
mouseHold: (e: InputEvent) => void; | |
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the Diagram without holding down any buttons, not over any GraphObjects.*/ | |
mouseHover: (e: InputEvent) => void; | |
/**Gets or sets the function to execute when the user moves the mouse in the background of the Diagram without holding down any buttons, not over any GraphObjects.*/ | |
mouseOver: (e: InputEvent) => void; | |
/**Returns an iterator of all Nodes and Groups in the Diagram.*/ | |
nodes: Iterator<Node>; | |
/**Gets or sets the default selection Adornment template, used to adorn selected Parts other than Groups or Links.*/ | |
nodeSelectionAdornmentTemplate: Adornment; | |
/**Gets or sets the default Node template used as the archetype for node data that is added to the .model.*/ | |
nodeTemplate: Part; | |
/**Gets or sets a Map mapping template names to Parts.*/ | |
nodeTemplateMap: Map<string,Part>; | |
/**Gets or sets the Margin (or number for a uniform Margin) that describes the Diagram's padding, which controls how much extra space there is around the area occupied by the document.*/ | |
padding: MarginLike; | |
/**Returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.*/ | |
parts: Iterator<Part>; | |
/**Gets or sets the coordinates of this Diagram in the viewport.*/ | |
position: Point; | |
/**Gets or sets the scale transform of this Diagram.*/ | |
scale: number; | |
/**Gets or sets the distance in screen pixels that the horizontal scrollbar will scroll when scrolling by a line.*/ | |
scrollHorizontalLineChange: number; | |
/**Gets or sets the distance in screen pixels that the vertical scrollbar will scroll when scrolling by a line.*/ | |
scrollVerticalLineChange: number; | |
/**This read-only property returns the read-only collection of selected Parts.*/ | |
selection: Set<Part>; | |
/**Gets or sets whether ChangedEvents are not recorded by the UndoManager.*/ | |
skipsUndoManager: boolean; | |
/**This read-only property returns the ToolManager for this Diagram.*/ | |
toolManager: ToolManager; | |
/**This Adornment or HTMLInfo is shown when the mouse stays motionless in the background.*/ | |
toolTip: Adornment | HTMLInfo; | |
/**This read-only property returns the UndoManager for this Diagram, which actually belongs to the .model.*/ | |
undoManager: UndoManager; | |
/**Gets or sets what kinds of graphs this diagram allows the user to draw.*/ | |
validCycle: EnumValue; | |
/**This read-only property returns the bounds of the portion of the Diagram that is viewable from its HTML Canvas.*/ | |
viewportBounds: Rect; | |
/**Gets or sets the point, in viewport coordinates, where changes to the .scale will keep the focus in the document.*/ | |
zoomPoint: Point; | |
/** | |
* Adds a Part to the Layer that matches the Part's Part.layerName, or else to the default layer, which is named with the empty string. | |
* @param {Part} part | |
*/ | |
add(part: Part): void; | |
/** | |
* Register an event handler that is called when there is a ChangedEvent. | |
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. | |
*/ | |
addChangedListener(listener: (e: ChangedEvent) => void ): void; | |
/** | |
* Register an event handler that is called when there is a DiagramEvent of a given name. | |
* @param {string} name the name is normally capitalized, but this method uses case-insensitive comparison. | |
* @param {function(DiagramEvent)} listener a function that takes a DiagramEvent as its argument. | |
*/ | |
addDiagramListener(name: string, listener: (e: DiagramEvent) => void ): void; | |
/** | |
* Register an event handler that is called when there is a ChangedEvent for the Diagram's Model. | |
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. | |
*/ | |
addModelChangedListener(listener: (e: ChangedEvent) => void ): void; | |
/** | |
* Adds a Layer to the list of layers. | |
* @param {Layer} layer The Layer to add. | |
*/ | |
addLayer(layer: Layer): void; | |
/** | |
* Adds a layer to the list of layers after a specified layer. | |
* @param {Layer} layer The Layer to add. | |
* @param {Layer} existingLayer The layer to insert after. | |
*/ | |
addLayerAfter(layer: Layer, existingLayer: Layer): void; | |
/** | |
* Adds a layer to the list of layers before a specified layer. | |
* @param {Layer} layer The Layer to add. | |
* @param {Layer} existingLayer The layer to insert before. | |
*/ | |
addLayerBefore(layer: Layer, existingLayer: Layer): void; | |
/** | |
* Aligns the Diagram's .position based on a desired document Spot and viewport Spot. | |
* @param {Spot} documentspot | |
* @param {Spot} viewportspot | |
*/ | |
alignDocument(documentspot: Spot, viewportspot: Spot): void; | |
/** | |
* Modifies the .position to show a given Rect of the Diagram by centering the viewport on that Rect. | |
* @param {Rect} r | |
*/ | |
centerRect(r: Rect): void; | |
/** | |
* Removes all Parts from the Diagram, including unbound Parts and the background grid, and also clears out the Model and UndoManager. | |
*/ | |
clear(): void; | |
/** | |
* Remove highlights from all Parts. | |
*/ | |
clearHighlighteds(): void; | |
/** | |
* Deselect all selected Parts. | |
*/ | |
clearSelection(): void; | |
/** | |
* Commit the changes of the current transaction. | |
* This just calls UndoManager.commitTransaction. | |
* @param {string=} tname a descriptive name for the transaction. | |
*/ | |
commitTransaction(tname?: string): boolean; | |
/** | |
* This is called during a Diagram update to determine a new value for .documentBounds. | |
*/ | |
computeBounds(): Rect; | |
/** | |
* Find the union of the GraphObject.actualBounds of all of the Parts in the given collection. | |
* @param {Iterable<Part>} coll a collection of Parts. | |
* @param {boolean=} includeLinks, defaults to false | |
*/ | |
computePartsBounds(coll: Iterable<Part>, includesLinks?: boolean): Rect; | |
/** | |
* Make a copy of a collection of Parts and return them in a Map mapping each original Part to its copy. | |
* @param {Iterable<Part>} coll A List or a Set or Iterator of Parts. | |
* @param {Diagram} diagram The destination diagram; if null, the copied parts are not added to this diagram. | |
* @param {boolean} check Whether to check Part.canCopy on each part. | |
*/ | |
copyParts(coll: Iterable<Part>, diagram: Diagram, check: boolean): Map<Part, Part>; | |
/** | |
* Updates the diagram immediately, then resets initialization flags so that actions taken in the argument function will be considered part of Diagram initialization, and will participate in initial layouts, .initialAutoScale, .initialContentAlignment, etc. | |
* @param {function()|null=} func an optional function of actions to perform as part of another diagram initialization. | |
*/ | |
delayInitialization(func?: () => void ): void; | |
/** | |
* Finds a layer with a given name. | |
* @param {string} name | |
*/ | |
findLayer(name: string): Layer; | |
/** | |
* Look for a Link corresponding to a GraphLinksModel's link data object. | |
* @param {Object} linkdata | |
*/ | |
findLinkForData(linkdata: Object): Link; | |
/** | |
* Return a collection of Links that are bound to data whose properties have values | |
* that match those specified by the given example data. | |
* @param {...Object} examples | |
*/ | |
findLinksByExample(...examples: Array<Object>): Iterator<Link>; | |
/** | |
* Look for a Node or Group corresponding to a model's node data object. | |
* @param {Object} nodedata | |
*/ | |
findNodeForData(nodedata: Object): Node; | |
/** | |
* Look for a Node or Group corresponding to a model's node data object's unique key. | |
* @param {*} key a string or number. | |
*/ | |
findNodeForKey(key: Key): Node; | |
/** | |
* Return a collection of Nodes and Groups that are bound to data whose properties have values | |
* that match those specified by the given example data. | |
* @param {...Object} examples | |
*/ | |
findNodesByExample(...examples: Array<Object>): Iterator<Node>; | |
/** | |
* Find the front-most GraphObject at the given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
*/ | |
findObjectAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean): GraphObject; | |
/** | |
* Return a collection of the GraphObjects at the given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
/** | |
* Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates. | |
* @param {Rect} r A Rect in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the rectangular area (true) or | |
* if it must be entirely inside the rectangular area (false). The default value is false. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
/** | |
* Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {number} dist The distance from the point. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the circular area (true) or | |
* if it must be entirely inside the circular area (false). The default value is true. | |
* The default is true. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
/** | |
* This convenience function finds the front-most Part that is at a given point and that might be selectable. | |
* @param {Point} p a Point in document coordinates. | |
* @param {boolean} selectable Whether to only consider parts that are Part.selectable. | |
*/ | |
findPartAt(p: Point, selectable: boolean): Part; | |
/** | |
* Look for a Part, Node, Group, or Link corresponding to a Model's data object. | |
* @param {Object} data | |
*/ | |
findPartForData(data: Object): Part; | |
/** | |
* Look for a Part or Node or Group corresponding to a model's data object's unique key. | |
* May return a Link if the GraphLinksModel is maintaining keys for link data. | |
* @param {*} key a string or number. | |
*/ | |
findPartForKey(key: Key): Part; | |
/** | |
* Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups. | |
*/ | |
findTopLevelGroups(): Iterator<Group>; | |
/** | |
* Returns an iterator of all top-level Nodes that have no tree parents. | |
*/ | |
findTreeRoots(): Iterator<Node>; | |
/** | |
* Explicitly bring focus to the Diagram's canvas. | |
*/ | |
focus(): void; | |
/** | |
* This static function gets the Diagram that is attached to an HTML DIV element. | |
* @param {HTMLDivElement} div | |
*/ | |
static fromDiv(div: HTMLDivElement): Diagram; | |
/** | |
* Make the given part the only highlighted part. | |
* @param {Part} part | |
*/ | |
highlight(part: Part): void; | |
/** | |
* Highlight all of the Parts supplied in the given collection, and clear all other highlighted Parts. | |
* @param {Iterable<Part>|Array<Part>} coll an Iterable of Parts | |
*/ | |
highlightCollection(coll: Iterable<Part> | Array<Part>): void; | |
/** | |
* This static function declares that a class (constructor function) derives from another class -- but please note that most classes do not support inheritance. | |
* @param {Function} derivedclass | |
* @param {Function} baseclass | |
*/ | |
static inherit(derivedclass: Constructor, baseclass: Constructor): void; | |
/** | |
* Perform all invalid layouts. | |
* @param {boolean=} invalidateAll If true, this will explicitly set Layout.isValidLayout to false on each Layout in the diagram. | |
*/ | |
layoutDiagram(invalidateAll?: boolean): void; | |
/** | |
* Create an HTMLImageElement that contains a bitmap of the current Diagram. | |
* @param {Object=} properties For details see the argument description of .makeImageData. | |
*/ | |
makeImage(properties?: { | |
size?: Size, | |
scale?: number, | |
maxSize?: Size, | |
position?: Point, | |
parts?: Iterable<Part>, | |
padding?: MarginLike, | |
background?: BrushLike, | |
showTemporary?: boolean, | |
showGrid?: boolean, | |
document?: Document, | |
type?: string, | |
details?: any | |
}): HTMLImageElement; | |
/** | |
* Create a bitmap of the current Diagram encoded as an ImageData, or a base64-encoded string describing the image. | |
* @param {Object=} properties a JavaScript object detailing optional arguments for image creation, to be passed to makeImageData. | |
*/ | |
makeImageData(properties?: { | |
size?: Size, | |
scale?: number, | |
maxSize?: Size, | |
position?: Point, | |
parts?: Iterable<Part>, | |
padding?: MarginLike, | |
background?: BrushLike, | |
showTemporary?: boolean, | |
showGrid?: boolean, | |
document?: Document, | |
returnType?: string, | |
callback?: void, | |
type?: string, | |
details?: any | |
}): ImageData | string; | |
/** | |
* Create an SVGElement that contains a SVG rendering of the current Diagram. | |
* By default this method returns a snapshot of the visible diagram, but optional arguments give more options. | |
* @param {Object=} properties a JavaScript object detailing optional arguments for SVG creation. | |
*/ | |
makeSvg(properties?: { | |
size?: Size, | |
scale?: number, | |
maxSize?: Size, | |
position?: Point, | |
parts?: Iterable<Part>, | |
padding?: MarginLike, | |
background?: BrushLike, | |
showTemporary?: boolean, | |
showGrid?: boolean, | |
document?: Document, | |
elementFinished?: (obj: GraphObject, elt: SVGElement) => void | |
}): SVGElement; | |
/** | |
* Move a collection of Parts in this Diagram by a given offset. | |
* @param {Iterable<Part>} coll A List or a Set or Iterator of Parts. | |
* @param {Point} offset the X and Y change to be made to each Part, in document coordinates. | |
* @param {boolean} check Whether to check Part.canMove on each part. | |
*/ | |
moveParts(coll: Iterable<Part>, offset: Point, check: boolean): void; | |
/** | |
* Remove all of the Parts created from model data and then create them again. | |
*/ | |
rebuildParts(): void; | |
/** | |
* Removes a Part from its Layer, provided the Layer is in this Diagram. | |
* @param {Part} part | |
*/ | |
remove(part: Part): void; | |
/** | |
* Unregister an event handler listener. | |
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. | |
*/ | |
removeChangedListener(listener: (e: ChangedEvent) => void ): void; | |
/** | |
* Unregister a DiagramEvent handler. | |
* @param {string} name the name is normally capitalized, but this method uses case-insensitive comparison. | |
* @param {function(DiagramEvent)} listener a function that takes a DiagramEvent as its argument. | |
*/ | |
removeDiagramListener(name: string, listener: (e: DiagramEvent) => void ): void; | |
/** | |
* Unregister an event handler listener for the Diagram's Model. | |
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument. | |
*/ | |
removeModelChangedListener(listener: (e: ChangedEvent) => void ): void; | |
/** | |
* Removes the given layer from the list of layers. | |
* @param {Layer} layer | |
*/ | |
removeLayer(layer: Layer): void; | |
/** | |
* This method removes from this Diagram all of the Parts in a collection. | |
* @param {Iterable<Part>|Array<Part>} coll A List or Set or Iterator of Parts. | |
* @param {boolean} check Whether to check Part.canDelete on each part. | |
*/ | |
removeParts(coll: Iterable<Part> | Array<Part>, check: boolean): void; | |
/** | |
* Requests that in the near-future the diagram makes sure all GraphObjects are arranged, | |
* recomputes the document bounds, updates the scrollbars, and redraws the viewport. | |
* Usage of this method is uncommon and may affect performance -- | |
* for efficiency do not call this method unless you have a well-defined need. | |
* Normally, GoJS updates the diagram automatically, and completeing a transaction ensures an immediate update. | |
* <p> | |
* @param {boolean=} alwaysQueueUpdate If true the Diagram will queue another update, | |
* even if an update is already occurring. The default value is false. | |
* Side effects in an "InitialLayoutCompleted" DiagramEvent listener might necessitate setting this parameter. | |
*/ | |
requestUpdate(alwaysQueueUpdate?: boolean): void; | |
/** | |
* Rollback the current transaction, undoing any recorded changes. | |
* This just calls UndoManager.rollbackTransaction. | |
*/ | |
rollbackTransaction(): boolean; | |
/** | |
* Scrolling function used by primarily by .commandHandler's CommandHandler.doKeyDown. | |
* @param {string} unit A string representing the unit of the scroll operation. Can be 'pixel', 'line', or 'page'. | |
* @param {string} dir The direction of the scroll operation. Can be 'up', 'down', 'left', or 'right'. | |
* @param {number=} dist An optional distance multiplier, for multiple pixels, lines, or pages. Default is 1. | |
*/ | |
scroll(unit: string, dir: string, dist?: number): void; | |
/** | |
* Modifies the .position to show a given Rect of the Diagram by centering the viewport on that Rect. | |
* @param {Rect} r | |
*/ | |
scrollToRect(r: Rect): void; | |
/** | |
* Make the given object the only selected object. | |
* @param {GraphObject} part a GraphObject that is already in a layer of this Diagram. | |
* If the value is null, this does nothing. | |
*/ | |
select(part: Part): void; | |
/** | |
* Select all of the Parts supplied in the given collection. | |
* @param {Iterable<Part>|Array<Part>} coll a List or Set of Parts to be selected. | |
*/ | |
selectCollection(coll: Iterable<Part> | Array<Part>): void; | |
/** | |
* This method sets a collection of properties according to the property/value pairs that have been set on the given Object, | |
* in the same manner as GraphObject.make does when constructing a Diagram with an argument that is a simple JavaScript Object. | |
*/ | |
setProperties(props: Object): void; | |
/** | |
* Begin a transaction, where the changes are held by a Transaction object in the UndoManager. | |
* This just calls UndoManager.startTransaction. | |
* @param {string=} tname a descriptive name for the transaction. | |
*/ | |
startTransaction(tname?: string): boolean; | |
/** | |
* Given a Point in document coordinates, return a new Point in viewport coordinates. | |
* @param {Point} p | |
*/ | |
transformDocToView(p: Point): Point; | |
/** | |
* Given a point in viewport coordinates, return a new point in document coordinates. | |
* @param {Point} p | |
*/ | |
transformViewToDoc(p: Point): Point; | |
/** | |
* Update all of the data-bound properties of Nodes and Links in this diagram. | |
*/ | |
updateAllTargetBindings(): void; | |
/** | |
* Update all of the references to nodes in case they had been modified in the model without | |
* properly notifying the model by calling GraphLinksModel.setGroupKeyForNodeData or | |
* GraphLinksModel.setToKeyForLinkData or other similar methods. | |
*/ | |
updateAllRelationshipsFromData(): void; | |
/** | |
* Scales the Diagram to uniformly fit into the viewport. | |
*/ | |
zoomToFit(): void; | |
/** | |
* Modifies the .scale and .position of the Diagram so that the viewport displays a given document-coordinates rectangle. | |
* @param {Rect} r rectangular bounds in document coordinates. | |
* @param {EnumValue=} scaling an optional value of either .Uniform (the default) or .UniformToFill. | |
*/ | |
zoomToRect(r: Rect, scaling?: EnumValue): void; | |
/**This value for Diagram.validCycle states that there are no restrictions on making cycles of links.*/ | |
static CycleAll: EnumValue; | |
/**This value for Diagram.validCycle states that any number of destination links may go out of a node, but at most one source link may come into a node, and there are no directed cycles.*/ | |
static CycleDestinationTree: EnumValue; | |
/**This value for Diagram.validCycle states that a valid link from a node will not produce a directed cycle in the graph.*/ | |
static CycleNotDirected: EnumValue; | |
/**This value for Diagram.validCycle states that a valid link from a node will not produce an undirected cycle in the graph.*/ | |
static CycleNotUndirected: EnumValue; | |
/**This value for Diagram.validCycle states that any number of source links may come into a node, but at most one destination link may go out of a node, and there are no directed cycles.*/ | |
static CycleSourceTree: EnumValue; | |
/**The default autoScale type, used as the value of Diagram.autoScale: The Diagram does not attempt to scale its bounds to fit the view.*/ | |
static None: EnumValue; | |
/**Diagrams with this autoScale type, used as the value of Diagram.autoScale, are scaled uniformly until the documentBounds fits in the view.*/ | |
static Uniform: EnumValue; | |
/**Diagrams with this autoScale type, used as the value of Diagram.autoScale, are scaled uniformly until the documentBounds fits in the view.*/ | |
static UniformToFill: EnumValue; | |
/**This value for Diagram.scrollMode states that the viewport constrains scrolling to the Diagram document bounds.*/ | |
static DocumentScroll: EnumValue; | |
/**This value for Diagram.scrollMode states that the viewport does not constrain scrolling to the Diagram document bounds.*/ | |
static InfiniteScroll: EnumValue; | |
getRenderingHint(name: string): any; // undocumented | |
setRenderingHint(name: string, val: any): void; // undocumented | |
getInputOption(name: string): any; // undocumented | |
setInputOption(name: string, val: any): void; // undocumented | |
doFocus(): void; // undocumented | |
maybeUpdate(): void; // undocumented | |
reset(): void; // undocumented | |
simulatedMouseMove(e: Event, modelpt: Point, overdiag?: Diagram): boolean; // undocumented | |
simulatedMouseUp(e: Event, other: Diagram, modelpt: Point, curdiag?: Diagram): boolean; // undocumented | |
computePixelRatio(): number; // undocumented | |
commit(func: (d: Diagram) => void, tname?: string): void; // undocumented | |
} | |
/** | |
* A DiagramEvent represents a more abstract event than an InputEvent. | |
* They are raised on the Diagram class. | |
* One can receive such events by registering a DiagramEvent listener on a Diagram | |
* by calling Diagram.addDiagramListener. | |
* Some DiagramEvents such as "ObjectSingleClicked" are normally | |
* associated with InputEvents. | |
* Some DiagramEvents such as "SelectionMoved" or "PartRotated" are associated with the | |
* results of Tool-handled gestures or CommandHandler actions. | |
* Some DiagramEvents are not necessarily associated with any input events at all, | |
* such as "ViewportBoundsChanged", which can happen due to programmatic | |
* changes to the Diagram.position and Diagram.scale properties. | |
*/ | |
export class DiagramEvent { | |
/** | |
* The DiagramEvent class constructor produces an empty DiagramEvent. | |
*/ | |
constructor(); | |
/**This read-only property returns the diagram associated with the event.*/ | |
diagram: Diagram; | |
/**Gets or sets the name of the kind of diagram event that this represents.*/ | |
name: string; | |
/**Gets or sets an optional object that describes the change to the subject of the diagram event.*/ | |
parameter: any; | |
/**Gets or sets an optional object that is the subject of the diagram event.*/ | |
subject: any; | |
cancel: boolean; // undocumented, deprecated | |
} | |
/** | |
* This is the abstract base class for all graphical objects. | |
*/ | |
export abstract class GraphObject { | |
/** | |
* This is an abstract class, so you should not use this constructor. | |
*/ | |
constructor(); | |
/**Gets or sets the function to execute when the ActionTool is cancelled and this GraphObject's .isActionable is set to true.*/ | |
actionCancel: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute on a mouse-down event when this GraphObject's .isActionable is set to true.*/ | |
actionDown: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute on a mouse-move event when this GraphObject's .isActionable is set to true.*/ | |
actionMove: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute on a mouse-up event when this GraphObject's .isActionable is set to true.*/ | |
actionUp: (e: InputEvent, obj: GraphObject) => void; | |
/**This read-only property returns the bounds of this GraphObject in container coordinates.*/ | |
actualBounds: Rect; | |
/**Gets or sets the alignment Spot of this GraphObject used in Panel layouts, to determine where in the area allocated by the panel this object should be placed.*/ | |
alignment: Spot; | |
/**Gets or sets the spot on this GraphObject to be used as the alignment point in Spot and Fixed Panels.*/ | |
alignmentFocus: Spot; | |
/**Gets or sets the angle transform, in degrees, of this GraphObject.*/ | |
angle: number; | |
/**Gets or sets the areaBackground Brush (or CSS color string) of this GraphObject.*/ | |
areaBackground: BrushLike; | |
/**Gets or sets the background Brush (or CSS color string) of this GraphObject, filling the rectangle of this object's local coordinate space.*/ | |
background: BrushLike; | |
/**Gets or sets the function to execute when the user single-primary-clicks on this object.*/ | |
click: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the column of this GraphObject if it is in a Table Panel.*/ | |
column: number; | |
/**Gets or sets the number of columns spanned by this GraphObject if it is in a Table Panel.*/ | |
columnSpan: number; | |
/**Gets or sets the function to execute when the user single-secondary-clicks on this object.*/ | |
contextClick: (e: InputEvent, obj: GraphObject) => void; | |
/**This Adornment or HTMLInfo is shown upon a context click on this object.*/ | |
contextMenu: Adornment | HTMLInfo; | |
/**Gets or sets the mouse cursor to use when the mouse is over this object with no mouse buttons pressed.*/ | |
cursor: string; | |
/**Gets or sets the desired size of this GraphObject in local coordinates.*/ | |
desiredSize: Size; | |
/**This read-only property returns the Diagram that this GraphObject is in, if it is.*/ | |
diagram: Diagram; | |
/**Gets or sets the function to execute when the user double-primary-clicks on this object.*/ | |
doubleClick: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the length of the last segment of a link coming from this port.*/ | |
fromEndSegmentLength: number; | |
/**Gets or sets whether the user may draw Links from this port. The value must be either a boolean or null.*/ | |
fromLinkable: boolean; | |
/**Gets or sets whether the user may draw duplicate Links from this port.*/ | |
fromLinkableDuplicates: boolean; | |
/**Gets or sets whether the user may draw Links that connect from this port's Node.*/ | |
fromLinkableSelfNode: boolean; | |
/**Gets or sets the maximum number of links that may come out of this port.*/ | |
fromMaxLinks: number; | |
/**Gets or sets how far the end segment of a link coming from this port stops short of the actual port.*/ | |
fromShortLength: number; | |
/**Gets or sets where a link should connect from this port.*/ | |
fromSpot: Spot; | |
/**Gets or sets the desired height of this GraphObject in local coordinates.*/ | |
height: number; | |
/**This property determines whether or not this GraphObject's events occur before all other events, including selection.*/ | |
isActionable: boolean; | |
/**Gets or sets a function that is called when the value of any containing Panel's Panel.isEnabled has changed*/ | |
enabledChanged: (obj: GraphObject, enabled: boolean) => void; | |
/**Gets or sets whether a GraphObject is the "main" object for some types of Panel.*/ | |
isPanelMain: boolean; | |
/**This read-only property returns the GraphObject's containing Layer, if there is any.*/ | |
layer: Layer; | |
/**Gets or sets the size of empty area around this GraphObject, as a Margin (or number for a uniform Margin), in the containing Panel coordinates.*/ | |
margin: MarginLike; | |
/**Gets or sets the maximum size of this GraphObject in container coordinates (either a Panel or the document).*/ | |
maxSize: Size; | |
/**This read-only property returns the measuredBounds of the GraphObject in container coordinates (either a Panel or the document).*/ | |
measuredBounds: Rect; | |
/**Gets or sets the minimum size of this GraphObject in container coordinates (either a Panel or the document).*/ | |
minSize: Size; | |
/**Gets or sets the function to execute when the user moves the mouse into this stationary object during a DraggingTool drag.*/ | |
mouseDragEnter: (e: InputEvent, obj: GraphObject, prev: GraphObject) => void; | |
/**Gets or sets the function to execute when the user moves the mouse out of this stationary object during a DraggingTool drag.*/ | |
mouseDragLeave: (e: InputEvent, obj: GraphObject, prev: GraphObject) => void; | |
/**Gets or sets the function to execute when a user drops the selection on this object at the end of a DraggingTool drag.*/ | |
mouseDrop: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute when the user moves the mouse into this object without holding down any buttons.*/ | |
mouseEnter: (e: InputEvent, obj: GraphObject, prev: GraphObject) => void; | |
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the diagram while holding down a button over this object.*/ | |
mouseHold: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute when the user holds the mouse stationary in the background of the diagram without holding down any buttons over this object.*/ | |
mouseHover: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the function to execute when the user moves the mouse into this object without holding down any buttons.*/ | |
mouseLeave: (e: InputEvent, obj: GraphObject, prev: GraphObject) => void; | |
/**Gets or sets the function to execute when the user moves the mouse over this object without holding down any buttons.*/ | |
mouseOver: (e: InputEvent, obj: GraphObject) => void; | |
/**Gets or sets the name for this object.*/ | |
name: string; | |
/**This read-only property returns the natural bounding rectangle of this GraphObject in local coordinates, before any transformation by .scale or .angle, and before any resizing due to .minSize or .maxSize or .stretch.*/ | |
naturalBounds: Rect; | |
/**Gets or sets the multiplicative opacity for this GraphObject and (if a Panel) all nested elements.*/ | |
opacity: number; | |
/**This read-only property returns the GraphObject's containing Panel, or null if this object is not in a Panel.*/ | |
panel: Panel; | |
/**This read-only property returns the Part containing this object, if any.*/ | |
part: Part; | |
/**Gets or sets whether or not this GraphObject can be chosen by visual "find" methods such as Diagram.findObjectAt.*/ | |
pickable: boolean; | |
/**Gets or sets an identifier for an object acting as a port on a Node.*/ | |
portId: string; | |
/**Gets or sets the position of this GraphObject in container coordinates (either a Panel or the document).*/ | |
position: Point; | |
/**Gets or sets the row of this GraphObject if it is in a Table Panel.*/ | |
row: number; | |
/**Gets or sets the number of rows spanned by this GraphObject if it is in a Table Panel.*/ | |
rowSpan: number; | |
/**Gets or sets the scale transform of this GraphObject.*/ | |
scale: number; | |
/**Gets or sets the fractional distance along a segment of a GraphObject that is in a Link.*/ | |
segmentFraction: number; | |
/**Gets or sets the segment index of a GraphObject that is in a Link.*/ | |
segmentIndex: number; | |
/**Gets or sets the offset of a GraphObject that is in a Link from a point on a segment.*/ | |
segmentOffset: Point; | |
/**Gets or sets the orientation of a GraphObject that is in a Link.*/ | |
segmentOrientation: EnumValue; | |
/**Gets or sets whether this GraphObject will be shadowed inside a Part that has Part.isShadowed set to true; default is null, meaning obey default shadow rules for Part.isShadowed.*/ | |
shadowVisible: boolean; | |
/**Gets or sets the stretch of the GraphObject.*/ | |
stretch: EnumValue; | |
/**Gets or sets the length of the last segment of a link going to this port.*/ | |
toEndSegmentLength: number; | |
/**Gets or sets whether the user may draw Links to this port. The value must be either a boolean or null.*/ | |
toLinkable: boolean; | |
/**Gets or sets whether the user may draw duplicate Links to this port.*/ | |
toLinkableDuplicates: boolean; | |
/**Gets or sets whether the user may draw Links that connect to this port's Node.*/ | |
toLinkableSelfNode: boolean; | |
/**Gets or sets the maximum number of links that may go into this port.*/ | |
toMaxLinks: number; | |
/**This Adornment or HTMLInfo is shown when the mouse hovers over this object.*/ | |
toolTip: Adornment | HTMLInfo; | |
/**Gets or sets how far the end segment of a link going to this port stops short of the actual port.*/ | |
toShortLength: number; | |
/**Gets or sets where a link should connect to this port.*/ | |
toSpot: Spot; | |
/**Gets or sets whether a GraphObject is visible.*/ | |
visible: boolean; | |
/**Gets or sets the desired width of this GraphObject in local coordinates.*/ | |
width: number; | |
/** | |
* Add a data-binding of a property on this GraphObject to a property on a data object. | |
* @param {Binding} binding | |
*/ | |
bind(binding: Binding): void; | |
/** | |
* Creates a deep copy of this GraphObject and returns it. | |
*/ | |
copy(): GraphObject; | |
/** | |
* This static function defines a named function that GraphObject.make can use to build objects. | |
* @param {string} name a capitalized name; must not be "" or "None" | |
* @param {function(Array<*>):Object} func | |
*/ | |
static defineBuilder(name: string, func: (args: Array<any>) => Object): void; | |
/** | |
* This static function returns the first argument from the arguments array passed | |
* to a GraphObject.defineBuilder function by GraphObject.make. | |
* By default this requires the first argument to be a string, | |
* but you can provide a predicate to determine whether the argument is suitable. | |
* @param {Array} args | |
* @param {*=} defval the default value to return if the argument is optional and not present as the first argument | |
* @param {function(*):boolean|null=} pred a predicate to determine the acceptability of the argument; | |
* the default predicate checks whether the argument is a string | |
*/ | |
static takeBuilderArgument(args: Array<any>, defval?: any, pred?: (arg: any) => boolean): any; | |
/** | |
* Returns the effective angle that the object is drawn at, in document coordinates. | |
*/ | |
getDocumentAngle(): number; | |
/** | |
* Returns the Point in document coordinates for a given Spot in this object's bounds. | |
* @param {Spot} s a real Spot describing a location relative to the GraphObject. | |
* @param {Point=} result an optional Point that is modified and returned in document coordinates. | |
*/ | |
getDocumentPoint(s: Spot, result?: Point): Point; | |
/** | |
* Returns the Point in document coordinates for a given Point in this object's local coordinates. | |
* @param {Point} p a Point in local coordinates. | |
* @param {Point=} result an optional Point that is modified and returned in document coordinates. | |
*/ | |
getDocumentPoint(p: Point, result?: Point): Point; | |
/** | |
* Returns the total scale that the object is drawn at, in document coordinates. | |
*/ | |
getDocumentScale(): number; | |
/** | |
* Given a Point in document coordinates, returns a new Point in local coordinates. | |
* @param {Point} p a Point in document coordinates. | |
* @param {Point=} result an optional Point that is modified and returned. | |
*/ | |
getLocalPoint(p: Point, result?: Point): Point; | |
/** | |
* This predicate is true if this object is an element, perhaps indirectly, of the given panel. | |
* @param {GraphObject} panel | |
* or if it is contained by another panel that is contained by the given panel, | |
* to any depth; false if the argument is null or is not a Panel. | |
*/ | |
isContainedBy(panel: GraphObject): boolean; | |
/** | |
* This predicate is false if this object is inside any Panel that is not Panel#isEnabled, or if this is itself a disabled panel. | |
*/ | |
isEnabledObject(): boolean; | |
/** | |
* This predicate is true if this object is .visible and each of its visual containing panels are also visible. | |
*/ | |
isVisibleObject(): boolean; | |
/** | |
* This method sets a collection of properties according to the property/value pairs that have been set on the given Object, | |
* in the same manner as GraphObject.make does when constructing a GraphObject with an argument that is a simple JavaScript Object. | |
*/ | |
setProperties(props: Object): void; | |
/** | |
* This static function builds an object given its class and additional arguments providing initial properties or GraphObjects that become Panel elements. | |
* @param {function()|string} type a class function or the name of a class in the "go" namespace, | |
* or one of several predefined kinds of Panels: "Button", "TreeExpanderButton", | |
* "SubGraphExpanderButton", or "ContextMenuButton". | |
* @param {...*} initializers zero or more values that initialize the new object, | |
* typically an Object with properties whose values that get set on the new object, | |
* or a GraphObject that is added to a Panel, | |
* or a Binding for one of the new object's properties, | |
* or an EnumValue as the initial value of a single property of the new object that | |
* is recognized to take that value, | |
* or a string that is used as the value of a commonly set property. | |
*/ | |
static make(type: Constructor | string, ...initializers: Array<any>): any; | |
/**GraphObjects with this as the value of GraphObject.stretch are stretched depending on the context they are used.*/ | |
static Default: EnumValue; | |
/**GraphObjects with this as the value of GraphObject.stretch are scaled in both directions so as to fit exactly in the given bounds; there is no clipping but the aspect ratio may change, causing the object to appear stretched.*/ | |
static Fill: EnumValue; | |
/**GraphObjects with this as the value of GraphObject.stretch are scaled as much as possible in the x-axis*/ | |
static Horizontal: EnumValue; | |
/**GraphObjects with this as the value of GraphObject.stretch are not automatically scaled to fit in the given bounds; there may be clipping in one or both directions.*/ | |
static None: EnumValue; | |
/**Pictures with this as the value of Picture.imageStretch are drawn with equal scale in both directions to fit the arranged (actual) bounds.*/ | |
static Uniform: EnumValue; | |
/**Pictures with this as the value of Picture.imageStretch are drawn with equal scale in both directions to fit the larger side of the image bounds.*/ | |
static UniformToFill: EnumValue; | |
/**GraphObjects with this as the value of GraphObject.stretch are scaled as much as possible in the y-axis*/ | |
static Vertical: EnumValue; | |
fromEndSegmentDirection: EnumValue; // undocumented, deprecated | |
toEndSegmentDirection: EnumValue; // undocumented, deprecated | |
spanAllocation: (obj: GraphObject, r: RowColumnDefinition, n: number) => number; // undocumented | |
protected cloneProtected(copy: GraphObject): void; // undocumented | |
findTemplateBinder(): Panel; // undocumented | |
static FlipHorizontal: EnumValue; // undocumented | |
static FlipVertical: EnumValue; // undocumented | |
static FlipBoth: EnumValue; // undocumented | |
} | |
/** | |
* This simple layout places all of the Parts in a grid-like arrangement, ordered, spaced apart, | |
* and wrapping as needed. It ignores any Links connecting the Nodes being laid out. | |
*/ | |
export class Group extends Node { | |
/** | |
* Constructs an empty Group with no visual elements and no member parts; normally a Group will have some visual elements surrounding a Placeholder. | |
* @param {EnumValue=} type if not supplied, the default Panel type is Panel.Position. | |
*/ | |
constructor(type?: EnumValue); | |
/**Gets or sets whether the size of the area of the Group's .placeholder should remain the same during a DraggingTool move until a drop occurs. The default value is false.*/ | |
computesBoundsAfterDrag: boolean; | |
/**Gets or sets whether the bounds of a Group's Placeholder includes the bounds of member Links. The default value is true.*/ | |
computesBoundsIncludingLinks: boolean; | |
/**Gets or sets whether the bounds of a Group's Placeholder includes the previous Group.location. The default value is false.*/ | |
computesBoundsIncludingLocation: boolean; | |
/**Gets or sets whether drag-and-drop events may be bubbled up to this Group if not handled by member Parts.*/ | |
handlesDragDropForMembers: boolean; | |
/**Gets or sets whether the subgraph contained by this group is expanded. The default value is true.*/ | |
isSubGraphExpanded: boolean; | |
/**Gets or sets the Layout used to position all of the immediate member nodes and links in this group.*/ | |
layout: Layout; | |
/**Gets or sets the function that is called after a member Part has been added to this Group.*/ | |
memberAdded: (a: Group, b: Part) => void; | |
/**This read-only property returns an iterator over the member Parts of this Group.*/ | |
memberParts: Iterator<Part>; | |
/**Gets or sets the function that is called after a member Part has been removed from this Group.*/ | |
memberRemoved: (a: Group, b: Part) => void; | |
/**Gets or sets the predicate that determines whether or not a Part may become a member of this group.*/ | |
memberValidation: (a: Group, b: Part) => boolean; | |
/**This read-only property returns a Placeholder that this group may contain in its visual tree.*/ | |
placeholder: Placeholder; | |
/**Gets or sets the function that is called when .isSubGraphExpanded has changed value.*/ | |
subGraphExpandedChanged: (a: Group) => void; | |
/**Gets or sets whether the user may ungroup this group.*/ | |
ungroupable: boolean; | |
/**Gets or sets whether the subgraph starting at this group had been collapsed by a call to .expandSubGraph on the containing Group.*/ | |
wasSubGraphExpanded: boolean; | |
/** | |
* Add the Parts in the given collection as members of this Group for those Parts for which CommandHandler.isValidMember returns true. | |
* @param {Iterable<Part>} coll | |
* @param {boolean=} check whether to call CommandHandler.isValidMember to confirm that it is valid to add the Part to be a member of this Group. | |
*/ | |
addMembers(coll: Iterable<Part>, check?: boolean): boolean; | |
/** | |
* See if the given collection of Parts contains non-Links all for which CommandHandler.isValidMember returns true. | |
* @param {Iterable<Part>} coll | |
*/ | |
canAddMembers(coll: Iterable<Part>): boolean; | |
/** | |
* This predicate returns true if .ungroupable is true, if the layer's Layer.allowUngroup is true, and if the diagram's Diagram.allowUngroup is true. | |
*/ | |
canUngroup(): boolean; | |
/** | |
* Hide each of the member nodes and links of this group, and recursively collapse any member groups. | |
*/ | |
collapseSubGraph(): void; | |
/** | |
* Show each member node and link, and perhaps recursively expand nested subgraphs. | |
*/ | |
expandSubGraph(): void; | |
/** | |
* Returns an iterator over all of the Links that connect with this group or any node contained by this group, | |
* in either direction, but that are not internal to this group. | |
*/ | |
findExternalLinksConnected(): Iterator<Link>; | |
/** | |
* Returns an iterator over all of the Nodes that are connected with this group or any node contained by this group, | |
* by a link in either direction, but that are not internal to this group. | |
*/ | |
findExternalNodesConnected(): Iterator<Node>; | |
/** | |
* Return a collection of Parts that are all of the nodes and links that are members of this group, including inside nested groups, but excluding this group itself. | |
*/ | |
findSubGraphParts(): Set<Part>; | |
/** | |
* Move this Group and all of its member parts, recursively. | |
* @param {Point} newpos a new Point in document coordinates. | |
*/ | |
move(newpos: Point): void; | |
} | |
/** | |
* An InputEvent represents a mouse or keyboard event. | |
* The principal properties hold information about a particular input event. | |
* These properties include the .documentPoint at which a mouse event | |
* occurred in document coordinates, | |
* the corresponding point in view/element coordinates, .viewPoint, | |
* the .key for keyboard events, | |
* and the .modifiers and .button at the time. | |
* Additional descriptive properties include .clickCount, .delta, | |
* .timestamp, and the source event .event (if available). | |
*/ | |
export class InputEvent { | |
/** | |
* The InputEvent class constructor produces an empty InputEvent. | |
*/ | |
constructor(); | |
/**Gets or sets whether the alt key is being held down.*/ | |
alt: boolean; | |
/**Gets or sets the mouse button that caused this event.*/ | |
button: number; | |
/**Gets or sets the buttons flag, descibing the set of mouse buttons current being held down.*/ | |
buttons: number; | |
/**Gets or sets whether this event represents a click or a double-click.*/ | |
clickCount: number; | |
/**Gets or sets whether the control key is being held down.*/ | |
control: boolean; | |
/**Gets or sets the amount of change associated with a mouse-wheel rotation.*/ | |
delta: number; | |
/**This read-only property returns the source diagram associated with the event.*/ | |
diagram: Diagram; | |
/**Gets or sets the point at which this input event occurred, in document coordinates.*/ | |
documentPoint: Point; | |
/**Gets or sets whether the InputEvent represents a mouse-down or a key-down event.*/ | |
down: boolean; | |
/**Gets or sets the platform's user-agent-supplied event for this event.*/ | |
event: Event; | |
/**Gets or sets whether an InputEvent that applies to a GraphObject and bubbles up the chain of containing Panels is stopped from continuing up the chain.*/ | |
handled: boolean; | |
/**This property is true when the InputEvent is caused by a touch event that registered more than one touch.*/ | |
isMultiTouch: boolean; | |
/**This read-only property is true when the InputEvent is caused by a touch event.*/ | |
isTouchEvent: boolean; | |
/**Gets or sets the key pressed or released as this event.*/ | |
key: string; | |
/**Gets or sets whether the logical left mouse button is being held down.*/ | |
left: boolean; | |
/**Gets or sets whether the meta key is being held down.*/ | |
meta: boolean; | |
/**Gets or sets whether the logical middle mouse button is being held down.*/ | |
middle: boolean; | |
/**Gets or sets the modifier keys that were used with the mouse or keyboard event.*/ | |
modifiers: number; | |
/**Gets or sets whether the logical right mouse button is being held down.*/ | |
right: boolean; | |
/**Gets or sets whether the shift key is being held down.*/ | |
shift: boolean; | |
/**Gets or sets the diagram associated with the canvas that the event is currently targeting.*/ | |
targetDiagram: Diagram; | |
/**Gets or sets the GraphObject that is at the current mouse point, if any.*/ | |
targetObject: GraphObject; | |
/**Gets or sets the time at which the event occurred, in milliseconds.*/ | |
timestamp: number; | |
/**Gets or sets whether the InputEvent represents a mouse-up or a key-up event.*/ | |
up: boolean; | |
/**Gets or sets the point at which this input event occurred.*/ | |
viewPoint: Point; | |
/** | |
* Make a copy of this InputEvent. | |
*/ | |
copy(): InputEvent; | |
bubbles: boolean; // undocumented | |
isMac: boolean; // undocumented | |
} | |
/** | |
* Layers are how named collections of Parts are drawn in front or behind other collections of Parts in a Diagram. | |
* Layers can only contain Parts -- they cannot hold GraphObjects directly. | |
*/ | |
export class Layer { | |
/** | |
* This constructs an empty Layer; you should set the .name before adding the Layer to a Diagram. | |
*/ | |
constructor(); | |
/**Gets or sets whether the user may copy objects in this layer.*/ | |
allowCopy: boolean; | |
/**Gets or sets whether the user may delete objects in this layer.*/ | |
allowDelete: boolean; | |
/**Gets or sets whether the user may group parts together in this layer.*/ | |
allowGroup: boolean; | |
/**Gets or sets whether the user may draw new links in this layer.*/ | |
allowLink: boolean; | |
/**Gets or sets whether the user may move objects in this layer.*/ | |
allowMove: boolean; | |
/**Gets or sets whether the user may reconnect existing links in this layer.*/ | |
allowRelink: boolean; | |
/**Gets or sets whether the user may reshape parts in this layer.*/ | |
allowReshape: boolean; | |
/**Gets or sets whether the user may resize parts in this layer.*/ | |
allowResize: boolean; | |
/**Gets or sets whether the user may rotate parts in this layer.*/ | |
allowRotate: boolean; | |
/**Gets or sets whether the user may select objects in this layer.*/ | |
allowSelect: boolean; | |
/**Gets or sets whether the user may do in-place text editing in this layer.*/ | |
allowTextEdit: boolean; | |
/**Gets or sets whether the user may ungroup existing groups in this layer.*/ | |
allowUngroup: boolean; | |
/**This read-only property returns the Diagram that is using this Layer.*/ | |
diagram: Diagram; | |
/**Gets or sets whether the objects in this layer are considered temporary.*/ | |
isTemporary: boolean; | |
/**Gets or sets the name for this layer.*/ | |
name: string; | |
/**Gets or sets the opacity for all parts in this layer.*/ | |
opacity: number; | |
/**This read-only property returns an iterator for this Layer's Parts.*/ | |
parts: Iterator<Part>; | |
/**This read-only property returns a backwards iterator for this Layer's Parts, for iterating over the parts in reverse order.*/ | |
partsBackwards: Iterator<Part>; | |
/**Gets or sets whether methods such as .findObjectAt find any of the objects in this layer.*/ | |
pickable: boolean; | |
/**Gets or sets whether the user may view any of the objects in this layer.*/ | |
visible: boolean; | |
/** | |
* Find the front-most GraphObject in this layer at the given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
*/ | |
findObjectAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean): GraphObject; | |
/** | |
* Return a collection of the GraphObjects of this layer at the given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
/** | |
* Returns a collection of all GraphObjects that are inside or that intersect a given Rect in document coordinates. | |
* @param {Rect} r A Rect in document coordinates. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the rectangular area (true) or | |
* if it must be entirely inside the rectangular area (false). The default value is false. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
/** | |
* Returns a collection of all GraphObjects that are within a certain distance of a given point in document coordinates. | |
* @param {Point} p A Point in document coordinates. | |
* @param {number} dist The distance from the point. | |
* @param {function(GraphObject):GraphObject | null=} navig A function taking a GraphObject and | |
* returning a GraphObject, defaulting to the identity. | |
* If this function returns null, the given GraphObject will not be included in the results. | |
* @param {function(GraphObject):boolean | null=} pred A function taking the GraphObject | |
* returned by navig and returning true if that object should be returned, | |
* defaulting to a predicate that always returns true. | |
* @param {boolean=} partialInclusion Whether an object can match if it merely intersects the circular area (true) or | |
* if it must be entirely inside the circular area (false). The default value is true. | |
* @param {List|Set=} coll An optional collection (List or Set) to add the results to. | |
*/ | |
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: List<GraphObject>): List<GraphObject>; | |
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set<GraphObject>): Set<GraphObject>; | |
} | |
/** | |
* A Link is a Part that connects Nodes. | |
* The link relationship is directional, going from Link.fromNode to Link.toNode. | |
* A link can connect to a specific port element in a node, as named by the Link.fromPortId | |
* and Link.toPortId properties. | |
*/ | |
export class Link extends Part { | |
/** | |
* Constructs an empty link that does not connect any nodes. | |
*/ | |
constructor(); | |
/**Gets or sets how the route is computed, including whether it uses the points of its old route to determine the new route.*/ | |
adjusting: EnumValue; | |
/**Gets or sets how rounded the corners are for adjacent line segments when the .curve is .None .JumpGap, or .JumpOver and the two line segments are orthogonal to each other.*/ | |
corner: number; | |
/**Gets or sets the way the path is generated from the route's points.*/ | |
curve: EnumValue; | |
/**Gets or sets how far the control points are offset when the .curve is .Bezier or when there are multiple links between the same two ports.*/ | |
curviness: number; | |
/**Gets or sets the length of the last segment.*/ | |
fromEndSegmentLength: number; | |
/**Gets or sets the Node that this link comes from.*/ | |
fromNode: Node; | |
/**This read-only property returns a GraphObject that is the "from" port that this link is connected from.*/ | |
fromPort: GraphObject; | |
/**Gets or sets the function that is called after this Link changes which Node or port it connects from.*/ | |
fromPortChanged: (a: Link, b: GraphObject, c: GraphObject) => void; | |
/**Gets or sets the identifier of the port that this link comes from.*/ | |
fromPortId: string; | |
/**Gets or sets how far the end segment stops short of the actual port.*/ | |
fromShortLength: number; | |
/**Gets or sets where this link should connect at the .fromPort.*/ | |
fromSpot: Spot; | |
/**This read-only property returns the Geometry that is used by the .path, the link Shape based on the route points.*/ | |
geometry: Geometry; | |
/**This read-only property is true when this Link has any label Nodes, Nodes that are owned by this Link and are arranged along its path.*/ | |
isLabeledLink: boolean; | |
/**This read-only property true if .routing is a value that implies that the points of the route should be orthogonal, such that each point shares a common X or a common Y value with the immediately previous and next points.*/ | |
isOrthogonal: boolean; | |
/**Gets or sets whether this Link is part of the tree for tree operations such as Node.findTreeChildrenNodes or Node.collapseTree.*/ | |
isTreeLink: boolean; | |
/**This read-only property returns an iterator over the Nodes that act as labels on this Link.*/ | |
labelNodes: Iterator<Node>; | |
/**This read-only property returns the angle of the path at the .midPoint.*/ | |
midAngle: number; | |
/**This read-only property returns the point at the middle of the path.*/ | |
midPoint: Point; | |
/**This read-only property returns the Shape representing the path of this Link.*/ | |
path: Shape; | |
/**Gets or sets the List of Points in the route. Can also be set as an Array of numbers.*/ | |
points: List<Point>; | |
/**This read-only property returns the number of points in the route.*/ | |
pointsCount: number; | |
/**Gets or sets whether the user may reconnect an existing link at the "from" end.*/ | |
relinkableFrom: boolean; | |
/**Gets or sets whether the user may reconnect an existing link at the "to" end.*/ | |
relinkableTo: boolean; | |
/**Gets or sets whether the user may change the number of segments in this Link, if the link has straight segments.*/ | |
resegmentable: boolean; | |
/**Gets or sets whether the link's path tries to avoid other nodes.*/ | |
routing: EnumValue; | |
/**Gets or sets how far the control points are from the points of the route when .routing is .Orthogonal and .curve is .Bezier.*/ | |
smoothness: number; | |
/**Gets or sets the length of the last segment.*/ | |
toEndSegmentLength: number; | |
/**Gets or sets the Node that this link goes to.*/ | |
toNode: Node; | |
/**This read-only property returns a GraphObject that is the "to" port that this link is connected to.*/ | |
toPort: GraphObject; | |
/**Gets or sets the function that is called after this Link changes which Node or port it connects to.*/ | |
toPortChanged: (a: Link, b: GraphObject, c: GraphObject) => void; | |
/**Gets or sets the identifier of the port that this link goes to.*/ | |
toPortId: string; | |
/**Gets or sets how far the end segment stops short of the actual port.*/ | |
toShortLength: number; | |
/**Gets or sets where this link should connect at the .toPort.*/ | |
toSpot: Spot; | |
/** | |
* This predicate returns true if .relinkableFrom is true, if the layer's Layer.allowRelink is true, and if the diagram's Diagram.allowRelink is true. | |
*/ | |
canRelinkFrom(): boolean; | |
/** | |
* This predicate returns true if .relinkableTo is true, if the layer's Layer.allowRelink is true, and if the diagram's Diagram.allowRelink is true. | |
*/ | |
canRelinkTo(): boolean; | |
/** | |
* Remove all of the points from this link's route; this may only be called within an override of computePoints. | |
*/ | |
protected clearPoints(): void; | |
/** | |
* Add a point at the end of the route; this may only be called within an override of computePoints. | |
* @param {Point} p The new point, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. | |
*/ | |
protected addPoint(p: Point): void; | |
/** | |
* Insert a point at a particular position in the route, without replacing an existing point; this may only be called within an override of computePoints. | |
* @param {number} i int The zero-based index of the new point. | |
* @param {Point} p The new point, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. | |
*/ | |
protected insertPoint(i: number, p: Point): void; | |
/** | |
* Remove a particular point from the route; this may only be called within an override of computePoints. | |
* @param {number} i int The zero-based index of the point to extract. | |
*/ | |
protected removePoint(i: number): void; | |
/** | |
* Sets a particular point of the route; this may only be called within an override of computePoints. | |
* @param {number} i int The zero-based index of the desired point. | |
* @param {Point} p The new point, which should not have infinite or NaN coordinate values, and which must not be modified afterwards. | |
*/ | |
protected setPoint(i: number, p: Point): void; | |
/** | |
* Returns the curve}, unless this link is supposed to pretend to be curved, as with reflexive links. | |
*/ | |
protected computeCurve(): EnumValue; | |
/** | |
* Returns the curviness, if it's a number, | |
* or else a computed value based on how many links connect this pair of nodes/ports. | |
*/ | |
protected computeCurviness(): number; | |
/** | |
* Get the length of the end segment, typically a short distance, in document units. | |
* For spot values that are Spot.isSide, this returns a computed value. | |
* Depending on the <code>from</code> argument, this will return fromEndSegmentLength or toEndSegmentLength. | |
* If the value is <code>NaN</code>, this will return the fromPort's GraphObject.fromEndSegmentLength | |
* or the toPort's GraphObject.toEndSegmentLength. | |
*/ | |
protected computeEndSegmentLength(node: Node, port: GraphObject, spot: Spot, from: boolean): number; | |
/** | |
* Find the approximate point of the other end of the link. | |
* This is useful when computing the connection point when there is no specific spot, to have an idea of which general direction the link should be going. | |
* By default this will return the center of the other port. | |
*/ | |
protected computeOtherPoint(othernode: Node, otherport: GraphObject): Point; | |
/** | |
* The code that constructs a new route by modifying the points. | |
* It is only called by updateRoute, when needed. | |
*/ | |
protected computePoints(): boolean; | |
/** | |
* Returns the expected spacing between this link and others that connect this link's fromPort and toPort. | |
* This calls computeThickness and also takes any "mid label"'s breadth into account. | |
*/ | |
protected computeSpacing(): number; | |
/** | |
* Get the Spot that describes how the end of the link should connect with the port. | |
* Depending on the <code>from</code> argument, this will return fromSpot or toSpot. | |
* If the value is Spot.isDefault, this will return the fromPort's GraphObject.fromSpot | |
* or the toPort's GraphObject.toSpot. | |
*/ | |
protected computeSpot(from: boolean, port?: GraphObject): Spot; | |
/** | |
* Returns the thickness of this link. | |
* By default it uses the strokeWidth of the main element, assuming it's a Shape. | |
*/ | |
protected computeThickness(): number; | |
/** | |
* Find the index of the segment that is closest to a given point. | |
* @param {Point} p the Point, in document coordinates. | |
*/ | |
findClosestSegment(p: Point): number; | |
/** | |
* Compute the direction in which a link should go from a given connection point. | |
* @param {Node} node | |
* @param {GraphObject} port the GraphObject representing a port on the node. | |
* @param {Point} linkpoint the connection point, in document coordinates. | |
* @param {Spot} spot a Spot value describing where the link should connect. | |
* @param {boolean} from true if the link is coming out of the port; false if going to the port. | |
* @param {boolean} ortho whether the link should have orthogonal segments. | |
* @param {Node} othernode the node at the other end of the link. | |
* @param {GraphObject} otherport the GraphObject port at the other end of the link. | |
*/ | |
getLinkDirection(node: Node, port: GraphObject, linkpoint: Point, spot: Spot, from: boolean, ortho: boolean, othernode: Node, otherport: GraphObject): number; | |
/** | |
* Compute the point on a node/port at which the route of a link should end. | |
* @param {Node} node | |
* @param {GraphObject} port the GraphObject representing a port on the node. | |
* @param {Spot} spot a Spot value describing where the link should connect. | |
* @param {boolean} from true if the link is coming out of the port; false if going to the port. | |
* @param {boolean} ortho whether the link should have orthogonal segments. | |
* @param {Node} othernode the node at the other end of the link. | |
* @param {GraphObject} otherport the GraphObject port at the other end of the link. | |
* @param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point | |
*/ | |
getLinkPoint(node: Node, port: GraphObject, spot: Spot, from: boolean, ortho: boolean, othernode: Node, otherport: GraphObject, result?: Point): Point; | |
/** | |
* Compute the intersection point for the edge of a particular port GraphObject, given a point, when no particular spot or side has been specified. | |
* @param {Node} node | |
* @param {GraphObject} port the GraphObject representing a port on the node. | |
* @param {Point} focus the point in document coordinates to/from which the link should point, | |
* normally the center of the port. | |
* @param {Point} p often this point is far away from the node, to give a general direction, | |
* particularly an orthogonal one. | |
* @param {boolean} from true if the link is coming out of the port; false if going to the port. | |
* @param {Point=} result an optional Point that is modified and returned; otherwise it allocates and returns a new Point | |
*/ | |
getLinkPointFromPoint(node: Node, port: GraphObject, focus: Point, p: Point, from: boolean, result?: Point): Point; | |
/** | |
* Given a Node, return the node at the other end of this link. | |
* @param {Node} node | |
*/ | |
getOtherNode(node: Node): Node; | |
/** | |
* Given a GraphObject that is a "port", return the port at the other end of this link. | |
* @param {GraphObject} port | |
*/ | |
getOtherPort(port: GraphObject): GraphObject; | |
/** | |
* Gets a particular point of the route. | |
* @param {number} i The zero-based index of the desired point. | |
*/ | |
getPoint(i: number): Point; | |
/** | |
* Returns true if an extra or a different point is needed based on curviness. | |
*/ | |
protected hasCurviness(): boolean; | |
/** | |
* Declare that the route (the points) of this Link need to be recomputed soon. | |
* This causes updateRoute to be called, which will call computePoints | |
* to perform the actual determination of the route. | |
*/ | |
invalidateRoute(): void; | |
/** | |
* Produce a Geometry given the points of this route, | |
* depending on the value of curve and corner and perhaps other properties. | |
*/ | |
protected makeGeometry(): Geometry; | |
/** | |
* Move this link to a new position. | |
* @param {Point} newpos | |
*/ | |
move(newpos: Point): void; | |
/** | |
* This method recomputes the route if the route is invalid, to make sure the points are up-to-date. | |
* This method calls computePoints in order to calculate a new route. | |
*/ | |
updateRoute(): void; | |
/**Used as a value for Link.routing: each segment is horizontal or vertical, but the route tries to avoid crossing over nodes.*/ | |
static AvoidsNodes: EnumValue; | |
/**Used as a value for Link.curve, to indicate that the link path uses Bezier curve segments.*/ | |
static Bezier: EnumValue; | |
/**Used as a value for Link.adjusting, to indicate that the link route computation should keep the intermediate points of the previous route, just modifying the first and/or last points; if the routing is orthogonal, it will only modify the first two and/or last two points.*/ | |
static End: EnumValue; | |
/**Used as a value for Link.curve, to indicate that orthogonal link segments will be discontinuous where they cross over other orthogonal link segments that have a Link.curve or JumpOver or JumpGap.*/ | |
static JumpGap: EnumValue; | |
/**Used as a value for Link.curve, to indicate that orthogonal link segments will veer around where they cross over other orthogonal link segments that have a Link.curve or JumpOver or JumpGap.*/ | |
static JumpOver: EnumValue; | |
/**This is the default value for Link.curve and Link.adjusting, to indicate that the path geometry consists of straight line segments and to indicate that the link route computation does not depend on any previous route points; this can also be used as a value for GraphObject.segmentOrientation to indicate that the object is never rotated along the link route -- its angle is unchanged.*/ | |
static None: EnumValue; | |
/**Used as the default value for Link.routing: the route goes fairly straight between ports.*/ | |
static Normal: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject turned to have the same angle as the route: the GraphObject's angle is always the same as the angle of the link's route at the segment where the GraphObject is attached; use this orientation for arrow heads.*/ | |
static OrientAlong: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject being turned counter-clockwise to be perpendicular to the route: the GraphObject's angle is always 90 degrees less than the angle of the link's route at the segment where the GraphObject is attached.*/ | |
static OrientMinus90: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject turned counter-clockwise to be perpendicular to the route, just like Link.OrientMinus90, but is never upside down: the GraphObject's angle always being 90 degrees less than the angle of the link's route at the segment where the GraphObject is attached; this is typically only used for TextBlocks or Panels that contain text.*/ | |
static OrientMinus90Upright: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject's angle always being 180 degrees opposite from the angle of the link's route at the segment where the GraphObject is attached.*/ | |
static OrientOpposite: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject is turned clockwise to be perpendicular to the route: the GraphObject's angle is always 90 degrees more than the angle of the link's route at the segment where the GraphObject is attached.*/ | |
static OrientPlus90: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject turned clockwise to be perpendicular to the route, just like Link.OrientPlus90, but is never upside down: the GraphObject's angle always being 90 degrees more than the angle of the link's route at the segment where the GraphObject is attached; this is typically only used for TextBlocks or Panels that contain text.*/ | |
static OrientPlus90Upright: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject turned to have the same angle as the route, just like Link.OrientAlong, but is never upside down: the GraphObject's angle always following the angle of the link's route at the segment where the GraphObject is attached; this is typically only used for TextBlocks or Panels that contain text.*/ | |
static OrientUpright: EnumValue; | |
/**This value for GraphObject.segmentOrientation results in the GraphObject's angle always following the angle of the link's route at the segment where the GraphObject is attached, but never upside down and never angled more than +/- 45 degrees: when the route's angle is within 45 degrees of vertical (90 or 270 degrees), the GraphObject's angle is set to zero; this is typically only used for TextBlocks or Panels that contain text.*/ | |
static OrientUpright45: EnumValue; | |
/**Used as a value for Link.routing: each segment is horizontal or vertical.*/ | |
static Orthogonal: EnumValue; | |
/**Used as a value for Link.adjusting, to indicate that the link route computation should scale and rotate the intermediate points so that the link's shape looks approximately the same; if the routing is orthogonal, this value is treated as if it were Link.End.*/ | |
static Scale: EnumValue; | |
/**Used as a value for Link.adjusting, to indicate that the link route computation should linearly interpolate the intermediate points so that the link's shape looks stretched; if the routing is orthogonal, this value is treated as if it were Link.End.*/ | |
static Stretch: EnumValue; | |
fromEndSegmentDirection: EnumValue; // undocumented, deprecated | |
toEndSegmentDirection: EnumValue; // undocumented, deprecated | |
routeBounds: Rect; // undocumented | |
firstPickIndex: number; // undocumented | |
lastPickIndex: number; // undocumented | |
protected computeCorner(): number; // undocumented | |
protected computeShortLength(from: boolean): number; // undocumented | |
protected computeMidOrthoPosition(fromPosition: number, toPosition: number, vertical: boolean): number; // undocumented | |
findMidLabel(): GraphObject; // undocumented | |
protected arrangeBundledLinks(links: Array<Link>, reroute: boolean): void; // undocumented | |
protected setPointAt(i: number, x: number, y: number): void; // undocumented | |
protected insertPointAt(i: number, x: number, y: number): void; // undocumented | |
protected addPointAt(x: number, y: number): void; // undocumented | |
} | |
/** | |
* A Node is a Part that may connect to other nodes with Links, | |
* or that may be a member of a Group. | |
* Group inherits from Node, | |
* enabling nodes to logically contain other nodes and links. | |
*/ | |
export class Node extends Part { | |
/** | |
* Constructs an empty Node. | |
* @param {EnumValue=} type if not supplied, the default Panel type is Panel.Position. | |
*/ | |
constructor(type?: EnumValue); | |
/**Gets or sets whether this Node is to be avoided by Links whose Link.routing is Link.AvoidsNodes.*/ | |
avoidable: boolean; | |
/**Gets or sets the Margin (or number for a uniform Margin) around this Node in which avoidable links will not be routed.*/ | |
avoidableMargin: MarginLike; | |
/**This read-only property is true when this Node is a label node for a Link.*/ | |
isLinkLabel: boolean; | |
/**Gets or sets whether the subtree graph starting at this node is expanded.*/ | |
isTreeExpanded: boolean; | |
/**Gets whether this node has no tree children.*/ | |
isTreeLeaf: boolean; | |
/**Gets or sets the Link for which this Node is acting as a smart label.*/ | |
labeledLink: Link; | |
/**Gets or sets the function that is called after a Link has been connected with this Node.*/ | |
linkConnected: (a: Node, b: Link, c: GraphObject) => void; | |
/**Gets or sets the function that is called after a Link has been disconnected from this Node.*/ | |
linkDisconnected: (a: Node, b: Link, c: GraphObject) => void; | |
/**Gets or sets a predicate that determines whether or not a Link may be connected with this node; any of the arguments may be null.*/ | |
linkValidation: (from: Node, fromPort: GraphObject, to: Node, toPort: GraphObject, link: Link) => boolean; | |
/**This read-only property returns an iterator over all of the Links that are connected with this node.*/ | |
linksConnected: Iterator<Link>; | |
/**This read-only property returns the primary GraphObject representing a port in this node.*/ | |
port: GraphObject; | |
/**This read-only property returns an iterator over all of the GraphObjects in this node that act as ports.*/ | |
ports: Iterator<GraphObject>; | |
/**Gets or sets how link points are computed when the port spot is a "side" spot.*/ | |
portSpreading: EnumValue; | |
/**Gets or sets the function that is called when .isTreeExpanded has changed value.*/ | |
treeExpandedChanged: (node: Node) => void; | |
/**Gets or sets whether the subtree graph starting at this node had been collapsed by a call to .expandTree on the parent node.*/ | |
wasTreeExpanded: boolean; | |
/** | |
* Hide each child node and the connecting link, and recursively collapse each child node. | |
* @param {number=} level How many levels of the tree, starting at this node, to keep expanded if already expanded; | |
* the default is 1, hiding all tree children of this node. Values less than 1 are treated as 1. | |
*/ | |
collapseTree(level?: number): void; | |
/** | |
* Show each child node and the connecting link, and perhaps recursively expand their child nodes. | |
* @param {number=} level How many levels of the tree should be expanded; | |
* the default is 2, showing all tree children of this node and potentially more. | |
* Values less than 2 are treated as 2. | |
*/ | |
expandTree(level?: number): void; | |
/** | |
* Returns an iterator over all of the Links that go from this node to another node or vice-versa, perhaps limited to a given port id on this node and a port id on the other node. | |
* @param {Node} othernode | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
* @param {string|null=} otherpid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findLinksBetween(othernode: Node, pid?: string, otherpid?: string): Iterator<Link>; | |
/** | |
* Returns an iterator over all of the Links that connect with this node in either direction, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findLinksConnected(pid?: string): Iterator<Link>; | |
/** | |
* Returns an iterator over all of the Links that go into this node, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findLinksInto(pid?: string): Iterator<Link>; | |
/** | |
* Returns an iterator over all of the Links that come out of this node, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findLinksOutOf(pid?: string): Iterator<Link>; | |
/** | |
* Returns an iterator over all of the Links that go from this node to another node, perhaps limited to a given port id on this node and a port id on the other node. | |
* @param {Node} othernode | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
* @param {string|null=} otherpid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findLinksTo(othernode: Node, pid?: string, otherpid?: string): Iterator<Link>; | |
/** | |
* Returns an iterator over the Nodes that are connected with this node in either direction, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findNodesConnected(pid?: string): Iterator<Node>; | |
/** | |
* Returns an iterator over the Nodes that are connected with this node by links going into this node, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findNodesInto(pid?: string): Iterator<Node>; | |
/** | |
* Returns an iterator over the Nodes that are connected with this node by links coming out of this node, perhaps limited to the given port id on this node. | |
* @param {string|null=} pid A port identifier string; if null the link's portId is ignored and all links are included in the search. | |
*/ | |
findNodesOutOf(pid?: string): Iterator<Node>; | |
/** | |
* Find a GraphObject with a given GraphObject.portId. | |
* @param {string} pid | |
*/ | |
findPort(pid: string): GraphObject; | |
/** | |
* Returns an Iterator for the collection of Links that connect with the immediate tree children of this node. | |
*/ | |
findTreeChildrenLinks(): Iterator<Link>; | |
/** | |
* Returns an Iterator for the collection of Nodes that are the immediate tree children of this node. | |
*/ | |
findTreeChildrenNodes(): Iterator<Node>; | |
/** | |
* Return how deep this node is in a tree structure. | |
* For tree root nodes, this returns zero. | |
*/ | |
findTreeLevel(): number; | |
/** | |
* Return a collection of Parts including this Node, its tree parent link and node, and so on up the chain to the root node. | |
*/ | |
findTreeParentChain(): Set<Part>; | |
/** | |
* Returns the Link that connects with the tree parent Node of this node if the graph is tree-structured, if there is such a link and Link.isTreeLink is true. | |
*/ | |
findTreeParentLink(): Link; | |
/** | |
* Returns the Node that is the tree parent of this node if the graph is tree-structured, if there is a parent. | |
*/ | |
findTreeParentNode(): Node; | |
/** | |
* Return a collection of Parts including this Node, all of the Links going to child Nodes, and all of their tree child nodes and links. | |
* @param {number=} level How many levels of the tree, starting at this node, to include; | |
* the default is Infinity, including all tree children of this node. Values less than 1 are treated as 1. | |
*/ | |
findTreeParts(level?: number): Set<Part>; | |
/** | |
* Return the Node that is at the root of the tree that this node is in, perhaps this node itself. | |
*/ | |
findTreeRoot(): Node; | |
/** | |
* This predicate is true if this node is a child of the given Node, perhaps indirectly as a descendant. | |
* @param {Node} node the Node that might be a parent or ancestor of this node. | |
*/ | |
isInTreeOf(node: Node): boolean; | |
/**This value for Node.portSpreading indicates that links connecting with a port should be distributed evenly along the side(s) indicated by a Spot that is a "side" Spot.*/ | |
static SpreadingEvenly: EnumValue; | |
/**This value for Node.portSpreading indicates that links connecting with a port should connect at a single point on the side(s) indicated by a Spot that is a "side" Spot.*/ | |
static SpreadingNone: EnumValue; | |
/**This value for Node.portSpreading indicates that links connecting with a port should be packed together based on the link's shape's width on the side(s) indicated by a Spot that is a "side" Spot.*/ | |
static SpreadingPacked: EnumValue; | |
static DirectionAbsolute: EnumValue; // undocumented, deprecated | |
static DirectionDefault: EnumValue; // undocumented, deprecated | |
static DirectionRotatedNode: EnumValue; // undocumented, deprecated | |
static DirectionRotatedNodeOrthogonal: EnumValue; // undocumented, deprecated | |
findVisibleNode(): Node; // undocumented | |
getAvoidableRect(result: Rect): Rect; // undocumented | |
invalidateLinkBundle(other: Node, thisportid?: string, otherportid?: string): void; // undocumented | |
invalidateConnectedLinks(): void; // undocumented | |
} | |
/** | |
* An Overview is a Diagram that displays all of a different diagram, | |
* with a rectangular box showing the viewport displayed by that other diagram. | |
* All you need to do is set Overview.observed. | |
*/ | |
export class Overview extends Diagram { | |
/** | |
* @param {HTMLDivElement} div A reference to a DIV element in the DOM. | |
*/ | |
constructor(div: HTMLDivElement); | |
/** | |
* @param {string} id A reference to a DIV by its ID as a string. | |
*/ | |
constructor(id?: string); | |
/**Gets or sets the rectangular Part that represents the viewport of the .observed Diagram.*/ | |
box: Part; | |
/**Gets or sets whether this overview draws the temporary layers of the observed Diagram.*/ | |
drawsTemporaryLayers: boolean; | |
/**Gets or sets the Diagram for which this Overview is displaying a model and showing its viewport into that model.*/ | |
observed: Diagram; | |
} | |
/** | |
* Palette extends the Diagram class to allow objects to be dragged and placed onto other Diagrams. | |
* Its Diagram.layout is a GridLayout. | |
* The Palette is Diagram.isReadOnly but to support drag-and-drop its Diagram.allowDragOut is true. | |
*/ | |
export class Palette extends Diagram { | |
/** | |
* @param {HTMLDivElement} div A reference to a DIV in the DOM. | |
*/ | |
constructor(div: HTMLDivElement); | |
/** | |
* @param {string} id A reference to a DIV by its ID as a string. | |
*/ | |
constructor(id?: string); | |
} | |
/** | |
* A Panel is a GraphObject that holds other GraphObjects as its elements. | |
* A Panel is responsible for sizing and positioning its elements. | |
* Every Panel has a .type and establishes its own coordinate system. The .type of a Panel | |
* determines how it will size and arrange its elements. | |
*/ | |
export class Panel extends GraphObject { | |
/** | |
* Constructs an empty Panel of the given .type. | |
* @param {EnumValue=} type If not supplied, the default Panel type is Panel.Position. | |
*/ | |
constructor(type?: EnumValue); | |
/** For Panels which are elements of Spot Panels, this gets or sets the name of this Panel's element that should be used as the alignment object instead of this Panel. */ | |
alignmentFocusName: string; | |
/**This read-only property returns the number of columns in this Panel if it is of .type Panel.Table.*/ | |
columnCount: number; | |
/**Gets or sets how this Panel's columns deal with extra space if the Panel is of .type Panel.Table.*/ | |
columnSizing: EnumValue; | |
/**Gets or sets the optional model data to which this panel is data-bound.*/ | |
data: any; | |
/**Gets or sets the default alignment spot of this Panel, used as the alignment for an element when its GraphObject.alignment value is Spot.Default.*/ | |
defaultAlignment: Spot; | |
/**Gets or sets the default dash array for a particular column's separator.*/ | |
defaultColumnSeparatorDashArray: Array<number>; | |
/**Gets or sets the default Brush stroke (or CSS color string) for columns in a Table Panel provided a given column has a nonzero RowColumnDefinition.separatorStrokeWidth.*/ | |
defaultColumnSeparatorStroke: BrushLike; | |
/**Gets or sets the default stroke width for a particular column's separator.*/ | |
defaultColumnSeparatorStrokeWidth: number; | |
/**Gets or sets the default dash array for a particular row's separator.*/ | |
defaultRowSeparatorDashArray: Array<number>; | |
/**Gets or sets the default Brush stroke (or CSS color string) for rows in a Table Panel provided a given row has a nonzero RowColumnDefinition.separatorStrokeWidth.*/ | |
defaultRowSeparatorStroke: BrushLike; | |
/**Gets or sets the default stroke width for a particular row's separator.*/ | |
defaultRowSeparatorStrokeWidth: number; | |
/**Gets or sets the additional padding for a particular row or column, a Margin (or number for a uniform Margin).*/ | |
defaultSeparatorPadding: MarginLike; | |
/**Gets or sets the default stretch of this Panel, used as the stretch for an element when its GraphObject.stretch value is GraphObject.Default.*/ | |
defaultStretch: EnumValue; | |
/**This read-only property returns an iterator over the collection of the GraphObjects that this panel manages.*/ | |
elements: Iterator<GraphObject>; | |
/**Gets or sets the maximum value represented on a .Graduated panel.*/ | |
graduatedMax: number; | |
/**Gets or sets the minimum value represented on a .Graduated panel.*/ | |
graduatedMin: number; | |
/**This read-only property returns the range of values represented by a .Graduated panel.*/ | |
graduatedRange: number; | |
/**Gets or sets the base value which is marked with a tick.*/ | |
graduatedTickBase: number; | |
/**Gets or sets the difference between two consecutive values marked by ticks.*/ | |
graduatedTickUnit: number; | |
/**Gets or sets the distance between lines in a .Grid panel.*/ | |
gridCellSize: Size; | |
/**Gets or sets an origin point for the grid cells in a .Grid panel.*/ | |
gridOrigin: Point; | |
/**Gets or sets whether this Panel's main element clips instead of fills. The main element will not paint its stroke, if it has any. Only works with Spot panels, and assumes that the main element is a Shape.*/ | |
isClipping: boolean; | |
/**Gets or sets whether this Panel actually responds to user click events, for Panels that are GraphObject#isActionable.*/ | |
isEnabled: boolean; | |
/** For Horizontal and Vertical panels, gets or sets whether this Panel arranges its contents from the typical side (left and top, respectively), or the opposite side (right and bottom, respectively).*/ | |
isOpposite: boolean; | |
/**Gets or sets a JavaScript Array of values or objects, each of which will be represented by a Panel as elements in this Panel.*/ | |
itemArray: Array<any>; | |
/**Gets or sets the name of the item data property that returns a string describing that data's category, or a function that takes an item data object and returns that string; the default value is the name 'category'.*/ | |
itemCategoryProperty: PropertyAccessor; | |
/**This read-only property returns the index of the item in the containing Panel's Panel.itemArray that this Panel represents.*/ | |
itemIndex: number; | |
/**Gets or sets the default Panel template used as the archetype for item data that are in .itemArray.*/ | |
itemTemplate: Panel; | |
/**Gets or sets a Map mapping template names to Panels.*/ | |
itemTemplateMap: Map<string,Panel>; | |
/**Gets or sets the first column that this Panel of .type Panel.Table displays.*/ | |
leftIndex: number; | |
/**Gets or sets the space between this Panel's border and its content, as a Margin (or number for a uniform Margin), depending on the type of panel.*/ | |
padding: MarginLike; | |
/**This read-only property returns the number of row in this Panel if it is of .type Panel.Table.*/ | |
rowCount: number; | |
/**Gets or sets how this Panel's rows deal with extra space if the Panel is of .type Panel.Table.*/ | |
rowSizing: EnumValue; | |
/**Gets or sets the first row that this this Panel of .type Panel.Table displays.*/ | |
topIndex: number; | |
/**Gets or sets the type of the Panel.*/ | |
type: EnumValue; | |
/**Gets or sets how a .Viewbox panel will resize its content.*/ | |
viewboxStretch: EnumValue; | |
/** | |
* Adds a GraphObject to the end of this Panel's list of elements, visually in front of all of the other elements. | |
* @param {GraphObject} element A GraphObject. | |
*/ | |
add(element: GraphObject): void; | |
/** | |
* Creates a deep copy of this Panel and returns it. | |
*/ | |
copy(): Panel; | |
/** | |
* Returns the GraphObject in this Panel's list of elements at the specified index. | |
* @param {number} idx a zero-based index | |
*/ | |
elt(idx: number): GraphObject; | |
/** | |
* Returns the cell at a given x-coordinate in local coordinates. | |
* @param {number} x | |
*/ | |
findColumnForLocalX(x: number): number; | |
/** | |
* Returns the first immediate child element with GraphObject.isPanelMain set to true, | |
* or if there is no such child element, just the first element. | |
*/ | |
findMainElement(): GraphObject; | |
/** | |
* Search the visual tree starting at this Panel for a GraphObject whose GraphObject.name is the given name. | |
* @param {string} name The name to search for, using a case-sensitive string comparison. | |
*/ | |
findObject(name: string): GraphObject; | |
/** | |
* Return the Panel that was made for a particular data object in this panel's itemArray. | |
* If this returns a Panel, its data property will be the argument data object. | |
*/ | |
findItemPanelForData(data: Object): Panel; | |
/** | |
* Returns the row at a given y-coordinate in local coordinates. | |
* @param {number} y | |
*/ | |
findRowForLocalY(y: number): number; | |
/** | |
* Gets the RowColumnDefinition for a particular column in this Table Panel. | |
* @param {number} idx the non-negative zero-based integer column index. | |
*/ | |
getColumnDefinition(idx: number): RowColumnDefinition; | |
/** | |
* Gets the RowColumnDefinition for a particular row in this Table Panel. | |
* @param {number} idx the non-negative zero-based integer row index. | |
*/ | |
getRowDefinition(idx: number): RowColumnDefinition; | |
/** | |
* Returns the point that corresponds with a value along this Graduated Panel. | |
* The Point will be in the panel's coordinates. | |
* @param {number} val a value between .graduatedMin and .graduatedMax. | |
* @param {Point=} result an optional Point that is modified and returned | |
*/ | |
graduatedPointForValue(val: number, result?: Point): Point; | |
/** | |
* Returns the value that corresponds with a Point near this Graduated Panel. | |
* @param {number} pt a Point in the Graduated Panel's coordinates | |
*/ | |
graduatedValueForPoint(pt: Point): number; | |
/** | |
* Adds a GraphObject to the Panel's list of elements at the specified index. | |
* @param {number} index | |
* @param {GraphObject} element A GraphObject. | |
*/ | |
insertAt(index: number, element: GraphObject): void; | |
/** | |
* Create and add new GraphObjects corresponding to and bound to the data in the .itemArray, after removing all existing elements from this Panel. | |
*/ | |
rebuildItemElements(): void; | |
/** | |
* Removes a GraphObject from this Panel's list of elements. | |
* @param {GraphObject} element A GraphObject. | |
*/ | |
remove(element: GraphObject): void; | |
/** | |
* Removes an GraphObject from this Panel's list of elements at the specified index. | |
* @param {number} idx | |
*/ | |
removeAt(idx: number): void; | |
/** | |
* Removes the RowColumnDefinition for a particular row in this Table Panel. | |
* @param {number} idx the non-negative zero-based integer row index. | |
*/ | |
removeColumnDefinition(idx: number): void; | |
/** | |
* Removes the RowColumnDefinition for a particular row in this Table Panel. | |
* @param {number} idx the non-negative zero-based integer row index. | |
*/ | |
removeRowDefinition(idx: number): void; | |
/** | |
* Re-evaluate all data bindings on this panel, in order to assign new property values to the GraphObjects in this visual tree based on this this object's .data property values. | |
* @param {string=} srcprop An optional source data property name: | |
* when provided, only evaluates those Bindings that use that particular property; | |
* when not provided or when it is the empty string, all bindings are evaluated. | |
*/ | |
updateTargetBindings(srcprop?: string): void; | |
/**This value for .type resizes the main element to fit around the other elements; the main element is the first GraphObject with GraphObject.isPanelMain set to true, or else the first GraphObject if none have that property set to true.*/ | |
static Auto: EnumValue; | |
/**This value for .type is used to draw regular tick marks along some shape.*/ | |
static Graduated: EnumValue; | |
/**This value for .type is used to draw regular patterns of lines.*/ | |
static Grid: EnumValue; | |
/**This value for .type lays out the elements horizontally with their GraphObject.alignment property dictating their alignment on the Y-axis.*/ | |
static Horizontal: EnumValue; | |
/**This value for .type is used for Links and adornments that act as Links.*/ | |
static Link: EnumValue; | |
/**The default .type arranges each element according to their GraphObject.position.*/ | |
static Position: EnumValue; | |
/**This value for .type arranges GraphObjects about a main element using the GraphObject.alignment and GraphObject.alignmentFocus properties; the main element is the first GraphObject with GraphObject.isPanelMain set to true, or else the first GraphObject if none have that property set to true.*/ | |
static Spot: EnumValue; | |
/**This value for .type arranges GraphObjects into rows and columns; set the GraphObject.row and GraphObject.column properties on each element.*/ | |
static Table: EnumValue; | |
/**Organizational Panel type that is only valid inside of a Table panel.*/ | |
static TableColumn: EnumValue; | |
/**Organizational Panel type that is only valid inside of a Table panel.*/ | |
static TableRow: EnumValue; | |
/**This value for .type lays out the elements vertically with their GraphObject.alignment property dictating their alignment on the X-axis.*/ | |
static Vertical: EnumValue; | |
/**This value for .type rescales a single GraphObject to fit inside the panel depending on the element's GraphObject.stretch property.*/ | |
static Viewbox: EnumValue; | |
} | |
/** | |
* This is the base class for all user-manipulated top-level objects. | |
* Because it inherits from Panel, it is automatically a visual container | |
* of other GraphObjects. | |
* Because it thus also inherits from GraphObject, it also has properties such as | |
* GraphObject.actualBounds, GraphObject.contextMenu, and GraphObject.visible. | |
*/ | |
export class Part extends Panel { | |
/** | |
* The constructor builds an empty Part. | |
* @param {EnumValue=} type if not supplied, the default Panel type is Panel.Position. | |
*/ | |
constructor(type?: EnumValue); | |
/**This read-only property returns an iterator over all of the Adornments associated with this part.*/ | |
adornments: Iterator<Adornment>; | |
/**Gets or sets the category of this part, typically used to distinguish different kinds of nodes or links.*/ | |
category: string; | |
/**Gets or sets the Group of which this Part or Node is a member.*/ | |
containingGroup: Group; | |
/**Gets or sets the function that is called after this Part has changed which Group it belongs to, if any.*/ | |
containingGroupChanged: (member: Part, oldgrp: Group, newgrp: Group) => void; | |
/**Gets or sets whether the user may copy this part.*/ | |
copyable: boolean; | |
/**Gets or sets whether the user may delete this part.*/ | |
deletable: boolean; | |
/**This read-only property returns the Diagram that this Part is in.*/ | |
diagram: Diagram; | |
/**Gets or sets the function used to determine the location that this Part can be dragged to.*/ | |
dragComputation: (part: Part, oldloc: Point, newloc: Point) => Point; | |
/**Gets or sets whether the user may group this part to be a member of a new Group.*/ | |
groupable: boolean; | |
/**Gets or sets the function to execute when this part is highlighted or de-highlighted.*/ | |
highlightedChanged: (p: Part) => void; | |
/**Gets or sets whether this Part may be animated.*/ | |
isAnimated: boolean; | |
/**Gets or sets whether this Part is highlighted.*/ | |
isHighlighted: boolean; | |
/**Gets or sets whether this Part is part of the document bounds.*/ | |
isInDocumentBounds: boolean; | |
/**Gets or sets whether a Layout positions this Node or routes this Link.*/ | |
isLayoutPositioned: boolean; | |
/**Gets or sets whether this Part is selected.*/ | |
isSelected: boolean; | |
/**Gets or sets whether this part will draw shadows.*/ | |
isShadowed: boolean; | |
/**Gets whether this part is not member of any Group node nor is it a label node for a Link.*/ | |
isTopLevel: boolean; | |
/**This read-only property returns the Layer that this Part is in.*/ | |
layer: Layer; | |
/**Gets or sets the function to execute when this part changes layers.*/ | |
layerChanged: (part: Part, oldlayer: Layer, newlayer: Layer) => void; | |
/**Gets or sets the layer name for this part.*/ | |
layerName: string; | |
/**Gets or sets "Layout..." flags that control when the Layout that is responsible for this Part is invalidated.*/ | |
layoutConditions: number; | |
/**Gets or sets the position of this part in document coordinates, based on the .locationSpot in this part's .locationObject.*/ | |
location: Point; | |
/**This read-only property returns the GraphObject that determines the location of this Part.*/ | |
locationObject: GraphObject; | |
/**Gets or sets the name of the GraphObject that provides the location of this Part.*/ | |
locationObjectName: string; | |
/**Gets or sets the location Spot of this Node, the spot on the .locationObject that is used in positioning this part in the diagram.*/ | |
locationSpot: Spot; | |
/**Gets or sets the maximum location of this Part to which the user may drag using the DraggingTool.*/ | |
maxLocation: Point; | |
/**Gets or sets the minimum location of this Part to which the user may drag using the DraggingTool.*/ | |
minLocation: Point; | |
/**Gets or sets whether the user may move this part.*/ | |
movable: boolean; | |
/**Gets or sets whether the user may reshape this part.*/ | |
reshapable: boolean; | |
/**Gets or sets whether the user may resize this part.*/ | |
resizable: boolean; | |
/**Gets or sets the adornment template used to create a resize handle Adornment for this part.*/ | |
resizeAdornmentTemplate: Adornment; | |
/**Gets or sets the width and height multiples used when resizing.*/ | |
resizeCellSize: Size; | |
/**This read-only property returns the GraphObject that should get resize handles when this part is selected.*/ | |
resizeObject: GraphObject; | |
/**Gets or sets the name of the GraphObject that should get a resize handle when this part is selected.*/ | |
resizeObjectName: string; | |
/**Gets or sets whether the user may rotate this part.*/ | |
rotatable: boolean; | |
/**Gets or sets the adornment template used to create a rotation handle Adornment for this part.*/ | |
rotateAdornmentTemplate: Adornment; | |
/**This read-only property returns the GraphObject that should get rotate handles when this part is selected.*/ | |
rotateObject: GraphObject; | |
/**Gets or sets the name of the GraphObject that should get a rotate handle when this part is selected.*/ | |
rotateObjectName: string; | |
/**Gets or sets whether the user may select this part.*/ | |
selectable: boolean; | |
/**Gets or sets whether a selection adornment is shown for this part when it is selected.*/ | |
selectionAdorned: boolean; | |
/**Gets or sets the Adornment template used to create a selection handle for this Part.*/ | |
selectionAdornmentTemplate: Adornment; | |
/**Gets or sets the function to execute when this part is selected or deselected.*/ | |
selectionChanged: (p: Part) => void; | |
/**This read-only property returns the GraphObject that should get a selection handle when this part is selected.*/ | |
selectionObject: GraphObject; | |
/**Gets or sets the name of the GraphObject that should get a selection handle when this part is selected.*/ | |
selectionObjectName: string; | |
/**Gets or sets the numerical value that describes the shadow's blur.*/ | |
shadowBlur: number; | |
/**Gets or sets the CSS string that describes a shadow color.*/ | |
shadowColor: string; | |
/**Gets or sets the X and Y offset of this part's shadow.*/ | |
shadowOffset: Point; | |
/**Gets or sets a text string that is associated with this part.*/ | |
text: string; | |
/**Gets or sets whether the user may do in-place text editing on TextBlocks in this part that have TextBlock.editable set to true.*/ | |
textEditable: boolean; | |
/**Gets or sets the Z-ordering position of this Part within its Layer; default value is NaN which means "don't care".*/ | |
zOrder: number; | |
/** | |
* Associate an Adornment with this Part, perhaps replacing any existing adornment. | |
* @param {string} category a string identifying the kind or role of the given adornment for this Part. | |
* @param {Adornment} ad | |
*/ | |
addAdornment(category: string, ad: Adornment): void; | |
/** | |
* This predicate returns true if .copyable is true, if the layer's Layer.allowCopy is true, and if the diagram's Diagram.allowCopy is true. | |
*/ | |
canCopy(): boolean; | |
/** | |
* This predicate returns true if .deletable is true, if the layer's Layer.allowDelete is true, and if the diagram's Diagram.allowDelete is true. | |
*/ | |
canDelete(): boolean; | |
/** | |
* This predicate returns true if .textEditable is true, if the layer's Layer.allowTextEdit is true, and if the diagram's Diagram.allowTextEdit is true. | |
*/ | |
canEdit(): boolean; | |
/** | |
* This predicate returns true if .groupable is true, if the layer's Layer.allowGroup is true, and if the diagram's Diagram.allowGroup is true. | |
*/ | |
canGroup(): boolean; | |
/** | |
* This predicate is called by Layout implementations to decide whether this Part should be positioned and might affect the positioning of other Parts. | |
*/ | |
canLayout(): boolean; | |
/** | |
* This predicate returns true if .movable is true, if the layer's Layer.allowMove is true, and if the diagram's Diagram.allowMove is true. | |
*/ | |
canMove(): boolean; | |
/** | |
* This predicate returns true if .reshapable is true, if the layer's Layer.allowReshape is true, and if the diagram's Diagram.allowReshape is true. | |
*/ | |
canReshape(): boolean; | |
/** | |
* This predicate returns true if .resizable is true, if the layer's Layer.allowResize is true, and if the diagram's Diagram.allowResize is true. | |
*/ | |
canResize(): boolean; | |
/** | |
* This predicate returns true if .rotatable is true, if the layer's Layer.allowRotate is true, and if the diagram's Diagram.allowRotate is true. | |
*/ | |
canRotate(): boolean; | |
/** | |
* This predicate returns true if .selectable is true, if the layer's Layer.allowSelect is true, and if the diagram's Diagram.allowSelect is true. | |
*/ | |
canSelect(): boolean; | |
/** | |
* Remove all adornments associated with this part. | |
*/ | |
clearAdornments(): void; | |
/** | |
* Measures if needed to make sure the GraphObject.measuredBounds and GraphObject.naturalBounds are all real numbers, | |
* primarily to get the actual width and height. | |
* GraphObject.actualBounds will get a real width and height, but the x and y values may continue to be <code>NaN</code> | |
* if they were that way beforehand. | |
*/ | |
ensureBounds(): void; | |
/** | |
* Find an Adornment of a given category associated with this Part. | |
* @param {string} category | |
*/ | |
findAdornment(category: string): Adornment; | |
/** | |
* Find the Group that contains both this part and another one. | |
* @param {Part} other | |
*/ | |
findCommonContainingGroup(other: Part): Group; | |
/** | |
* Return how deep this part is in the hierarchy of nested Groups. | |
* For top level parts, i.e. isTopLevel, this returns zero. | |
*/ | |
findSubGraphLevel(): number; | |
/** | |
* Gets the top-level Part for this part, which is itself when .isTopLevel is true. | |
*/ | |
findTopLevelPart(): Part; | |
/** | |
* Invalidate the Layout that is responsible for positioning this Part. | |
* @param {number=} condition the reason that the layout should be invalidated -- | |
* some combination of "Layout..." flag values; | |
* if this argument is not supplied, any value of .layoutConditions other than Part.LayoutNone | |
* will allow the layout to be invalidated. | |
*/ | |
invalidateLayout(condition?: number): void; | |
/** | |
* This predicate is true if this part is a member of the given Part, perhaps indirectly. | |
* @param {Part} part | |
*/ | |
isMemberOf(part: Part): boolean; | |
/** | |
* This predicate is true if this Part can be seen. | |
*/ | |
isVisible(): boolean; | |
/** | |
* Move this part and any parts that are owned by this part to a new position. | |
* @param {Point} newpos a new Point in document coordinates. | |
*/ | |
move(newpos: Point): void; | |
/** | |
* Move this part and any parts that are owned by this part to a new position. | |
* @param {number} x the new X position in document coordinates. | |
* @param {number} y the new Y position in document coordinates. | |
*/ | |
moveTo(x: number, y: number): void; | |
/** | |
* Remove any Adornment of the given category that may be associated with this Part. | |
* @param {string} category a string identifying the kind or role of the given adornment for this Part. | |
*/ | |
removeAdornment(category: string): void; | |
/** | |
* This is responsible for creating any selection Adornment (if this Part .isSelected) and any tool adornments for this part.*/ | |
updateAdornments(): void; | |
/** | |
* Re-evaluate all data bindings on this Part, in order to assign new property values to the GraphObjects in this visual tree based on this this object's .data property values. | |
* @param {string=} srcprop An optional source data property name: | |
* when provided, only evaluates those Bindings that use that particular property; | |
* when not provided or when it is the empty string, all bindings are evaluated. | |
*/ | |
updateTargetBindings(srcprop?: string): void; | |
/** | |
* Update all of the references to nodes in case they had been modified in the model without | |
* properly notifying the model by calling GraphLinksModel.setGroupKeyForNodeData or | |
* GraphLinksModel.setToKeyForLinkData or other similar methods. | |
*/ | |
updateRelationshipsFromData(): void; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Part is added to a Diagram or Group, it invalidates the Layout responsible for the Part.*/ | |
static LayoutAdded: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Group has been laid out, it invalidates the Layout responsible for that Group; this flag is ignored for Parts that are not Groups.*/ | |
static LayoutGroupLayout: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Part's GraphObject.visible becomes false, it invalidates the Layout responsible for the Part.*/ | |
static LayoutHidden: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Node or simple Part's .category changes, it invalidates the Layout responsible for the Part; this flag is ignored for Parts that are Links.*/ | |
static LayoutNodeReplaced: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Part's GraphObject.actualBounds changes size, it invalidates the Layout responsible for the Part; this flag is ignored for Parts that are Links.*/ | |
static LayoutNodeSized: number; | |
/**This value may be used as the value of the Part.layoutConditions property to indicate that no operation on this Part causes invalidation of the Layout responsible for this Part.*/ | |
static LayoutNone: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Part is removed from a Diagram or Group, it invalidates the Layout responsible for the Part.*/ | |
static LayoutRemoved: number; | |
/**This flag may be combined with other "Layout" flags as the value of the Part.layoutConditions property to indicate that when a Part's GraphObject.visible becomes true, it invalidates the Layout responsible for the Part.*/ | |
static LayoutShown: number; | |
/**This is the default value for the Part.layoutConditions property: the Layout responsible for the Part is invalidated when the Part is added or removed from the Diagram or Group or when it changes visibility or size or when a Group's layout has been performed.*/ | |
static LayoutStandard: number; | |
key: string | number | undefined; // undocumented read-only property | |
} | |
/** | |
* A Picture is a GraphObject that shows an image, video-frame, or Canvas element. | |
* You can specify what to show by either setting the .source URL property | |
* to a URL string or the .element property to an HTMLImageElement, | |
* HTMLCanvasElement, or HTMLVideoElement. | |
*/ | |
export class Picture extends GraphObject { | |
/** | |
* The constructor creates a picture that shows nothing until the .source or .element is specified. | |
*/ | |
constructor(); | |
/**Gets or sets the Picture's HTML Element, an Image or Video or Canvas element.*/ | |
element: Element; | |
/**Gets or sets the function to call if an image fails to load.*/ | |
errorFunction: (pic: Picture, e: Event) => void; | |
/**Gets or sets the Spot to align the source image to, when the source image is smaller than the Picture.*/ | |
imageAlignment: Spot; | |
/**Gets or sets how the Picture's image is stretched within its bounding box.*/ | |
imageStretch: EnumValue; | |
/**This read-only property returns the natural size of this picture as determined by its source's width and height.*/ | |
naturalBounds: Rect; | |
/**Gets or sets the Picture's source URL, which can be any valid image (png, jpg, gif, etc) URL.*/ | |
source: string; | |
/**Gets or sets a function that returns a value for image.crossOrigin, which is null by default.*/ | |
sourceCrossOrigin: (pic: Picture) => string; | |
/**Gets or sets the rectangular area of the source image that this picture should display.*/ | |
sourceRect: Rect; | |
/**Gets or sets the function to call when an image loads successfully.*/ | |
successFunction: (pic: Picture, e: Event) => void; | |
flip: EnumValue; // undocumented | |
static clearCache(url?: string): void; // undocumented | |
} | |
/** | |
* If a Placeholder is in the visual tree of a Group, it represents the area of all of the member Parts of that Group. | |
* If a Placeholder is in the visual tree of an Adornment, it represents the area of the Adornment.adornedObject. | |
* It can only be used in the visual tree of a Group node or an Adornment. | |
* There can be at most one Placeholder in a Group or an Adornment. | |
*/ | |
export class Placeholder extends GraphObject { | |
/** | |
* The only common initialize of a Placeholder is to set its .padding. | |
*/ | |
constructor(); | |
/**Gets or sets the padding as a Margin (or number for a uniform Margin) around the members of the Group or around the Adornment.adornedObject GraphObject.*/ | |
padding: MarginLike; | |
} | |
/** | |
* The RowColumnDefinition class describes constraints on a row or a column | |
* in a Panel of type Panel.Table. | |
* It also provides information about the actual layout after the | |
* Table Panel has been arranged. | |
*/ | |
export class RowColumnDefinition { | |
/** | |
* You do not need to use this constructor, because calls to Panel.getRowDefinition or Panel.getColumnDefinition will automatically create and remember a RowColumnDefinition for you. | |
*/ | |
constructor(); | |
/**This read-only property returns the usable row height or column width, after arrangement, that objects in this row or column can be placed within.*/ | |
actual: number; | |
/**Gets or sets a default alignment for elements that are in this row or column.*/ | |
alignment: Spot; | |
/**Gets or sets the background Brush (or CSS color string) for a particular row or column, which fills the entire span of the column, including any separatorPadding.*/ | |
background: BrushLike; | |
/**Determines whether or not the background, if there is one, is in front of or behind the separators.*/ | |
coversSeparators: boolean; | |
/**Gets or sets the row height.*/ | |
height: number; | |
/**This read-only property returns which row or column this RowColumnDefinition describes in the .panel.*/ | |
index: number; | |
/**This read-only property returns whether this describes a row or a column in the .panel.*/ | |
isRow: boolean; | |
/**Gets or sets the maximum row height or column width.*/ | |
maximum: number; | |
/**Gets or sets the minimum row height or column width.*/ | |
minimum: number; | |
/**This read-only property returns the Panel that this row or column definition is in.*/ | |
panel: Panel; | |
/**This read-only property returns the actual arranged row or column starting position, after arrangement.*/ | |
position: number; | |
/**Gets or sets the dash array for dashing the spacing provided this row or column has a nonzero RowColumnDefinition.separatorStrokeWidth and non-null RowColumnDefinition.separatorStroke.*/ | |
separatorDashArray: Array<number>; | |
/**Gets or sets the additional padding for a particular row or column, a Margin (or number for a uniform Margin).*/ | |
separatorPadding: MarginLike; | |
/**Gets or sets the Brush (or CSS color string) for a particular row or column, provided that row or column has a nonzero RowColumnDefinition.separatorStrokeWidth.*/ | |
separatorStroke: BrushLike; | |
/**Gets or sets the stroke width for a particular row or column's separator,*/ | |
separatorStrokeWidth: number; | |
/**Gets or sets how this row or column deals with a Table Panel's extra space.*/ | |
sizing: EnumValue; | |
/**Gets or sets the default stretch for elements that are in this row or column.*/ | |
stretch: EnumValue; | |
/**This read-only property returns the total arranged row height or column width, after arrangement.*/ | |
total: number; | |