// Type definitions for GoJS 1.2
// Project: http://gojs.net
// Definitions by: Barbara Duckworth
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* Copyright (C) 1998-2013 by Northwoods Software Corporation. */
// A number of types have been declared "any" because they would best be described by a union of specific types,
// not as truly "any" type, and TypeScript does not support union types. Most of the cases are due to:
// - a property of type Margin whose setter also accepts a number, for a uniform Margin of that thickness
// - a property of type Brush whose setter also accepts a string, a CSS color string for a solid color Brush
// - a boolean property that may also be null (tri-state)
// - a key type, which may be a string or a number, uniquely identifying a node data within a Model
// - a property that is string that names a property or that is a function that gets or sets a value, on an Object in a Model
declare module go {
/**
* 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.
*/
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;
/**Gets the Part that contains the adorned object.*/
adornedPart: Part;
/**Gets a Placeholder that this Adornment may contain in its visual tree.*/
placeholder: Placeholder;
}
/**
* 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.
*/
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.*/
archetypeGroupData: Object;
/**Gets or sets whether #copySelection should also copy subtrees.*/
copiesTree: boolean;
/**Gets or sets whether #deleteSelection should also delete subtrees.*/
deletesTree: boolean;
/**Gets 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.*/
memberValidation: (g: Group, p: Part) => boolean;
/**Gets or sets the amount by which #decreaseZoom and #increaseZoom change the Diagram#scale; default is 1.05.*/
zoomFactor: number;
/**
* Make sure all of the unnested Parts in the given collection are removed from any containing Groups.
* @param {Iterable} 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, 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 #selectAll command.
*/
canSelectAll(): 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);
/**
* Collapse all expanded selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
collapseTree(node?: Node);
/**
* Copy the currently selected parts, Diagram#selection, from the Diagram into the clipboard.
*/
copySelection();
/**
* This makes a copy of the given collection of Parts and stores it in a static variable acting as the clipboard.
* @param {Iterable} coll A collection of Parts.
*/
copyToClipboard(coll: Iterable);
/**
* Execute a #copySelection followed by a #deleteSelection.
*/
cutSelection();
/**
* 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);
/**
* Delete the currently selected parts from the diagram.
*/
deleteSelection();
/**
* This is called by tools to handle keyboard commands.
*/
doKeyDown();
/**
* This is called by tools to handle keyboard commands.
*/
doKeyUp();
/**
* Start in-place editing of a TextBlock in the selected Part.
* @param {TextBlock=} textblock the TextBlock to start editing.
*/
editTextBlock(textblock?: TextBlock);
/**
* Expand all collapsed selected Groups.
* @param {Group=} group if supplied, ignore the selection and expand this particular Group.
*/
expandSubGraph(group?: Group);
/**
* Expand all collapsed selected Nodes.
* @param {Node=} node if supplied, ignore the selection and collapse this particular Node subtree.
*/
expandTree(node?: Node);
/**
* 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();
/**
* 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);
/**
* 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;
/**
* 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);
/**
* Call UndoManager#redo.
*/
redo();
/**
* 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);
/**
* Select all of the selectable Parts in the diagram.
*/
selectAll();
/**
* Cancel the operation of the current tool.
*/
stopCommand();
/**
* Call UndoManager#undo.
*/
undo();
/**
* 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);
/**
* Change the Diagram#scale so that the Diagram#documentBounds fits within the viewport.
*/
zoomToFit();
}
/**
* 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.
*/
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;
/**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: any;
/**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 is shown when the use context clicks in the background.*/
contextMenu: Adornment;
/**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;
/**Gets 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 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;
/**Gets or sets whether the Diagram has a horizontal Scrollbar.*/
hasHorizontalScrollbar: boolean;
/**Gets or sets whether the Diagram has a vertical Scrollbar.*/
hasVerticalScrollbar: boolean;
/**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;
/**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;
/**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;
/**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;
/**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;
/**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: any;
/**Returns an iterator of all Parts in the Diagram that are not Nodes or Links or Adornments.*/
parts: Iterator;
/**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;
/**Gets the read-only collection of selected objects.*/
selection: Set;
/**Gets or sets whether ChangedEvents are not recorded by the UndoManager.*/
skipsUndoManager: boolean;
/**Gets the UndoManager for this Diagram, which actually belongs to the #model.*/
toolManager: ToolManager;
/**This Adornment is shown when the mouse stays motionless in the background.*/
toolTip: Adornment;
/**Gets 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;
/**Gets 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);
/**
* 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);
/**
* 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);
/**
* Adds a Layer to the list of layers.
* @param {Layer} layer The Layer to add.
*/
addLayer(layer: Layer);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
* @param {Rect} r
*/
centerRect(r: Rect);
/**
* Removes all Parts from the Diagram, including unbound Parts and the background grid, and also clears out the Model and UndoManager.
*/
clear();
/**
* Deselect all selected Parts.
*/
clearSelection();
/**
* Commit the changes of the current transaction.
* @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} coll a collection of Parts.
*/
computePartsBounds(coll: Iterable): Rect;
/**
* 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);
/**
* 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;
/**
* 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: any): 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): Iterable;
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
/**
* 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.
* @param {*} key a string or number.
*/
findPartForKey(key: any): Part;
/**
* Returns an iterator of all Groups that are at top-level, in other words that are not themselves inside other Groups.
*/
findTopLevelGroups(): Iterator;
/**
* Returns an iterator of all top-level Nodes that have no tree parents.
*/
findTreeRoots(): Iterator;
/**
* Explicitly bring focus to the Diagram's canvas.
*/
focus();
/**
* This static method gets the Diagram that is attached to an HTML DIV element.
* @param {HTMLDivElement} div
*/
static fromDiv(div: HTMLDivElement): Diagram;
/**
* 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: new(...args: any[]) => Object, baseclass: new(...args: any[]) => Object);
/**
* 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);
/**
* Create an HTMLImageElement that contains a bitmap of the current Diagram.
* @param {Object=} properties For details see the argument description of #makeImageData.
*/
makeImage(properties?: Object): HTMLImageElement;
/**
* Create a bitmap of the current Diagram encoded as a base64 string.
* @param {{ size: Size,
scale: number,
maxSize: Size,
position: Point,
parts: Iterable,
padding: (Margin|number),
showTemporary: boolean,
showGrid: boolean,
type: string,
details: Object}=} properties a JavaScript object detailing optional arguments for image creation, to be passed to makeImageData.
*/
makeImageData(properties?: Object): string;
/**
* Remove all of the Parts created from model data and then create them again.
*/
rebuildParts();
/**
* Removes a Part from its Layer, provided the Layer is in this Diagram.
* @param {Part} part
*/
remove(part: Part);
/**
* Unregister an event handler listener.
* @param {function(ChangedEvent)} listener a function that takes a ChangedEvent as its argument.
*/
removeChangedListener(listener: (e: ChangedEvent) => 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);
/**
* Removes the given layer from the list of layers.
* @param {Layer} layer
*/
removeLayer(layer: Layer);
/**
* Rollback the current transaction, undoing any recorded changes.
*/
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);
/**
* Modifies the #position to show a given Rect of the Diagram by centering the viewport on that Rect.
* @param {Rect} r
*/
scrollToRect(r: Rect);
/**
* 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);
/**
* Select all of the Parts supplied in the given collection.
* @param {Iterable} coll a List or Set of Parts to be selected.
*/
selectCollection(coll: Iterable);
/**
* Begin a transaction, where the changes are held by a Transaction object in the UndoManager.
* @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();
/**
* Scales the Diagram to uniformly fit into the viewport.
*/
zoomToFit();
/**
* 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);
/**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;
maybeUpdate(); // undocumented
requestUpdate(); // 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.
*/
class DiagramEvent {
/**
* The DiagramEvent class constructor produces an empty DiagramEvent.
*/
constructor();
/**Gets or sets whether any default actions associated with this diagram event should be avoided or cancelled.*/
cancel: boolean;
/**Gets 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: Object;
}
/**
* This is the abstract base class for all graphical objects.
*/
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;
/**Gets 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: any;
/**Gets or sets the background Brush (or CSS color string) of this GraphObject, filling the rectangle of this object's local coordinate space.*/
background: any;
/**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 is shown upon a context click on this object.*/
contextMenu: Adornment;
/**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;
/**Gets 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 how the direction of the last segment of a link coming from this port is computed when the node is rotated.*/
fromEndSegmentDirection: EnumValue;
/**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.*/
fromLinkable: any;
/**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 whether a GraphObject is the "main" object for some types of Panel.*/
isPanelMain: boolean;
/**Gets 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: any;
/**Gets or sets the maximum size of this GraphObject in container coordinates (either a Panel or the document).*/
maxSize: Size;
/**Gets 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;
/**Gets 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 the GraphObject's containing Panel, or null if this object is not in a Panel.*/
panel: Panel;
/**Gets 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 the stretch of the GraphObject.*/
stretch: EnumValue;
/**Gets or sets how the direction of the last segment of a link going to this port is computed when the node is rotated.*/
toEndSegmentDirection: 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.*/
toLinkable: any;
/**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 is shown when the mouse hovers over this object.*/
toolTip: Adornment;
/**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);
/**
* Creates a deep copy of this GraphObject and returns it.
*/
copy(): GraphObject;
/**
* 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.
*/
getDocumentPoint(s: Spot, 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 true if this object is #visible and each of its visual containing panels are also visible.
*/
isVisibleObject(): boolean;
/**
* 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: any, ...initializers: 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;
}
/**
* 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.
*/
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.*/
computesBoundsAfterDrag: boolean;
/**Gets or sets whether the subgraph contained by this group is expanded.*/
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;
/**Gets an iterator over the member Parts of this Group.*/
memberParts: Iterator;
/**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;
/**Gets 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} 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, check?: boolean): boolean;
/**
* See if the given collection of Parts contains non-Links all for which CommandHandler#isValidMember returns true.
* @param {Iterable} coll
*/
canAddMembers(coll: Iterable): 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();
/**
* Show each member node and link, and perhaps recursively expand nested subgraphs.
*/
expandSubGraph();
/**
* 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;
/**
* Move this Group and all of its member parts, recursively.
* @param {Point} newpos a new Point in document coordinates.
*/
move(newpos: Point);
}
/**
* 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).
*/
class InputEvent {
/**
* The InputEvent class constructor produces an empty InputEvent.
*/
constructor();
/**Gets whether the alt key is being held down.*/
alt: boolean;
/**Gets or sets whether the underlying #event is prevented from bubbling up the hierarchy of HTML elements outside of the Diagram and whether any default action is canceled.*/
bubbles: boolean;
/**Gets or sets the button that caused this event.*/
button: number;
/**Gets or sets whether this event represents a click or a double-click.*/
clickCount: number;
/**Gets 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;
/**Gets 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;
/**Gets or sets the key pressed or released as this event.*/
key: string;
/**Gets whether the logical left mouse button is being held down.*/
left: boolean;
/**Gets whether the meta key is being held down.*/
meta: boolean;
/**Gets 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 whether the logical right mouse button is being held down.*/
right: boolean;
/**Gets 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;
}
/**
* 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.
*/
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;
/**Gets 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;
/**Gets an iterator for this Layer's Parts.*/
parts: Iterator;
/**Gets a backwards iterator for this Layer's Parts, for iterating over the parts in reverse order.*/
partsBackwards: Iterator;
/**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): Iterable;
findObjectsAt(p: Point, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsIn(r: Rect, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
/**
* 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): Iterable;
findObjectsNear(p: Point, dist: number, navig?: (obj: GraphObject) => GraphObject, pred?: (obj: GraphObject) => boolean, partialInclusion?: boolean, coll?: Set): Iterable;
}
/**
* 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.
*/
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 how the direction of the last segment is computed when the node is rotated.*/
fromEndSegmentDirection: EnumValue;
/**Gets or sets the length of the last segment.*/
fromEndSegmentLength: number;
/**Gets or sets the Node that this link comes from.*/
fromNode: Node;
/**Gets 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;
/**Gets 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;
/**Gets an iterator over the Nodes that act as labels on this Link.*/
labelNodes: Iterator;
/**Gets the angle of the path at the #midPoint.*/
midAngle: number;
/**Gets the point at the middle of the path.*/
midPoint: Point;
/**Gets the Shape representing the path of this Link.*/
path: Shape;
/**Gets or sets the List of Points in the route.*/
points: List;
/**Gets 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 how far the control points are from the points of the route when #routing is #Orthogonal and #curve is #Bezier.*/
toEndSegmentDirection: EnumValue;
/**Gets or sets the length of the last segment.*/
toEndSegmentLength: number;
/**Gets or sets the Node that this link goes to.*/
toNode: Node;
/**Gets 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;
/**
* 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)
/**
* 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;
/**
* Move this link to a new position.
* @param {Point} newpos
*/
move(newpos: Point);
/**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;
}
/**
* 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.
*/
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: any;
/**Gets whether a 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 an iterator over all of the Links that are connected with this node.*/
linksConnected: Iterator;
/**Get the primary GraphObject representing a port in this node.*/
port: GraphObject;
/**Gets an iterator over all of the GraphObjects in this node that act as ports.*/
ports: Iterator;
/**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);
/**
* 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);
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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;
/**
* Returns an Iterator for the collection of Nodes that are the immediate tree children of this node.
*/
findTreeChildrenNodes(): Iterator;
/**
* 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;
/**
* 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 GraphObject#fromEndSegmentDirection and GraphObject#toEndSegmentDirection indicates that the link's end segment angle stays the same even if the node is rotated.*/
static DirectionAbsolute: EnumValue;
/**This value for Link#fromEndSegmentDirection and Link#toEndSegmentDirection indicates that the real value is inherited from the corresponding connected port.*/
static DirectionDefault: EnumValue;
/**This value for GraphObject#fromEndSegmentDirection and GraphObject#toEndSegmentDirection indicates that the link's end segment angle is rotated to match the node's angle.*/
static DirectionRotatedNode: EnumValue;
/**This value for GraphObject#fromEndSegmentDirection and GraphObject#toEndSegmentDirection indicates that the link's end segment angle is rotated to match the node's angle, but only in increments of 90 degrees.*/
static DirectionRotatedNodeOrthogonal: EnumValue;
}
/**
* 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.
*/
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.
*/
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.
*/
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);
/**Gets 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: Object;
/**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: any[];
/**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: any;
/**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: any[];
/**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: any;
/**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: any;
/**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;
/**Gets an iterator over the collection of the GraphObjects that this panel manages.*/
elements: Iterator;
/**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 a JavaScript Array of values or objects, each of which will be represented by a Panel as elements in this Panel.*/
itemArray: 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: any;
/**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;
/**Gets or sets the first column that this Panel of #type Panel#Table displays.*/
leftIndex: number;
/**Gets or sets the multiplicative opacity for this Panel and all children.*/
opacity: 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: any;
/**Gets 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);
/**
* 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;
/**
* 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;
/**
* 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;
/**
* 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);
/**
* Create and add new GraphObjects corresponding to and bound to the data in the #itemArray, after removing all existing elements from this Panel.
*/
rebuildItemElements();
/**
* Removes a GraphObject from this Panel's list of elements.
* @param {GraphObject} element A GraphObject.
*/
remove(element: GraphObject);
/**
* Removes an GraphObject from this Panel's list of elements at the specified index.
* @param {number} idx
*/
removeAt(idx: number);
/**
* 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);
/**
* 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);
/**
* 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);
/**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 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}.
*/
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);
/**Gets an iterator over all of the Adornments associated with this part.*/
adornments: Iterator;
/**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;
/**Gets 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 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;
/**Gets 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;
/**Gets 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;
/**Gets 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;
/**Gets 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;
/**Gets 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;
/**
* 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);
/**
* 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();
/**
* 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;
/**
* 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);
/**
* 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);
/**
* 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);
/**
* This is responsible for creating any selection Adornment (if this Part #isSelected) and any tool adornments for this part.*/
updateAdornments();
/**
* 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);
/**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 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;
ensureBounds(); // undocumented
}
/**
* 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.
*/
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: HTMLElement;
/**Gets or sets the function to call if an image fails to load.*/
errorFunction: (pic: Picture, e: Event) => void;
/**Gets or sets how the Picture's image is stretched within its bounding box.*/
imageStretch: EnumValue;
/**Gets 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 the rectangular area of the source image that this picture should display.*/
sourceRect: Rect;
}
/**
* 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.
*/
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: any;
}
/**
* 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.
*/
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();
/**Gets 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: any;
/**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;
/**Gets which row or column this RowColumnDefinition describes in the #panel.*/
index: number;
/**Gets 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;
/**Gets the Panel that this row or column definition is in.*/
panel: Panel;
/**Gets 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: any[];
/**Gets or sets the additional padding for a particular row or column, a Margin (or number for a uniform Margin).*/
separatorPadding: any;
/**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: any;
/**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;
/**Gets the total arranged row height or column width, after arrangement.*/
total: number;
/**Gets or sets the column width.*/
width: number;
/**
* Add a data-binding of a property on this object to a property on a data object.
* @param {Binding} binding
*/
bind(binding: Binding);
/**The default #sizing, which resolves to RowColumnDefinition#None or else the Table Panel's rowSizing and columnSizing if present.*/
static Default: EnumValue;
/**The default #sizing if none is specified on the Table Panel's rowSizing and columnSizing.*/
static None: EnumValue;
/**If a Table Panel is larger than all the rows then this #sizing grants this row and any others with the same value the extra space, apportioned proportionally between them*/
static ProportionalExtra: EnumValue;
}
/**
* A Shape is a GraphObject that shows a geometric figure.
* The Geometry determines what is drawn;
* the properties #fill and #stroke
* (and other stroke properties) determine how it is drawn.
*/
class Shape extends GraphObject {
/**
* A newly constructed Shape has a default #figure of "None", which constructs a rectangular geometry, and is filled and stroked with a black brush.
*/
constructor();
/**Gets or sets the figure name, used to construct a Geometry.*/
figure: string;
/**Gets or sets the Brush (or CSS color string) that describes the fill of the Shape.*/
fill: any;
/**Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link.*/
fromArrow: string;
/**Gets or sets the Shape's Geometry that defines the Shape's figure.*/
geometry: Geometry;
/**Gets or sets how the shape's geometry is proportionally created given its computed size.*/
geometryStretch: EnumValue;
/**When set, creates a Geometry and normalizes it from a given path string, then sets the Geometry on this Shape and offsets the GraphObject#position by an appropriate amount.*/
geometryString: string;
/**Gets or sets how frequently this shape should be drawn within a Grid Panel, in multiples of the Panel#gridCellSize.*/
interval: number;
/**Gets or sets the whether the #position denotes the panel coordinates of the geometry or of the stroked area.*/
isGeometryPositioned: boolean;
/**Gets the natural bounds of this Shape as determined by its #geometry's bounds.*/
naturalBounds: Rect;
/**Gets or sets a property for parameterizing the construction of a Geometry from a figure.*/
parameter1: number;
/**Gets or sets a property for parameterizing the construction of a Geometry from a figure.*/
parameter2: number;
/**Gets or sets the top-left Spot used by some Panels for determining where in the shape other objects may be placed.*/
spot1: Spot;
/**Gets or sets the bottom-right Spot used by some Panels for determining where in the shape other objects may be placed.*/
spot2: Spot;
/**Gets or sets the Brush (or CSS color string) that describes the stroke of the Shape.*/
stroke: any;
/**Gets or sets the style for the stroke's line cap.*/
strokeCap: string;
/**Gets or sets the dash array for creating dashed lines.*/
strokeDashArray: any[];
/**Gets or sets the offset for dashed lines, used in the phase pattern.*/
strokeDashOffset: number;
/**Gets or sets the type of corner that will be drawn when two lines meet.*/
strokeJoin: string;
/**Gets or sets the style for the stroke's mitre limit ratio.*/
strokeMiterLimit: number;
/**Gets or sets a stroke's width.*/
strokeWidth: number;
/**Gets or sets the name of the kind of arrowhead that this shape should take when this shape is an element of a Link.*/
toArrow: string;
}
/**
* A TextBlock is a GraphObject that displays a #text string in a given #font.
*/
class TextBlock extends GraphObject {
/**
* A newly constructed TextBlock has no string to show; if it did, it would draw the text, wrapping if needed, in the default font using a black stroke.
*/
constructor();
/**Gets or sets whether or not this TextBlock allows in-place editing of the #text string by the user with the help of the TextEditingTool.*/
editable: boolean;
/**Gets or sets the function to call if a text edit made with the TextEditingTool is invalid.*/
errorFunction: (tool: TextEditingTool, oldstr: string, newstr: string) => void;
/**Gets or sets the current font settings.*/
font: string;
/**Gets or sets whether or not the text allows or displays multiple lines or embedded newlines.*/
isMultiline: boolean;
/**Gets or sets whether or not the text has a strikethrough line (line-through).*/
isStrikethrough: boolean;
/**Gets or sets whether or not the text is underlined.*/
isUnderline: boolean;
/**Gets the total number of lines in this TextBlock, including lines created from returns and wrapping.*/
lineCount: number;
/**Gets the natural bounds of this TextBlock in local coordinates, as determined by its #font and #text string.*/
naturalBounds: Rect;
/**Gets or sets the Brush (or CSS color string) that describes the stroke (color) of the #font.*/
stroke: any;
/**Gets or sets the current text string.*/
text: string;
/**Gets or sets the current text alignment property.*/
textAlign: string;
/**Gets or sets the HTMLElement that this TextBlock uses as its text editor in the TextEditingTool.*/
textEditor: HTMLElement;
/**Gets or sets the predicate that determines whether or not a string of text is valid.*/
textValidation: (tb: TextBlock, oldstr: string, newstr: string) => boolean;
/**Gets or sets whether the text should be wrapped if it is too long to fit on one line.*/
wrap: EnumValue;
/**The TextBlock will not wrap its text.*/
static None: EnumValue;
/**The TextBlock will wrap text and the width of the TextBlock will be the desiredSize's width, if any.*/
static WrapDesiredSize: EnumValue;
/**The TextBlock will wrap text, making the width of the TextBlock equal to the width of the longest line.*/
static WrapFit: EnumValue;
}
/**
* A Brush holds color information and describes how to draw the inside
* of a Shape or the stroke of a shape or a TextBlock or the
* background of any GraphObject.
* A Brush must not be modified once it has been assigned to a GraphObject,
* such as the Shape#fill or TextBlock#stroke
* or GraphObject#background.
* However, a Brush may be shared by multiple GraphObjects.
*/
class Brush {
/**
* Construct a Brush class of a given type.
* @param {EnumValue} type one of the values Brush#Solid, Brush#Linear, Brush#Radial, Brush#Pattern.
*/
constructor(type: EnumValue);
/**
* Construct a solid color Brush that holds the given color information.
* @param {string=} color a well-formed CSS string describing a solid color brush; if not supplied uses 'black'.
*/
constructor(color?: string);
/**Gets or sets the color of a solid Brush.*/
color: string;
/**Gets or sets a Map holding all of the color stops used in this gradient, where the key is a number, the fractional distance between zero and one (inclusive), and where the corresponding value is a color string.*/
colorStops: Map;
/**Gets or sets the ending location for a linear or radial gradient.*/
end: Spot;
/**Gets or sets the radius of a radial brush at the end location.*/
endRadius: number;
/**Gets or sets the pattern of a brush of type Brush#Pattern, an HTMLImageElement or HTMLCanvasElement.*/
pattern: any;
/**Gets or sets the starting location for a linear or radial gradient.*/
start: Spot;
/**Gets or sets the radius of a radial brush at the start location.*/
startRadius: number;
/**Gets or sets the type of brush.*/
type: EnumValue;
/**
* Specify a particular color at a particular fraction of the distance.
* If the #type is Brush#Solid, change the type to Brush#Linear.
* You should have a color stop at zero and a color stop at one.
* You should not have duplicate color stop values at the same fractional distance.
* @param {number} loc between zero and one, inclusive.
* @param {string} color a CSS color string
*/
addColorStop(loc: number, color: string);
/**
* Create a copy of this Brush, with the same values.
*/
copy(): Brush;
/**
* This static method can be used to generate a random color string.
* @param {number=} min a number between zero and 255, defaults to 128.
* @param {number=} max a number between zero and 255, defaults to 255.
*/
static randomColor(min?: number, max?: number): string;
/**For linear gradient brushes, used as the value for Brush#type.*/
static Linear: EnumValue;
/**For pattern brushes, used as the value for Brush#type.*/
static Pattern: EnumValue;
/**For radial gradient brushes, used as the value for Brush#type.*/
static Radial: EnumValue;
/**For simple, solid color brushes, used as the value for Brush#type.*/
static Solid: EnumValue;
}
/**
* The Geometry class is used to define the "shape" of a Shape.
* A Geometry can be simple straight lines, rectangles, or ellipses.
* A Geometry can also be an arbitrarily complex path, consisting of a list of PathFigures.
* A Geometry must not be modified once it has been used by a Shape.
* However, a Geometry may be shared by multiple Shapes.
*/
class Geometry {
/**
* Construct an empty Geometry.
* The geometry type must be one of the following values:
* Geometry#Line, Geometry#Ellipse, Geometry#Rectangle, Geometry#Path.
* @param {EnumValue=} type If not supplied, the default Geometry type is Geometry#Path.
*/
constructor(type?: EnumValue);
/**Gets a rectangle that contains all points within the Geometry.*/
bounds: Rect;
/**Gets or sets the ending X coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.*/
endX: number;
/**Gets or sets the ending Y coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.*/
endY: number;
/**Gets or sets the List of PathFigures that describes the content of the path for Geometries of type #Path.*/
figures: List;
/**Gets or sets the spot to use when the Shape#spot1 value is Spot#Default.*/
spot1: Spot;
/**Gets or sets the spot to use when the Shape#spot2 value is Spot#Default.*/
spot2: Spot;
/**Gets or sets the starting X coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.*/
startX: number;
/**Gets or sets the starting Y coordinate of the Geometry if it is of type #Line, #Rectangle, or #Ellipse.*/
startY: number;
/**Gets or sets the type of the Geometry.*/
type: EnumValue;
/**
* Computes the Geometry's bounds without adding an origin point, and returns those bounds as a rect.
*/
computeBoundsWithoutOrigin(): Rect;
/**
* Create a copy of this Geometry, with the same values and figures.
*/
copy(): Geometry;
/**
* Given a SVG or GoJS path string, returns a congruent path string with each PathFigure filled.
* For instance, "M0 0 L22 22 L33 0" would become "F M0 0 L22 22 L33 0".
* @param {string} str
*/
static fillPath(str: string): string;
/**
* Normalizes the Geometry points in place by ensuring the top-left bounds of the geometry lines up with (0, 0), returning the Point (x, y) amount it was shifted.
*/
normalize(): Point;
/**
* Offsets the Geometry in place by a given (x, y) amount
* @param {number} x The x-axis offset factor.
* @param {number} y The y-axis offset factor.
*/
offset(x: number, y: number);
/**
* Produce a Geometry from a string that uses an SVG-like compact path geometry syntax.
* @param {string} str
* @param {boolean=} filled whether figures should be filled.
* If true, all PathFigures in the string will be filled regardless of the presence
* of an "F" command or not.
* If false, all PathFigures will determine their own filled state by the presence of an "F" command or not.
* Default is false.
*/
static parse(str: string, filled?: boolean): Geometry;
/**
* Rotates the Geometry in place by a given angle, with optional x and y values to rotate the geometry about.
* If no x and y value are giving, (0, 0) is used as the rotation point.
* @param {number} angle The angle to rotate by.
* @param {number=} x The optional X point to rotate the geometry about. If no point is given, this value is 0.
* @param {number=} y The optional Y point to rotate the geometry about. If no point is given, this value is 0.
*/
rotate(angle: number, x?: number, y?: number);
/**
* Scales the Geometry in place by a given (x, y) scale factor
* @param {number} x The x-axis scale factor.
* @param {number} y The y-axis scale factor.
*/
scale(x: number, y: number);
/**
* This static method can be used to write out a Geometry as a string
* that can be read by Geometry.parse.
* The string produced by this method is a superset of the SVG path
* string rules that contains some additional GoJS-specific tokens.
* See the Introduction page on Geometry Parsing for more details.
* @param {Geometry} val
*/
static stringify(val: Geometry): string;
/**For drawing an ellipse fitting within a rectangle; a value for Geometry#type.*/
static Ellipse: EnumValue;
/**For drawing a simple straight line; a value for Geometry#type.*/
static Line: EnumValue;
/**For drawing a complex path made of a list of PathFigures; a value for Geometry#type.*/
static Path: EnumValue;
/**For drawing a rectangle; a value for Geometry#type.*/
static Rectangle: EnumValue;
}
/**
* A Margin represents a band of space outside or inside a rectangular area,
* with possibly different values on each of the four sides.
*/
class Margin {
/**
* If zero arguments are supplied, zero is used for all four sides.
*/
constructor();
/**
* If one argument is supplied, that number is used for all four sides.
* @param {number} m the margin for all four sides.
*/
constructor(m: number);
/**
* If two arguments are supplied, the top and bottom sides get the first value,
* and the left and right sides get the second value.
* @param {number} tb the margin for the top and bottom sides
* @param {number} rl the margin for the right and left sides
*/
constructor(tb: number, rl: number);
/**
* If there are four arguments, the numbers represent: top, right, bottom, left.
* @param {number} t the margin for the top side;
* if not supplied, all sides are zero.
* @param {number} r the margin for the right side;
* if not supplied, all sides have the value of the first argument.
* @param {number} b the margin for all bottom side;
* if not supplied, the top and bottom get the value of the first argument,
* and the right and left sides get the value of the second argument.
* @param {number} l the margin for the left side;
* must be supplied if the third argument was supplied.
*/
constructor(t: number, r: number, b: number, l: number);
/**Gets or sets the bottom value of this margin.*/
bottom: number;
/**Gets or sets the left value of this margin.*/
left: number;
/**Gets or sets the right value of this margin.*/
right: number;
/**Gets or sets the top value of this margin.*/
top: number;
/**
* Create a copy of this Margin, with the same values.
*/
copy(): Margin;
/**
* Indicates whether the given Margin is equal to this Margin.
* @param {Margin} m The Margin to compare to this Margin.
*/
equals(m: Margin): boolean;
/**
* Indicates whether the given margin is equal to this Margin.
* @param {number} t top.
* @param {number} r right.
* @param {number} b bottom.
* @param {number} l left.
*/
equalTo(t: number, r: number, b: number, l: number): boolean;
/**
* True if this Margin has values that are real numbers and not infinity.
*/
isReal(): boolean;
/**
* This static method can be used to read in a Margin from a string that was produced by Margin.stringify.
* @param {string} str
*/
static parse(str: string): Margin;
/**
* Replace the transformation matrix of this Transform with those of another Transform.
* @param {Transform} t the other Transform from which to copy the transformation matrix.
*/
set(m: Margin): Margin;
/**
* Modify this Size with new Width and Height values.
* @param {number} w the width.
* @param {number} h the height.
*/
setTo(t: number, r: number, b: number, l: number): Margin;
/**
* This static method can be used to write out a Margin as a string that can be read by Margin.parse.
* @param {Margin} val
*/
static stringify(val: Margin): string;
}
/**
* A PathFigure represents a section of a Geometry}.
* It is a single connected series of
* two-dimensional geometric PathSegments.
*/
class PathFigure {
/**
* Constructs an empty figure.
* The optional arguments specify the starting point of the figure.
* You'll want to add a new instance of a PathFigure to the
* Geometry#figures list of a Geometry.
* @param {number=} sx optional: the X coordinate of the start point (default is zero).
* @param {number=} sy optional: the Y coordinate of the start point (default is zero).
* @param {boolean=} filled optional: whether the figure is filled (default is true).
*/
constructor(sx?: number, sy?: number, filled?: boolean);
/**Gets or sets whether this PathFigure is drawn filled.*/
isFilled: boolean;
/**Gets or sets whether this PathFigure will render a shadow if one is defined.*/
isShadowed: boolean;
/**Gets or sets the List of PathSegments that define this PathFigure.*/
segments: List;
/**Gets or sets the starting point X coordinate of the PathFigure.*/
startX: number;
/**Gets or sets the starting point Y coordinate of the PathFigure.*/
startY: number;
/**
* Create a copy of this PathFigure, with the same values and segments.
*/
copy(): PathFigure;
}
/**
* A PathSegment represents a straight line or curved segment of a path between
* two or more points that are part of a PathFigure}.
* A PathSegment must not be modified once its containing PathFigure}'s
* Geometry} has been assigned to a Shape}.
*/
class PathSegment {
/**
* Constructs a segment that goes nowhere unless you specify some Points.
* @param {EnumValue} type
* @param {number=} ex optional: the X coordinate of the end point.
* @param {number=} ey optional: the Y coordinate of the end point.
* @param {number=} x1 optional: the X coordinate of the first bezier control point.
* @param {number=} y1 optional: the Y coordinate of the first bezier control point.
* @param {number=} x2 optional: the X coordinate of the second cubic bezier control point.
* @param {number=} y2 optional: the Y coordinate of the second cubic bezier control point,
* or the large-arc-flag of an SvgArc.
* @param {boolean=} clockwise optional: whether an SvgArc goes clockwise or counterclockwise.
*/
constructor(type: EnumValue, ex?: number, ey?: number, x1?: number, y1?: number, x2?: number, y2?: number, clockwise?: boolean);
/**Gets or sets the center X value of the Arc for a PathSegment of type #Arc.*/
centerX: number;
/**Gets or sets the center Y value of the Arc for a PathSegment of type #Arc.*/
centerY: number;
/**Gets or sets the X coordinate of the end point for all kinds of PathSegment.*/
endX: number;
/**Gets or sets the Y coordinate of the end point for all kinds of PathSegment.*/
endY: number;
/**Gets or sets the sweep-flag for a PathSegment of type #SvgArc.*/
isClockwiseArc: boolean;
/**Gets or sets whether the path is closed after this PathSegment.*/
isClosed: boolean;
/**Gets or sets the large-arc-flag for a PathSegment of type #SvgArc.*/
isLargeArc: boolean;
/**Gets or sets the X value of the first control point for a PathSegment of type #Bezier or #QuadraticBezier.*/
point1X: number;
/**Gets or sets the Y value of the first control point for a PathSegment of type #Bezier or #QuadraticBezier.*/
point1Y: number;
/**Gets or sets the X value of the second control point for a PathSegment of type cubic #Bezier.*/
point2X: number;
/**Gets or sets the Y value of the second control point for a PathSegment of type cubic #Bezier.*/
point2Y: number;
/**Gets or sets the X value of the radius for a PathSegment of type #Arc.*/
radiusX: number;
/**Gets or sets the Y value of the radius for a PathSegment of type #Arc.*/
radiusY: number;
/**Gets or sets the starting angle for a PathSegment of type #Arc.*/
startAngle: number;
/**Gets or sets the length of angle in degrees, or amount of arc to "sweep" for a PathSegment of type #Arc.*/
sweepAngle: number;
/**Gets or sets the type of the PathSegment.*/
type: EnumValue;
/**Gets or sets the X-axis rotation for a PathSegment of type #SvgArc.*/
xAxisRotation: number;
/**
* Closes the path after this PathSegment.
*/
close(): PathSegment;
/**
* Makes a copy of this PathSegment.
*/
copy(): PathSegment;
/**For drawing an arc segment, a value for PathSegment#type.*/
static Arc: EnumValue;
/**For drawing a cubic bezier segment, a value for PathSegment#type.*/
static Bezier: EnumValue;
/**For drawing a straight line segment, a value for PathSegment#type.*/
static Line: EnumValue;
/**For beginning a new subpath, a value for PathSegment#type.*/
static Move: EnumValue;
/**For drawing a quadratic bezier segment, a value for PathSegment#type.*/
static QuadraticBezier: EnumValue;
/**For drawing an SVG arc segment, a value for PathSegment#type.*/
static SvgArc: EnumValue;
}
/**
* A Point represents an x- and y-coordinate pair in two-dimensional space.
*/
class Point {
/**
* The default constructor produces the Point(0,0).
*/
constructor();
/**
* The two-argument constructor produces the Point(x, y).
* @param {number} x
* @param {number} y
*/
constructor(x: number, y: number);
/**Gets or sets the x value of the Point.*/
x: number;
/**Gets or sets the y value of the Point.*/
y: number;
/**
* Modify this point so that is the sum of the current Point and the
* x and y co-ordinates of the given Point.
* @param {Point} p The Point to add to this Point.
*/
add(p: Point): Point;
/**
* Create a copy of this Point, with the same values.
*/
copy(): Point;
/**
* This static method returns the angle in degrees of the line from point P to point Q.
* @param {number} px
* @param {number} py
* @param {number} qx
* @param {number} qy
*/
static direction(px: number, py: number, qx: number, qy: number): number;
/**
* Compute the angle from this Point to a given (px,py) point.
* However, if the point is the same as this Point, the direction is zero.
* @param {number} px
* @param {number} py
*/
direction(px: number, py: number): number;
/**
* Compute the angle from this Point to a given Point.
* However, if the given Point is the same as this Point, the direction is zero.
* @param {Point} p the other Point to which to measure the relative angle.
*/
directionPoint(p: Point): number;
/**
* This static method returns the square of the distance from the point P
* to the finite line segment from point A to point B.
* @param {number} px
* @param {number} py
* @param {number} ax
* @param {number} ay
* @param {number} bx
* @param {number} by
*/
static distanceLineSegmentSquared(px: number, py: number, ax: number, ay: number, bx: number, by: number): number;
/**
* Returns the square of the distance from this point to a given point (px, py).
* @param {number} px
* @param {number} py
*/
distanceSquared(px: number, py: number): number;
/**
* This static method returns the square of the distance from the point P to the point Q.
* @param {number} px
* @param {number} py
* @param {number} qx
* @param {number} qy
*/
static distanceSquared(px: number, py: number, qx: number, qy: number): number;
/**
* Returns the square of the distance from this Point to a given Point.
* @param {Point} p the other Point to measure to.
*/
distanceSquaredPoint(p: Point): number;
/**
* Indicates whether the given Point is equal to this Point.
* @param {Point} p The Point to compare to the current Point.
* false otherwise.
*/
equals(p: Point): boolean;
/**
* Indicates whether the given point (x, y) is equal to this Point.
* @param {number} x
* @param {number} y
* false otherwise.
*/
equalTo(x: number, y: number): boolean;
/**
* True if this Point has X and Y values that are real numbers and not infinity.
*/
isReal(): boolean;
/**
* Modify this Point so that its X and Y values have been normalized to a unit length.
* However, if this Point is the origin (zero, zero), its length remains zero.
*/
normalize(): Point;
/**
* Modify this point by shifting its values with the given DX and DY offsets.
* @param {number} dx
* @param {number} dy
*/
offset(dx: number, dy: number): Point;
/**
* This static method can be used to read in a Point from a string that was produced by Point.stringify.
* @param {string} str
*/
static parse(str: string): Point;
/**
* Modify this Point so that has been rotated about the origin by the given angle.
* @param {number} angle an angle in degrees.
*/
rotate(angle: number): Point;
/**
* Modify this Point so that its X and Y values have been scaled by given factors along the X and Y axes.
* @param {number} sx
* @param {number} sy
*/
scale(sx: number, sy: number): Point;
/**
* Modify this Point so that its X and Y values are the same as the given Point.
*
* @param {Point} p the given Point.
*/
set(p: Point): Point;
/**
* Modify this Point so that its X and Y values correspond to a particular Spot
* in a given Rect.
* The result is meaningless if Spot#isNoSpot is true for the given Spot.
* @param {Rect} r the Rect for which we are finding the point.
* @param {Spot} spot the Spot; Spot#isSpot must be true for this Spot.
*/
setRectSpot(r: Rect, spot: Spot): Point;
/**
* Modify this Point so that its X and Y values correspond to a particular Spot
* in a given rectangle.
* The result is meaningless if Spot#isNoSpot is true for the given Spot.
* @param {number} x The X coordinate of the Rect for which we are finding the point.
* @param {number} y The Y coordinate of the Rect for which we are finding the point.
* @param {number} w The Width of the Rect for which we are finding the point.
* @param {number} h The Height of the Rect for which we are finding the point.
* @param {Spot} spot the Spot; Spot#isSpot must be true for this Spot.
*/
setSpot(x: number, y: number, w: number, h: number, spot: Spot): Point;
/**
* Modify this Point with new X and Y values.
* @param {number} x
* @param {number} y
*/
setTo(x: number, y: number): Point;
/**
* This static method can be used to write out a Point as a string that can be read by Point.parse.
* @param {Point} val
*/
static stringify(val: Point): string;
/**
* Modify this point so that is the difference of this Point and the
* x and y co-ordinates of the given Point.
* @param {Point} p The Point to subtract from the current Point.
*/
subtract(p: Point): Point;
}
/**
* A Rect describes a rectangular two-dimensional area as a top-left point (x and y values)
* and a size (width and height values).
*/
class Rect {
/**
* The default constructor (no argument) results in a Rect(0,0,0,0).
*/
constructor();
/**
* The constructor taking two Points produces a Rect that spans both points.
* @param {Point} tl Top-left Point
* @param {Point} br Bottom-right Point
*/
constructor(tl: Point, br: Point);
/**
* The constructor taking a Point and a Size produces a Rect at that point with that size.
* @param {Point} tl Top-left Point
* @param {Point} sz Size
*/
constructor(tl: Point, sz: Size);
/**
* The four-argument constructor takes four numbers for the x, y, width, height.
* @param {number} x Top-left x value.
* @param {number} y Top-left y value.
* @param {number} w Width to be used; must be non-negative.
* @param {number} h Height to be used; must be non-negative.
*/
constructor(x: number, y: number, w: number, h: number);
/**Gets or sets the y-axis value of the bottom of the Rect.*/
bottom: number;
/**Gets or sets the Point at the center of this Rect.*/
center: Point;
/**Gets or sets the horizontal center X coordinate of the Rect.*/
centerX: number;
/**Gets or sets the vertical center Y coordinate of the Rect.*/
centerY: number;
/**Gets or sets the height of the Rect.*/
height: number;
/**Gets or sets the leftmost value of the Rect.*/
left: number;
/**Gets or sets the x- and y-axis position of the Rect as a Point.*/
position: Point;
/**Gets or sets the x-axis value of the right of the Rect.*/
right: number;
/**Gets or sets the width and height of the Rect as a Size.*/
size: Size;
/**Gets or sets the topmost value of the Rect.*/
top: number;
/**Gets or sets the width of the Rect.*/
width: number;
/**Gets or sets the top-left x coordinate of the Rect.*/
x: number;
/**Gets or sets the top-left y coordinate of the Rect.*/
y: number;
/**
* Modify this Rect by adding the given Margin to each side of the Rect.
* @param {Margin} m The Margin to add to the Rect.
*/
addMargin(m: Margin): Rect;
/**
* Indicates whether this Rect contains the given Point/Rect.
* @param {number} x The X coordinate of the Point or Rect to include in the new bounds.
* @param {number} y The Y coordinate of the Point or Rect to include in the new bounds.
* @param {number=} w The Width of the Rect to include in the new bounds, defaults to zero.
* @param {number=} h The Height of the Rect to include in the new bounds, defaults to zero.
* false otherwise.
*/
contains(x: number, y: number, w?: number, h?: number): boolean;
/**
* This static method indicates whether a Rect contains the given Point/Rect.
* @param {number} rx The X coordinate of a Rect.
* @param {number} ry The Y coordinate of a Rect.
* @param {number} rw The Width of a Rect.
* @param {number} rh The Height of a Rect.
* @param {number} x The X coordinate of the Point or Rect that might be in the bounds (RX, RY, RW, RH).
* @param {number} y The Y coordinate of the Point or Rect that might be in the bounds (RX, RY, RW, RH).
* @param {number=} w The Width of the Rect to include in the new bounds, defaults to zero.
* @param {number=} h The Height of the Rect to include in the new bounds, defaults to zero.
* false otherwise.
*/
static contains(rx: number, ry: number, rw: number, rh: number, x: number, y: number, w?: number, h?: number): boolean;
/**
* Indicates whether this Rect contains the given Point.
* @param {Point} p The Point to check.
* false otherwise.
*/
containsPoint(p: Point): boolean;
/**
* Indicates whether this Rect contains the given Rect.
* @param {Rect} r The Rect to check.
* false otherwise.
*/
containsRect(r: Rect): boolean;
/**
* Create a copy of this Rect, with the same values.
*/
copy(): Rect;
/**
* Indicates whether the given Rect is equal to the current Rect.
* @param {Rect} r The rectangle to compare to the current rectangle.
* and height.
*/
equals(r: Rect): boolean;
/**
* Indicates whether the given Rect is equal to the current Rect.
* @param {number} x
* @param {number} y
* @param {number} w the width.
* @param {number} h the height.
*/
equalTo(x: number, y: number, w: number, h: number): boolean;
/**
* Modifies this Rect by adding some distance to each side of the Rect.
* @param {number} t the amount to move the top side upwards; may be negative.
* @param {number} r the amount to move the right side rightwards; may be negative.
* @param {number} b the amount to move the bottom side downwards; may be negative.
* @param {number} l the amount to move the left side leftwards; may be negative.
*/
grow(t: number, r: number, b: number, l: number): Rect;
/**
* Modify this Rect so that its width and height are changed on all four sides,
* equally on the left and right sides, and equally on the top and bottom sides.
* When the arguments are negative, this operation deflates this Rect, but not beyond zero.
* @param {number} w The additional width on each side, left and right; may be negative.
* @param {number} h The additional height on each side, top and bottom; may be negative.
*/
inflate(w: number, h: number): Rect;
/**
* Modify this Rect so that it is the intersection of this Rect and the rectangle
* defined by x, y, w, h.
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
*/
intersect(x: number, y: number, w: number, h: number): Rect;
/**
* Modify this Rect so that it is the intersection of this Rect and the given Rect.
* @param {Rect} r Rect to intersect with.
*/
intersectRect(r: Rect): Rect;
/**
* This static method indicates whether a Rect partly or wholly overlaps the given Rect.
* @param {number} rx The X coordinate of a Rect.
* @param {number} ry The Y coordinate of a Rect.
* @param {number} rw The Width of a Rect.
* @param {number} rh The Height of a Rect.
* @param {number} x The X coordinate of the Point or Rect that might overlap the bounds (RX, RY, RW, RH).
* @param {number} y The Y coordinate of the Point or Rect that might overlap the bounds (RX, RY, RW, RH).
* @param {number} w
* @param {number} h
*/
static intersects(rx: number, ry: number, rw: number, rh: number, x: number, y: number, w: number, h: number): boolean;
/**
* Determine if this Rect partly or wholly overlaps the rectangle
* defined by x, y, w, h.
* @param {number} x
* @param {number} y
* @param {number} w
* @param {number} h
*/
intersects(x: number, y: number, w: number, h: number): boolean;
/**
* Determine if a given Rect is partly or wholly inside of this Rect.
* @param {Rect} r Rect to test intersection with.
*/
intersectsRect(r: Rect): boolean;
/**
* True if this Rect has a Width and Height of zero.
*/
isEmpty(): boolean;
/**
* True if this Rect has X, Y, Width, and Height values that are real numbers and not infinity.
*/
isReal(): boolean;
/**
* Modify this Rect by shifting its values with the given DX and DY offsets.
* @param {number} dx
* @param {number} dy
*/
offset(dx: number, dy: number): Rect;
/**
* This static method can be used to read in a Rect from a string that was produced by Rect.stringify.
* @param {string} str
*/
static parse(str: string): Rect;
/**
* Modify this Rect so that its X, Y, Width, and Height values are the same as the given Rect.
* @param {Rect} r the given Rect.
*/
set(r: Rect): Rect;
/**
* Modify this Rect so that its X and Y values are the same as the given Point.
* @param {Point} p the given Point.
*/
setPoint(p: Point): Rect;
/**
* Modify this Rect so that its Width and Height values are the same as the given Size.
* @param {Size} s the given Size.
*/
setSize(s: Size): Rect;
/**
* Modify this Rect so that a given Spot is at a given (x,y) point using this Rect's size.
* Return this rectangle for which the spot is at that point, without modifying the size.
* The result is meaningless if Spot#isNoSpot is true.
* @param {number} x the point where the spot should be.
* @param {number} y the point where the spot should be.
* @param {Spot} spot a Spot; Spot#isSpot must be true.
*/
setSpot(x: number, y: number, spot: Spot): Rect;
/**
* Modify this Rect with new X, Y, Width, and Height values.
* @param {number} x
* @param {number} y
* @param {number} w the width.
* @param {number} h the height.
*/
setTo(x: number, y: number, w: number, h: number): Rect;
/**
* This static method can be used to write out a Rect as a string that can be read by Rect.parse.
* @param {Rect} val
*/
static stringify(val: Rect): string;
/**
* Modify this Rect by subtracting the given Margin from each side of the Rect.
* @param {Margin} m The Margin to subtract from the Rect.
*/
subtractMargin(m: Margin): Rect;
/**
* Modify this Rect to be exactly big enough to contain both the original Rect and the given rectangular area.
* @param {number} x The X coordinate of the Point or Rect to include in the new bounds.
* @param {number} y The Y coordinate of the Point or Rect to include in the new bounds.
* @param {number=} w The Width of the Rect to include in the new bounds, defaults to zero.
* @param {number=} h The Height of the Rect to include in the new bounds, defaults to zero.
*/
union(x: number, y: number, w?: number, h?: number): Rect;
/**
* Modify this Rect to be exactly big enough to contain both the original Rect and the given Point.
* @param {Point} p The Point to include in the new bounds.
*/
unionPoint(p: Point): Rect;
/**
* Modify this Rect to be exactly big enough to contain this Rect and the given Rect.
*
* @param {Rect} r The Rect to include in the new bounds.
*/
unionRect(r: Rect): Rect;
}
/**
* A Size describes a width and a height in two-dimensional coordinates.
* The width and height must both be non-negative.
*/
class Size {
/**
* The default constructor produces the Size(0,0).
*/
constructor();
/**
* The two-argument constructor produces the Size(w,h).
* @param {number} w this number must not be negative.
* @param {number} h this number must not be negative.
*/
constructor(w: number, h: number);
/**Gets or sets the height value of the Size.*/
height: number;
/**Gets or sets the width value of the Size.*/
width: number;
/**
* Create a copy of this Size, with the same values.
*/
copy(): Size;
/**
* Indicates whether the given Size is equal to the current Size.
* @param {Size} s The Size to compare to the current Size.
* false otherwise.
*/
equals(s: Size): boolean;
/**
* Indicates whether the given size is equal to this Size.
* @param {number} w the width.
* @param {number} h the height.
* false otherwise.
*/
equalTo(w: number, h: number): boolean;
/**
* True if this Size has Width and Height values that are real numbers and not infinity.
*/
isReal(): boolean;
/**
* This static method can be used to read in a Size from a string that was produced by Size.stringify.
* @param {string} str
*/
static parse(str: string): Size;
/**
* Modify this Size so that its Width and Height values are the same as the given Size.
* @param {Size} s the given Size.
*/
set(s: Size): Size;
/**
* Modify this Size with new Width and Height values.
* @param {number} w the width.
* @param {number} h the height.
*/
setTo(w: number, h: number): Size;
/**
* This static method can be used to write out a Size as a string that can be read by Size.parse.
* @param {Size} val
*/
static stringify(val: Size): string;
}
/**
* A Spot represents a relative point from(0, 0) to(1, 1) within the bounds of
* a rectangular area plus an absolute offset.
*/
class Spot {
/**
* The default constructor produces the Spot(0, 0, 0, 0), at the top-left corner.
*/
constructor();
/**
* The two-argument constructor produces the Spot(x, y), where X and Y are fractional distances, between zero and one.
* @param {number} x must be between zero and one, inclusive.
* @param {number} y must be between zero and one, inclusive.
*/
constructor(x: number, y: number);
/**
* The four-argument constructor produces the Spot(x, y, offx, offy), where X and Y are fractional distances, between zero and one, and OFFX and OFFY are additional absolute offsets.
* @param {number} x must be between zero and one, inclusive.
* @param {number} y must be between zero and one, inclusive.
* @param {number} offx an offset along the X coordinates, may be negative.
* @param {number} offy an offset along the Y coordinates, may be negative.
*/
constructor(x: number, y: number, offx: number, offy: number);
/**Gets or sets the offsetX value of the Spot.*/
offsetX: number;
/**Gets or sets the offsetY value of the Spot.*/
offsetY: number;
/**Gets or sets the x value of the Spot, a fractional value between zero and one.*/
x: number;
/**Gets or sets the y value of the Spot, a fractional value between zero and one.*/
y: number;
/**
* Create a copy of this Spot, with the same values.
*/
copy(): Spot;
/**
* Two spots are equal if all four property values are the same.
* @param {Spot} spot The Spot to compare to the current Spot.
*/
equals(spot: Spot): boolean;
/**
* This predicate is true if this Spot is a side that
* includes the side(s) given by the argument Spot.
* @param {Spot} side
*/
includesSide(side: Spot): boolean;
/**
* True if this is a special spot referring to the default spot.
*/
isDefault(): boolean;
/**
* True if this is an unspecific special spot, such as Spot#None or one of the sides.
*/
isNoSpot(): boolean;
/**
* True if this is a special spot referring to one (or more) of the sides.
*/
isSide(): boolean;
/**
* True if this is a specific spot, not a side nor Spot#None.
*/
isSpot(): boolean;
/**
* Return a new spot that is opposite this spot.
*/
opposite(): Spot;
/**
* This static method can be used to read in a Spot from a string that was produced by Spot.stringify.
* @param {string} str
*/
static parse(str: string): Spot;
/**
* Modify this Spot so that its X, Y, OffsetX, and OffsetY values are the same as the given Spot.
* @param {Spot} s the given Spot.
*/
set(s: Spot): Spot;
/**
* Modify this Spot with new X, Y, OffsetX, and OffsetY values.
* @param {number} x
* @param {number} y
* @param {number} offx
* @param {number} offy
*/
setTo(x: number, y: number, offx: number, offy: number): Spot;
/**
* This static method can be used to write out a Spot as a string that can be read by Spot.parse.
* @param {Spot} val
*/
static stringify(val: Spot): string;
/**The set of points on all sides of the bounding rectangle.*/
static AllSides: Spot;
/**A synonym for Spot#BottomCenter.*/
static Bottom: Spot;
/**The specific point at the middle of the bottom side of bounding rectangle.*/
static BottomCenter: Spot;
/**The specific point at the bottom-left corner of the bounding rectangle.*/
static BottomLeft: Spot;
/**The set of points at the left or bottom sides of the bounding rectangle.*/
static BottomLeftSides: Spot;
/**The specific point at the bottom-right corner of the bounding rectangle.*/
static BottomRight: Spot;
/**The set of points at the right or bottom sides of the bounding rectangle.*/
static BottomRightSides: Spot;
/**The set of points at the bottom side of the bounding rectangle.*/
static BottomSide: Spot;
/**The specific point at the very center of the bounding rectangle.*/
static Center: Spot;
/**Use this value to indicate that the real spot value is inherited from elsewhere.*/
static Default: Spot;
/**A synonym for Spot#LeftCenter.*/
static Left: Spot;
/**The specific point at the middle of the left side of bounding rectangle.*/
static LeftCenter: Spot;
/**The set of points at the left or right sides of the bounding rectangle.*/
static LeftRightSides: Spot;
/**The set of points at the left side of the bounding rectangle.*/
static LeftSide: Spot;
/**A synonym for Spot#BottomCenter.*/
static MiddleBottom: Spot;
/**A synonym for Spot#LeftCenter.*/
static MiddleLeft: Spot;
/**A synonym for Spot#RightCenter.*/
static MiddleRight: Spot;
/**A synonym for Spot#TopCenter.*/
static MiddleTop: Spot;
/**Use this Spot value to indicate no particular spot -- code looking for a particular point on an element will need to do their own calculations to determine the desired point depending on the circumstances.*/
static None: Spot;
/**The set of points on all sides of bounding rectangle except bottom side.*/
static NotBottomSide: Spot;
/**The set of points on all sides of the bounding rectangle except left side.*/
static NotLeftSide: Spot;
/**The set of points on all sides of the bounding rectangle except right side.*/
static NotRightSide: Spot;
/**The set of points on all sides of the bounding rectangle except top side.*/
static NotTopSide: Spot;
/**A synonym for Spot#RightCenter.*/
static Right: Spot;
/**The specific point at the middle of the right side of bounding rectangle.*/
static RightCenter: Spot;
/**The set of points at the right side of the bounding rectangle.*/
static RightSide: Spot;
/**A synonym for Spot#TopCenter.*/
static Top: Spot;
/**The set of points at the top or bottom sides of the bounding rectangle.*/
static TopBottomSides: Spot;
/**The specific point at the center of the top side of the bounding rectangle.*/
static TopCenter: Spot;
/**The specific point at the top-left corner of the bounding rectangle.*/
static TopLeft: Spot;
/**The set of points at the top or left sides of the bounding rectangle.*/
static TopLeftSides: Spot;
/**The specific point at the top-right corner of the bounding rectangle.*/
static TopRight: Spot;
/**The set of points at the top or right sides of the bounding rectangle.*/
static TopRightSides: Spot;
/**The set of points at the top side of the bounding rectangle.*/
static TopSide: Spot;
}
/**
* A Binding describes how to automatically set a property on a GraphObject}
* to a value of a property of data in the model.
* The target property name and the data source property name are strings.
* All name matching is case-sensitive.
*/
class Binding {
/**
* The constructor creates an empty one-way binding.
* @param {string=} targetprop A string naming the target property on the target object.
* If this is the empty string or not supplied, the whole GraphObject is used in the call to the conversion function,
* which should modify the GraphObject directly.
* @param {string=} sourceprop A string naming the source property on the bound data object.
* If this is the empty string, the whole Panel.data object is used.
* If this argument is not supplied, the source property is assumed to be the same as the target property.
* @param {function(*,*=) | null=} conv A function converting the data property value to the value to set the target property.
* If the function is null or not supplied, no conversion takes place.
*/
constructor(targetprop?: string, sourceprop?: string, conv?: (a: any, b?: any) => any);
/**Gets or sets a converter function to apply to the GraphObject property value in order to produce the value to set to a data property.*/
backConverter: (a: any, b?: any) => any;
/**Gets or sets a converter function to apply to the data property value in order to produce the value to set to the target property.*/
converter: (a: any, b?: any) => any;
/**Gets or sets the directions and frequency in which the binding may be evaluated.*/
mode: EnumValue;
/**Gets or sets the name of the GraphObject that should act as a source object whose property should be gotten by this data binding.*/
sourceName: string;
/**Gets or sets the name of the property to get from the bound data object, the value of Panel#data.*/
sourceProperty: string;
/**Gets or sets the name of the property to be set on the target GraphObject.*/
targetProperty: string;
/**
* Modify this Binding to set its #mode to be Binding#TwoWay, and
* provide an optional conversion function to convert GraphObject property
* values back to data values.
*
* You should not have a TwoWay binding on a node data object's key property.
* @param {function(*,*=) | null=} backconv
*/
makeTwoWay(backconv?: (a: any, b?: any) => any): Binding;
/**
* Modify this Binding to set its #sourceName property so as to identify
* a GraphObject in the visual tree of the bound Panel.
* @param {string=} srcname the GraphObject#name of an element in the visual tree of the bound Panel;
* use an empty string to refer to the root panel of that visual tree.
*/
ofObject(srcname?: string): Binding;
/**
* This static method can be used to create a function that parses a string into an enumerated value, given the class that the enumeration values are defined on and a default value if the string cannot be parsed successfully.
*/
static parseEnum(ctor: new(...args: any[]) => Object, defval: EnumValue): (a: string) => EnumValue;
/**
* This static method can be used to convert an object to a string, looking for commonly defined data properties, such as "text", "name", "key", or "id".
*/
static toString(val: any): string;
/**This value for Binding#mode uses data source values and sets GraphObject properties.*/
static OneWay: EnumValue;
/**This value for Binding#mode uses data source values and GraphObject properties and keeps them in sync.*/
static TwoWay: EnumValue;
}
/**
* A ChangedEvent represents a change to an object, typically a GraphObject,
* but also for model data, a Model, or a Diagram.
* The most common case is for remembering the name of a property
* and the before-and-after values for that property.
* You can listen for changed events on the model using Model#addChangedListener
* and on the Diagram using Diagram#addChangedListener.
*/
class ChangedEvent {
/**
* The ChangedEvent class constructor produces an empty ChangedEvent object.
*/
constructor();
/**Gets or sets the nature of change that occurred.*/
change: EnumValue;
/**Gets or sets the Diagram that was modified.*/
diagram: Diagram;
/**Gets or sets the Model or TreeModel or GraphLinksModel that was modified.*/
model: Model;
/**Gets the name of the model change, reflecting a change to model data in addition to a change to the model itself.*/
modelChange: string;
/**Gets or sets an optional value associated with the new value.*/
newParam: any;
/**Gets or sets the next or current value that the property has.*/
newValue: any;
/**Gets or sets the Object that was modified.*/
object: Object;
/**Gets or sets an optional value associated with the old value.*/
oldParam: any;
/**Gets or sets the previous or old value that the property had.*/
oldValue: any;
/**Gets or sets the name of the property change.*/
propertyName: any;
/**
* This predicate returns true if you can call redo().
*/
canRedo(): boolean;
/**
* This predicate returns true if you can call undo().
*/
canUndo(): boolean;
/**
* Forget any object references that this ChangedEvent may have.
*/
clear();
/**
* Make a copy of this ChangedEvent.
*/
copy(): ChangedEvent;
/**
* This is a convenient method to get the right parameter value, depending on the value of undo,
* when implementing a state change as part of an undo or a redo.
* @param {boolean} undo If true, returns the oldParam, otherwise returns the newParam.
*/
getParam(undo: boolean): any;
/**
* This is a convenient method to get the right value, depending on the value of undo,
* when implementing a state change as part of an undo or a redo.
* @param {boolean} undo If true, returns the oldValue, otherwise returns the newValue.
*/
getValue(undo: boolean): any;
/**
* Re-perform this object change after an undo().
*/
redo();
/**
* Reverse the effects of this object change.
*/
undo();
/**For inserting into collections, and used as the value for ChangedEvent#change.*/
static Insert: EnumValue;
/**For simple property changes, and used as the value for ChangedEvent#change.*/
static Property: EnumValue;
/**For removing from collections, and used as the value for ChangedEvent#change.*/
static Remove: EnumValue;
/**For informational events, such as transactions and undo/redo operations, and used as the value for ChangedEvent#change.*/
static Transaction: EnumValue;
}
/**
* GraphLinksModels support links between nodes and grouping nodes and links into subgraphs.
* GraphLinksModels hold node data and link data in separate arrays.
* Node data is normally represented in a Diagram by instances of Node,
* but they could be represented by simple Parts or by Groups.
* Link data should be represented by instances of Link.
*/
class GraphLinksModel extends Model {
/**
* This constructs an empty GraphLinksModel unless one provides arguments as the initial data array values for the Model#nodeDataArray and GraphLinksModel#linkDataArray properties.
* @param {Array=} nodedataarray an optional Array containing JavaScript objects to be represented by Nodes.
* @param {Array=} linkdataarray an optional Array containing JavaScript objects to be represented by Links.
*/
constructor(nodedataarray?: Array