Open AleksiAleksiev opened 5 years ago
@AleksiAleksiev thanks for sharing your use case. I'd be happy to help review a DefinitelyTyped package for visjs-network if you create one or see one emerge from the community.
we do have a fork of DefinitelyTyped in the visjs-community org - I think that @avrahamcool is interested in this as well: https://github.com/visjs-community/DefinitelyTyped
Yes. this is highly recommended, and not just for TS users. but it's really hard to maintain those types when they are separated from the project itself.
what is the best way moving forward?
I'm going to sound crazy here, Isn't it best if we migrate vis to TS completely? there are ton's of weird behavior in vis that would be avoided if types were used?
@avrahamcool not so crazy. I've also thought about migrating the whole project to TypeScript.
It would introduce a small barrier to new contributors (must learn something about TS in order to contribute). That said, the benefits of type safety and overall stability are probably worth the extra friction.
My suggestion for a path forward would be:
1) open a PR that adds all the TypeScript tooling, and types a small number of files, while marking the rest as any
(basically un-typed, for now)
2) review and merge that PR
3) gradually add types, to the functions and files that lack them
I also wonder if a practical prerequisite to adopting TypeScript for this project is to migrate from gulp to a modern js bundler like webpack. I'm willing to consider TS with our existing gulp setup, but I have a feeling that we would hit some difficulties pretty quickly.
(some TS plugin we need that is only available for webpack, or some compile-time step that is difficult to implement with gulp)
This is something I actually tried to do prior to the project splitting... that is, using https://www.npmjs.com/package/tsd-jsdoc to auto-generate the index.ts file - Then, the maintenance burden is really just maintaining proper jsdoc annotations and having a build step for generating the index.ts file.
oh interesting, that is good to know @macleodbroad-wf . Curious, did you get very far? is there a branch around somewhere with that effort?
I've been using TypeScript in some of my other projects recently, and been thinking more about adopting it here for visjs-network.
Running these commands
npm install -g tsd-jsdoc
jsdoc -t /usr/local/lib/node_modules/tsd-jsdoc/dist -r ./lib --debug
produces the following in out/types.d.ts
/**
* Ensures that all elements are removed first up so they can be recreated cleanly
* @param {Object} JSONcontainer
*/
declare function resetElements(JSONcontainer: any): void;
/**
* Allocate or generate an SVG element if needed. Store a reference to it in the JSON container and draw it in the svgContainer
* the JSON container and the SVG container have to be supplied so other svg containers (like the legend) can use this.
*
* @param {string} elementType
* @param {Object} JSONcontainer
* @param {Element} DOMContainer
* @param {Element} insertBefore
* @returns {*}
*/
declare function getDOMElement(elementType: string, JSONcontainer: any, DOMContainer: Element, insertBefore: Element): any;
/**
* Draw a point object. This is a separate function because it can also be called by the legend.
* The reason the JSONcontainer and the target SVG svgContainer have to be supplied is so the legend can use these functions
* as well.
*
* @param {number} x
* @param {number} y
* @param {Object} groupTemplate: A template containing the necessary information to draw the datapoint e.g., {style: 'circle', size: 5, className: 'className' }
* @param {Object} JSONcontainer
* @param {Object} svgContainer
* @param {Object} labelObj
* @returns {vis.PointItem}
*/
declare function drawPoint(x: number, y: number, groupTemplate:: any, JSONcontainer: any, svgContainer: any, labelObj: any): vis.PointItem;
/**
* draw a bar SVG element centered on the X coordinate
*
* @param {number} x
* @param {number} y
* @param {number} width
* @param {number} height
* @param {string} className
* @param {Object} JSONcontainer
* @param {Object} svgContainer
* @param {string} style
*/
declare function drawBar(x: number, y: number, width: number, height: number, className: string, JSONcontainer: any, svgContainer: any, style: string): void;
/**
* DataSet
* // TODO: add a DataSet constructor DataSet(data, options)
*
* Usage:
* var dataSet = new DataSet({
* fieldId: '_id',
* type: {
* // ...
* }
* });
*
* dataSet.add(item);
* dataSet.add(data);
* dataSet.update(item);
* dataSet.update(data);
* dataSet.remove(id);
* dataSet.remove(ids);
* var data = dataSet.get();
* var data = dataSet.get(id);
* var data = dataSet.get(ids);
* var data = dataSet.get(ids, options, data);
* dataSet.clear();
*
* A data set can:
* - add/remove/update data
* - gives triggers upon changes in the data
* - can import/export data in various data formats
*
* @param {Array} [data] Optional array with initial data
* @param {Object} [options] Available options:
* {string} fieldId Field name of the id in the
* items, 'id' by default.
* {Object.<string, string} type
* A map with field names as key,
* and the field type as value.
* {Object} queue Queue changes to the DataSet,
* flush them all at once.
* Queue options:
* - {number} delay Delay in ms, null by default
* - {number} max Maximum number of entries in the queue, Infinity by default
* @constructor DataSet
*/
declare class DataSet {
constructor(data?: Array, options?: any);
/**
* @param {Object} options Available options:
* {Object} queue Queue changes to the DataSet,
* flush them all at once.
* Queue options:
* - {number} delay Delay in ms, null by default
* - {number} max Maximum number of entries in the queue, Infinity by default
*/
setOptions(options: any): void;
/**
* Subscribe to an event, add an event listener
* @param {string} event Event name. Available events: 'add', 'update',
* 'remove'
* @param {function} callback Callback method. Called with three parameters:
* {string} event
* {Object | null} params
* {string | number} senderId
*/
on(event: string, callback: (...params: any[]) => any): void;
/**
* Unsubscribe from an event, remove an event listener
* @param {string} event
* @param {function} callback
*/
off(event: string, callback: (...params: any[]) => any): void;
/**
* Add data.
* Adding an item will fail when there already is an item with the same id.
* @param {Object | Array} data
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} addedIds Array with the ids of the added items
*/
add(data: any | Array, senderId?: string): (string | number)[];
/**
* Update existing items. When an item does not exist, it will be created
* @param {Object | Array} data
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} updatedIds The ids of the added or updated items
* @throws {Error} Unknown Datatype
*/
update(data: any | Array, senderId?: string): (string | number)[];
/**
* Get a data item or multiple items.
*
* Usage:
*
* get()
* get(options: Object)
*
* get(id: number | string)
* get(id: number | string, options: Object)
*
* get(ids: number[] | string[])
* get(ids: number[] | string[], options: Object)
*
* Where:
*
* {number | string} id The id of an item
* {number[] | string{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {string} [returnType] Type of data to be returned.
* Can be 'Array' (default) or 'Object'.
* {Object.<string, string>} [type]
* {string[]} [fields] field names to be returned
* {function} [filter] filter items
* {string | function} [order] Order the items by a field name or custom sort function.
* @param {Array} args
* @returns {DataSet}
* @throws Error
*/
get(args: Array): DataSet;
/**
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array.<string|number>} ids
*/
getIds(options?: any): (string | number)[];
/**
* Returns the DataSet itself. Is overwritten for example by the DataView,
* which returns the DataSet it is connected to instead.
* @returns {DataSet}
*/
getDataSet(): DataSet;
/**
* Execute a callback function for every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
*/
forEach(callback: (...params: any[]) => any, options?: any): void;
/**
* Map every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Object[]} mappedItems
*/
map(callback: (...params: any[]) => any, options?: any): object[];
/**
* Remove an object by pointer or by id
* @param {string | number | Object | Array.<string|number>} id Object or id, or an array with
* objects or ids to be removed
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} removedIds
*/
remove(id: string | number | any | (string | number)[], senderId?: string): (string | number)[];
/**
* Clear the data
* @param {string} [senderId] Optional sender id
* @return {Array.<string|number>} removedIds The ids of all removed items
*/
clear(senderId?: string): (string | number)[];
/**
* Find the item with maximum value of a specified field
* @param {string} field
* @return {Object | null} item Item containing max value, or null if no items
*/
max(field: string): any | null;
/**
* Find the item with minimum value of a specified field
* @param {string} field
* @return {Object | null} item Item containing max value, or null if no items
*/
min(field: string): any | null;
/**
* Find all distinct values of a specified field
* @param {string} field
* @return {Array} values Array containing all distinct values. If data items
* do not contain the specified field are ignored.
* The returned array is unordered.
*/
distinct(field: string): Array;
}
/**
* DataView
*
* a dataview offers a filtered view on a dataset or an other dataview.
*
* @param {DataSet | DataView} data
* @param {Object} [options] Available options: see method get
*
* @constructor DataView
*/
declare class DataView {
constructor(data: DataSet | DataView, options?: any);
/**
* Set a data source for the view
* @param {DataSet | DataView} data
*/
setData(data: DataSet | DataView): void;
/**
* Refresh the DataView. Useful when the DataView has a filter function
* containing a variable parameter.
*/
refresh(): void;
/**
* Get data from the data view
*
* Usage:
*
* get()
* get(options: Object)
* get(options: Object, data: Array | DataTable)
*
* get(id: Number)
* get(id: Number, options: Object)
* get(id: Number, options: Object, data: Array | DataTable)
*
* get(ids: Number[])
* get(ids: Number[], options: Object)
* get(ids: Number[], options: Object, data: Array | DataTable)
*
* Where:
*
* {number | string} id The id of an item
* {number[] | string{}} ids An array with ids of items
* {Object} options An Object with options. Available options:
* {string} [type] Type of data to be returned. Can
* be 'DataTable' or 'Array' (default)
* {Object.<string, string>} [convert]
* {string[]} [fields] field names to be returned
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
* {Array | DataTable} [data] If provided, items will be appended to this
* array or table. Required in case of Google
* DataTable.
* @param {Array} args
* @return {DataSet|DataView}
*/
get(args: Array): DataSet | DataView;
/**
* Get ids of all items or from a filtered set of items.
* @param {Object} [options] An Object with options. Available options:
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Array.<string|number>} ids
*/
getIds(options?: any): (string | number)[];
/**
* Map every item in the dataset.
* @param {function} callback
* @param {Object} [options] Available options:
* {Object.<string, string>} [type]
* {string[]} [fields] filter fields
* {function} [filter] filter items
* {string | function} [order] Order the items by
* a field name or custom sort function.
* @return {Object[]} mappedItems
*/
map(callback: (...params: any[]) => any, options?: any): object[];
/**
* Get the DataSet to which this DataView is connected. In case there is a chain
* of multiple DataViews, the root DataSet of this chain is returned.
* @return {DataSet} dataSet
*/
getDataSet(): DataSet;
}
/**
* A queue
* @param {Object} options
* Available options:
* - delay: number When provided, the queue will be flushed
* automatically after an inactivity of this delay
* in milliseconds.
* Default value is null.
* - max: number When the queue exceeds the given maximum number
* of entries, the queue is flushed automatically.
* Default value of max is Infinity.
* @constructor Queue
*/
declare class Queue {
constructor(options: any);
/**
* Update the configuration of the queue
* @param {Object} options
* Available options:
* - delay: number When provided, the queue will be flushed
* automatically after an inactivity of this delay
* in milliseconds.
* Default value is null.
* - max: number When the queue exceeds the given maximum number
* of entries, the queue is flushed automatically.
* Default value of max is Infinity.
*/
setOptions(options: any): void;
/**
* Extend an object with queuing functionality.
* The object will be extended with a function flush, and the methods provided
* in options.replace will be replaced with queued ones.
* @param {Object} object
* @param {Object} options
* Available options:
* - replace: Array.<string>
* A list with method names of the methods
* on the object to be replaced with queued ones.
* - delay: number When provided, the queue will be flushed
* automatically after an inactivity of this delay
* in milliseconds.
* Default value is null.
* - max: number When the queue exceeds the given maximum number
* of entries, the queue is flushed automatically.
* Default value of max is Infinity.
* @return {Queue} Returns the created queue
*/
static extend(object: any, options: any): Queue;
/**
* Destroy the queue. The queue will first flush all queued actions, and in
* case it has extended an object, will restore the original object.
*/
destroy(): void;
/**
* Replace a method on an object with a queued version
* @param {Object} object Object having the method
* @param {string} method The method name
*/
replace(object: any, method: string): void;
/**
* Queue a call
* @param {function | {fn: function, args: Array} | {fn: function, args: Array, context: Object}} entry
*/
queue(entry: ((...params: any[]) => any) | any | any): void;
/**
* Flush all queued calls
*/
flush(): void;
}
/**
* Register a touch event, taking place before a gesture
* @param {Hammer} hammer A hammer instance
* @param {function} callback Callback, called as callback(event)
*/
declare function onTouch(hammer: Hammer, callback: (...params: any[]) => any): void;
/**
* Register a release event, taking place after a gesture
* @param {Hammer} hammer A hammer instance
* @param {function} callback Callback, called as callback(event)
* @returns {*}
*/
declare function onRelease(hammer: Hammer, callback: (...params: any[]) => any): any;
/**
* Unregister a touch event, taking place before a gesture
* @param {Hammer} hammer A hammer instance
* @param {function} callback Callback, called as callback(event)
*/
declare function offTouch(hammer: Hammer, callback: (...params: any[]) => any): void;
/**
* Unregister a release event, taking place before a gesture
* @param {Hammer} hammer A hammer instance
* @param {function} callback Callback, called as callback(event)
*/
declare var offRelease: any;
/**
* Hack the PinchRecognizer such that it doesn't prevent default behavior
* for vertical panning.
*
* Yeah ... this is quite a hack ... see https://github.com/hammerjs/hammer.js/issues/932
*
* @param {Hammer.Pinch} pinchRecognizer
* @return {Hammer.Pinch} returns the pinchRecognizer
*/
declare function disablePreventDefaultVertically(pinchRecognizer: Hammer.Pinch): Hammer.Pinch;
/**
* Setup a mock hammer.js object, for unit testing.
*
* Inspiration: https://github.com/uber/deck.gl/pull/658
*
* @returns {{on: noop, off: noop, destroy: noop, emit: noop, get: get}}
*/
declare function hammerMock(): any;
/**
* This callback is a callback that accepts an Image.
* @callback ImageCallback
* @param {Image} image
*/
declare type ImageCallback = (image: Image) => void;
/**
* @param {ImageCallback} callback
*/
declare class Images {
constructor(callback: ImageCallback);
/**
* @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image
* @param {string} brokenUrl Url the broken image to try and load
* @param {Image} imageToLoadBrokenUrlOn The image object
*/
_tryloadBrokenUrl(url: string, brokenUrl: string, imageToLoadBrokenUrlOn: Image): void;
/**
* @param {string} url Url of the image
* @param {string} brokenUrl Url of an image to use if the url image is not found
* @return {Image} img The image object
*/
load(url: string, brokenUrl: string): Image;
}
/**
* Create a network visualization, displaying nodes and edges.
*
* @param {Element} container The DOM element in which the Network will
* be created. Normally a div element.
* @param {Object} data An object containing parameters
* {Array} nodes
* {Array} edges
* @param {Object} options Options
* @constructor Network
*/
declare class Network {
constructor(container: Element, data: any, options: any);
/**
* Set options
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Bind all events
*/
bindEventListeners(): void;
/**
* Set nodes and edges, and optionally options as well.
*
* @param {Object} data Object containing parameters:
* {Array | DataSet | DataView} [nodes] Array with nodes
* {Array | DataSet | DataView} [edges] Array with edges
* {String} [dot] String containing data in DOT format
* {String} [gephi] String containing data in gephi JSON format
* {Options} [options] Object with options
*/
setData(data: any): void;
/**
* Cleans up all bindings of the network, removing it fully from the memory IF the variable is set to null after calling this function.
* var network = new vis.Network(..);
* network.destroy();
* network = null;
*/
destroy(): void;
/**
* Returns true when the Network is active.
* @returns {boolean}
*/
isActive(): boolean;
/**
* Nodes can be in clusters. Clusters can also be in clusters. This function returns and array of
* nodeIds showing where the node is.
*
* If any nodeId in the chain, especially the first passed in as a parameter, is not present in
* the current nodes list, an empty array is returned.
*
* Example:
* cluster 'A' contains cluster 'B',
* cluster 'B' contains cluster 'C',
* cluster 'C' contains node 'fred'.
* `jsnetwork.clustering.findNode('fred')` will return `['A','B','C','fred']`.
*
* @param {string|number} nodeId
* @returns {Array}
*/
findNode(nodeId: string | number): Array;
/**
* This method will cluster all nodes with 1 edge with their respective connected node.
* The options object is explained in full <a data-scroll="" data-options="{ "easing": "easeInCubic" }" href="#optionsObject">below</a>.
*
* @param {object} [options]
* @returns {undefined}
*/
clusterOutliers(options?: any): undefined;
}
/**
* Containers for nodes and edges.
*
* 'edges' and 'nodes' contain the full definitions of all the network elements.
* 'nodeIndices' and 'edgeIndices' contain the id's of the active elements.
*
* The distinction is important, because a defined node need not be active, i.e.
* visible on the canvas. This happens in particular when clusters are defined, in
* that case there will be nodes and edges not displayed.
* The bottom line is that all code with actions related to visibility, *must* use
* 'nodeIndices' and 'edgeIndices', not 'nodes' and 'edges' directly.
*/
declare var body: any;
/**
* Parse a text source containing data in DOT language into a JSON object.
* The object contains two lists: one with nodes and one with edges.
*
* DOT language reference: http://www.graphviz.org/doc/info/lang.html
*
* DOT language attributes: http://graphviz.org/content/attrs
*
* @param {string} data Text containing a graph in DOT-notation
* @return {Object} graph An object containing two parameters:
* {Object[]} nodes
* {Object[]} edges
*
* -------------------------------------------
* TODO
* ====
*
* For label handling, this is an incomplete implementation. From docs (quote #3015):
*
* > the escape sequences "\n", "\l" and "\r" divide the label into lines, centered,
* > left-justified, and right-justified, respectively.
*
* Source: http://www.graphviz.org/content/attrs#kescString
*
* > As another aid for readability, dot allows double-quoted strings to span multiple physical
* > lines using the standard C convention of a backslash immediately preceding a newline
* > character
* > In addition, double-quoted strings can be concatenated using a '+' operator.
* > As HTML strings can contain newline characters, which are used solely for formatting,
* > the language does not allow escaped newlines or concatenation operators to be used
* > within them.
*
* - Currently, only '\\n' is handled
* - Note that text explicitly says 'labels'; the dot parser currently handles escape
* sequences in **all** strings.
*/
declare function parseDOT(data: string): any;
/**
* Get the first character from the dot file.
* The character is stored into the char c. If the end of the dot file is
* reached, the function puts an empty string in c.
*/
declare function first(): void;
/**
* Get the next character from the dot file.
* The character is stored into the char c. If the end of the dot file is
* reached, the function puts an empty string in c.
*/
declare function next(): void;
/**
* Preview the next character from the dot file.
* @return {string} cNext
*/
declare function nextPreview(): string;
/**
* Test whether given character is alphabetic or numeric
* @param {string} c
* @return {Boolean} isAlphaNumeric
*/
declare function isAlphaNumeric(c: string): boolean;
/**
* Merge all options of object b into object b
* @param {Object} a
* @param {Object} b
* @return {Object} a
*/
declare function merge(a: any, b: any): any;
/**
* Set a value in an object, where the provided parameter name can be a
* path with nested parameters. For example:
*
* var obj = {a: 2};
* setValue(obj, 'b.c', 3); // obj = {a: 2, b: {c: 3}}
*
* @param {Object} obj
* @param {string} path A parameter name or dot-separated parameter path,
* like "color.highlight.border".
* @param {*} value
*/
declare function setValue(obj: any, path: string, value: any): void;
/**
* Add a node to a graph object. If there is already a node with
* the same id, their attributes will be merged.
* @param {Object} graph
* @param {Object} node
*/
declare function addNode(graph: any, node: any): void;
/**
* Add an edge to a graph object
* @param {Object} graph
* @param {Object} edge
*/
declare function addEdge(graph: any, edge: any): void;
/**
* Create an edge to a graph object
* @param {Object} graph
* @param {string | number | Object} from
* @param {string | number | Object} to
* @param {string} type
* @param {Object | null} attr
* @return {Object} edge
*/
declare function createEdge(graph: any, from: string | number | any, to: string | number | any, type: string, attr: any | null): any;
/**
* Get next token in the current dot file.
* The token and token type are available as token and tokenType
*/
declare function getToken(): void;
/**
* Parse a graph.
* @returns {Object} graph
*/
declare function parseGraph(): any;
/**
* Parse a list with statements.
* @param {Object} graph
*/
declare function parseStatements(graph: any): void;
/**
* Parse a single statement. Can be a an attribute statement, node
* statement, a series of node statements and edge statements, or a
* parameter.
* @param {Object} graph
*/
declare function parseStatement(graph: any): void;
/**
* Parse a subgraph
* @param {Object} graph parent graph object
* @return {Object | null} subgraph
*/
declare function parseSubgraph(graph: any): any | null;
/**
* parse an attribute statement like "node [shape=circle fontSize=16]".
* Available keywords are 'node', 'edge', 'graph'.
* The previous list with default attributes will be replaced
* @param {Object} graph
* @returns {String | null} keyword Returns the name of the parsed attribute
* (node, edge, graph), or null if nothing
* is parsed.
*/
declare function parseAttributeStatement(graph: any): string | null;
/**
* parse a node statement
* @param {Object} graph
* @param {string | number} id
*/
declare function parseNodeStatement(graph: any, id: string | number): void;
/**
* Parse an edge or a series of edges
* @param {Object} graph
* @param {string | number} from Id of the from node
*/
declare function parseEdge(graph: any, from: string | number): void;
/**
* As explained in [1], graphviz has limitations for combination of
* arrow[head|tail] and dir. If attribute list includes 'dir',
* following cases just be supported.
* 1. both or none + arrowhead, arrowtail
* 2. forward + arrowhead (arrowtail is not affedted)
* 3. back + arrowtail (arrowhead is not affected)
* [1] https://www.graphviz.org/doc/info/attrs.html#h:undir_note
*
* This function is called from parseAttributeList() to parse 'dir'
* attribute with given 'attr_names' and 'attr_list'.
* @param {Object} attr_names Array of attribute names
* @param {Object} attr_list Array of objects of attribute set
* @return {Object} attr_list Updated attr_list
*/
declare function parseDirAttribute(attr_names: any, attr_list: any): any;
/**
* Parse a set with attributes,
* for example [label="1.000", shape=solid]
* @return {Object | null} attr
*/
declare function parseAttributeList(): any | null;
/**
* Create a syntax error with extra information on current token and index.
* @param {string} message
* @returns {SyntaxError} err
*/
declare function newSyntaxError(message: string): SyntaxError;
/**
* Chop off text after a maximum length
* @param {string} text
* @param {number} maxLength
* @returns {String}
*/
declare function chop(text: string, maxLength: number): string;
/**
* Execute a function fn for each pair of elements in two arrays
* @param {Array | *} array1
* @param {Array | *} array2
* @param {function} fn
*/
declare function forEach2(array1: Array | any, array2: Array | any, fn: (...params: any[]) => any): void;
/**
* Set a nested property on an object
* When nested objects are missing, they will be created.
* For example setProp({}, 'font.color', 'red') will return {font: {color: 'red'}}
* @param {Object} object
* @param {string} path A dot separated string like 'font.color'
* @param {*} value Value for the property
* @return {Object} Returns the original object, allows for chaining.
*/
declare function setProp(object: any, path: string, value: any): any;
/**
* Convert an object with DOT attributes to their vis.js equivalents.
* @param {Object} attr Object with DOT attributes
* @param {Object} mapping
* @return {Object} Returns an object with vis.js attributes
*/
declare function convertAttr(attr: any, mapping: any): any;
/**
* Convert a string containing a graph in DOT language into a map containing
* with nodes and edges in the format of graph.
* @param {string} data Text containing a graph in DOT-notation
* @return {Object} graphData
*/
declare function DOTToGraph(data: string): any;
/**
*
* @param {json} gephiJSON
* @param {obj} optionsObj
* @returns {{nodes: Array, edges: Array}}
*/
declare function parseGephi(gephiJSON: json, optionsObj: obj): any;
/**
* @param {Object} body
*/
declare class Canvas {
constructor(body: any);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Create the HTML
*/
_create(): void;
/**
* Set a new size for the network
* @param {string} width Width in pixels or percentage (for example '800px'
* or '50%')
* @param {string} height Height in pixels or percentage (for example '400px'
* or '30%')
* @returns {boolean}
*/
setSize(width: string, height: string): boolean;
/**
*
* @returns {CanvasRenderingContext2D}
*/
getContext(): CanvasRenderingContext2D;
/**
* Set the transform in the contained context, based on its pixelRatio
*/
setTransform(): void;
/**
* @param {point} pos
* @returns {point}
*/
canvasToDOM(pos: point): point;
/**
*
* @param {point} pos
* @returns {point}
*/
DOMtoCanvas(pos: point): point;
}
/**
* @param {Object} body
* @param {Canvas} canvas
*/
declare class CanvasRenderer {
constructor(body: any, canvas: Canvas);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Redraw the network with the current data
* chart will be resized too.
*/
redraw(): void;
}
/**
* @param {Object} body
*/
declare class ClusterEngine {
constructor(body: any);
/**
*
* @param {number} hubsize
* @param {Object} options
*/
clusterByHubsize(hubsize: number, options: any): void;
/**
* loop over all nodes, check if they adhere to the condition and cluster if needed.
* @param {Object} options
* @param {boolean} [refreshData=true]
*/
cluster(options: any, refreshData?: boolean): void;
/**
* Cluster all nodes in the network that have only X edges
* @param {number} edgeCount
* @param {Object} options
* @param {boolean} [refreshData=true]
*/
clusterByEdgeCount(edgeCount: number, options: any, refreshData?: boolean): void;
/**
* Cluster all nodes in the network that have only 1 edge
* @param {Object} options
* @param {boolean} [refreshData=true]
*/
clusterOutliers(options: any, refreshData?: boolean): void;
/**
* Cluster all nodes in the network that have only 2 edge
* @param {Object} options
* @param {boolean} [refreshData=true]
*/
clusterBridges(options: any, refreshData?: boolean): void;
/**
* suck all connected nodes of a node into the node.
* @param {Node.id} nodeId
* @param {Object} options
* @param {boolean} [refreshData=true]
*/
clusterByConnection(nodeId: Node.id, options: any, refreshData?: boolean): void;
/**
* Check if a node is a cluster.
* @param {Node.id} nodeId
* @returns {*}
*/
isCluster(nodeId: Node.id): any;
/**
* Open a cluster by calling this function.
* @param {vis.Edge.id} clusterNodeId | the ID of the cluster node
* @param {Object} options
* @param {boolean} refreshData | wrap up afterwards if not true
*/
openCluster(clusterNodeId: vis.Edge.id, options: any, refreshData?: boolean): void;
/**
*
* @param {Cluster.id} clusterId
* @returns {Array.<Node.id>}
*/
getNodesInCluster(clusterId: Cluster.id): Node.id[];
/**
* Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node
*
* If a node can't be found in the chain, return an empty array.
*
* @param {string|number} nodeId
* @returns {Array}
*/
findNode(nodeId: string | number): Array;
/**
* Using a clustered nodeId, update with the new options
* @param {vis.Edge.id} clusteredNodeId
* @param {object} newOptions
*/
updateClusteredNode(clusteredNodeId: vis.Edge.id, newOptions: any): void;
/**
* Using a base edgeId, update all related clustered edges with the new options
* @param {vis.Edge.id} startEdgeId
* @param {object} newOptions
*/
updateEdge(startEdgeId: vis.Edge.id, newOptions: any): void;
/**
* Get a stack of clusterEdgeId's (+base edgeid) that a base edge is the same as. cluster edge C -> cluster edge B -> cluster edge A -> base edge(edgeId)
* @param {vis.Edge.id} edgeId
* @returns {Array.<vis.Edge.id>}
*/
getClusteredEdges(edgeId: vis.Edge.id): vis.Edge.id[];
/**
* Get the base edge id of clusterEdgeId. cluster edge (clusteredEdgeId) -> cluster edge B -> cluster edge C -> base edge
* @param {vis.Edge.id} clusteredEdgeId
* @returns {vis.Edge.id} baseEdgeId
*
* TODO: deprecate in 5.0.0. Method getBaseEdges() is the correct one to use.
*/
getBaseEdge(clusteredEdgeId: vis.Edge.id): vis.Edge.id;
/**
* Get all regular edges for this clustered edge id.
*
* @param {vis.Edge.id} clusteredEdgeId
* @returns {Array.<vis.Edge.id>} all baseEdgeId's under this clustered edge
*/
getBaseEdges(clusteredEdgeId: vis.Edge.id): vis.Edge.id[];
/**
* Scan all edges for changes in clustering and adjust this if necessary.
*
* Call this (internally) after there has been a change in node or edge data.
*
* Pre: States of this.body.nodes and this.body.edges consistent
* Pre: this.clusteredNodes and this.clusteredEdge consistent with containedNodes and containedEdges
* of cluster nodes.
*/
_updateState(): void;
/**
* Determine if node with given id is part of a cluster.
*
* @param {Node.id} nodeId
* @return {boolean} true if part of a cluster.
*/
_isClusteredNode(nodeId: Node.id): boolean;
/**
* Determine if edge with given id is not visible due to clustering.
*
* An edge is considered clustered if:
* - it is directly replaced by a clustering edge
* - any of its connecting nodes is in a cluster
*
* @param {vis.Edge.id} edgeId
* @return {boolean} true if part of a cluster.
*/
_isClusteredEdge(edgeId: vis.Edge.id): boolean;
}
/**
* @param {Object} body
* @param {Array.<Image>} images
* @param {Array.<Group>} groups
*/
declare class EdgesHandler {
constructor(body: any, images: Image[], groups: Group[]);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Refreshes Edge Handler
*/
refresh(): void;
/**
*
* @param {Object} properties
* @returns {Edge}
*/
create(properties: any): Edge;
/**
*
* @param {Edge.id} edgeId
* @returns {Array}
*/
getConnectedNodes(edgeId: Edge.id): Array;
/**
* There is no direct relation between the nodes and the edges DataSet,
* so the right place to do call this is in the handler for event `_dataUpdated`.
*/
_updateState(): void;
}
/**
* @param {Object} body
* @param {Canvas} canvas
* @param {SelectionHandler} selectionHandler
*/
declare class InteractionHandler {
constructor(body: any, canvas: Canvas, selectionHandler: SelectionHandler);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Event} event
*/
onContext(event: Event): void;
/**
* Select and deselect nodes depending current selection change.
*
* For changing nodes, select/deselect events are fired.
*
* NOTE: For a given edge, if one connecting node is deselected and with the same
* click the other node is selected, no events for the edge will fire.
* It was selected and it will remain selected.
*
* TODO: This is all SelectionHandler calls; the method should be moved to there.
*
* @param {{x: number, y: number}} pointer
* @param {Event} event
* @param {boolean} [add=false]
*/
checkSelectionChanges(pointer: any, event: Event, add?: boolean): void;
}
/**
* @param {Object} body
* @param {number} edgeLength
* @param {number} edgeStrength
*/
declare class KamadaKawai {
constructor(body: any, edgeLength: number, edgeStrength: number);
/**
* Not sure if needed but can be used to update the spring length and spring constant
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Position the system
* @param {Array.<Node>} nodesArray
* @param {Array.<vis.Edge>} edgesArray
* @param {boolean} [ignoreClusters=false]
*/
solve(nodesArray: Node[], edgesArray: vis.Edge[], ignoreClusters?: boolean): void;
}
/**
* @param {Object} body
*/
declare class LayoutEngine {
constructor(body: any);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
*
* @param {Object} options
* @param {Object} allOptions
* @returns {Object}
*/
setOptions(options: any, allOptions: any): any;
/**
*
* @param {Object} allOptions
* @returns {Object}
*/
adaptAllOptionsForHierarchicalLayout(allOptions: any): any;
/**
*
* @returns {number}
*/
seededRandom(): number;
/**
*
* @param {Array.<Node>} nodesArray
*/
positionInitially(nodesArray: Node[]): void;
/**
* Use Kamada Kawai to position nodes. This is quite a heavy algorithm so if there are a lot of nodes we
* cluster them first to reduce the amount.
*/
layoutNetwork(): void;
/**
*
* @returns {number|*}
*/
getSeed(): number | any;
/**
* Receives an array with node indices and returns an array with the actual node references.
* Used for sorting based on node properties.
* @param {Array.<Node.id>} idArray
* @returns {Array.<Node>}
*/
_indexArrayToNodes(idArray: Node.id[]): Node[];
}
/**
* @param {Object} body
* @param {Images} images
* @param {Array.<Group>} groups
* @param {LayoutEngine} layoutEngine
*/
declare class NodesHandler {
constructor(body: any, images: Images, groups: Group[], layoutEngine: LayoutEngine);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* create a node
* @param {Object} properties
* @param {class} [constructorClass=Node.default]
* @returns {*}
*/
create(properties: any, constructorClass?: class): any;
/**
*
* @param {boolean} [clearPositions=false]
*/
refresh(clearPositions?: boolean): void;
/**
* Returns the positions of the nodes.
* @param {Array.<Node.id>|String} [ids] --> optional, can be array of nodeIds, can be string
* @returns {{}}
*/
getPositions(ids?: Node.id[] | string): any;
/**
* Load the XY positions of the nodes into the dataset.
*/
storePositions(): void;
/**
* get the bounding box of a node.
* @param {Node.id} nodeId
* @returns {j|*}
*/
getBoundingBox(nodeId: Node.id): j | any;
/**
* Get the Ids of nodes connected to this node.
* @param {Node.id} nodeId
* @param {'to'|'from'|undefined} direction values 'from' and 'to' select respectively parent and child nodes only.
* Any other value returns both parent and child nodes.
* @returns {Array}
*/
getConnectedNodes(nodeId: Node.id, direction: 'to' | 'from' | undefined): Array;
/**
* Get the ids of the edges connected to this node.
* @param {Node.id} nodeId
* @returns {*}
*/
getConnectedEdges(nodeId: Node.id): any;
/**
* Move a node.
*
* @param {Node.id} nodeId
* @param {number} x
* @param {number} y
*/
moveNode(nodeId: Node.id, x: number, y: number): void;
}
/**
* @param {Object} body
*/
declare class PhysicsEngine {
constructor(body: any);
/**
* Binds event listeners
*/
bindEventListeners(): void;
/**
* set the physics options
* @param {Object} options
*/
setOptions(options: any): void;
/**
* configure the engine.
*/
init(): void;
/**
* initialize the engine
*/
initPhysics(): void;
/**
* Start the simulation
*/
startSimulation(): void;
/**
* Stop the simulation, force stabilization.
* @param {boolean} [emit=true]
*/
stopSimulation(emit?: boolean): void;
/**
* The viewFunction inserts this step into each render loop. It calls the physics tick and handles the cleanup at stabilized.
*
*/
simulationStep(): void;
/**
* Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized.
*/
revert(): void;
/**
* move the nodes one timestep and check if they are stabilized
*/
moveNodes(): void;
/**
* Find a stable position for all nodes
*
* @param {number} [iterations=this.options.stabilization.iterations]
*/
stabilize(iterations?: number): void;
}
/**
* @param {Object} body
* @param {Canvas} canvas
*/
declare class SelectionHandler {
constructor(body: any, canvas: Canvas);
/**
*
* @param {Object} [options]
*/
setOptions(options?: any): void;
/**
* handles the selection part of the tap;
*
* @param {{x: number, y: number}} pointer
* @returns {boolean}
*/
selectOnPoint(pointer: any): boolean;
/**
*
* @param {{x: number, y: number}} pointer
* @returns {boolean}
*/
selectAdditionalOnPoint(pointer: any): boolean;
/**
* Generate an event which the user can catch.
*
* This adds some extra data to the event with respect to cursor position and
* selected nodes and edges.
*
* @param {string} eventType Name of event to send
* @param {Event} event
* @param {{x: number, y: number}} pointer Object with the x and y screen coordinates of the mouse
* @param {Object|undefined} oldSelection If present, selection state before event occured
* @param {boolean|undefined} [emptySelection=false] Indicate if selection data should be passed
*/
_generateClickEvent(eventType: string, event: Event, pointer: any, oldSelection: any | undefined, emptySelection?: boolean | undefined): void;
/**
*
* @param {Object} obj
* @param {boolean} [highlightEdges=this.options.selectConnectedEdges]
* @returns {boolean}
*/
selectObject(obj: any, highlightEdges?: boolean): boolean;
/**
*
* @param {Object} obj
*/
deselectObject(obj: any): void;
/**
* Get the top node at the passed point (like a click)
*
* @param {{x: number, y: number}} pointer
* @param {boolean} [returnNode=true]
* @return {Node | undefined} node
*/
getNodeAt(pointer: any, returnNode?: boolean): Node | undefined;
/**
* Get the edges nearest to the passed point (like a click)
*
* @param {{x: number, y: number}} pointer
* @param {boolean} [returnEdge=true]
* @return {Edge | undefined} node
*/
getEdgeAt(pointer: any, returnEdge?: boolean): Edge | undefined;
/**
* Unselect all. The selectionObj is useful for this.
*/
unselectAll(): void;
/**
* Perform actions in response to a mouse movement.
*
* @param {Event} event
* @param {{x: number, y: number}} pointer | object with the x and y screen coordinates of the mouse
*/
hoverObject(event: Event, pointer: any): void;
/**
*
* retrieve the currently selected objects
* @return {{nodes: Array.<string>, edges: Array.<string>}} selection
*/
getSelection(): any;
/**
*
* retrieve the currently selected nodes
* @return {string[]} selection An array with the ids of the
* selected nodes.
*/
getSelectedNodes(): string[];
/**
*
* retrieve the currently selected edges
* @return {Array} selection An array with the ids of the
* selected nodes.
*/
getSelectedEdges(): Array;
/**
* Updates the current selection
* @param {{nodes: Array.<string>, edges: Array.<string>}} selection
* @param {Object} options Options
*/
setSelection(selection: any, options: any): void;
/**
* select zero or more nodes with the option to highlight edges
* @param {number[] | string[]} selection An array with the ids of the
* selected nodes.
* @param {boolean} [highlightEdges]
*/
selectNodes(selection: number[] | string[], highlightEdges?: boolean): void;
/**
* select zero or more edges
* @param {number[] | string[]} selection An array with the ids of the
* selected nodes.
*/
selectEdges(selection: number[] | string[]): void;
}
/**
* @param {Object} body
* @param {Canvas} canvas
*/
declare class View {
constructor(body: any, canvas: Canvas);
/**
*
* @param {Object} [options={}]
*/
setOptions(options?: any): void;
/**
* This function zooms out to fit all data on screen based on amount of nodes
* @param {Object} [options={{nodes=Array}}]
* @param {boolean} [initialZoom=false] | zoom based on fitted formula or range, true = fitted, default = false;
*/
fit(options?: any, initialZoom?: boolean): void;
/**
* Center a node in view.
*
* @param {number} nodeId
* @param {number} [options]
*/
focus(nodeId: number, options?: number): void;
/**
*
* @param {Object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels
* | options.scale = number // scale to move to
* | options.position = {x:number, y:number} // position to move to
* | options.animation = {duration:number, easingFunction:String} || Boolean // position to move to
*/
moveTo(options: any): void;
/**
*
* @param {Object} options | options.offset = {x:number, y:number} // offset from the center in DOM pixels
* | options.time = number // animation time in milliseconds
* | options.scale = number // scale to animate to
* | options.position = {x:number, y:number} // position to animate to
* | options.easingFunction = String // linear, easeInQuad, easeOutQuad, easeInOutQuad,
* // easeInCubic, easeOutCubic, easeInOutCubic,
* // easeInQuart, easeOutQuart, easeInOutQuart,
* // easeInQuint, easeOutQuint, easeInOutQuint
*/
animateView(options: any): void;
/**
* Resets state of a locked on Node
*/
releaseNode(): void;
/**
*
* @returns {number}
*/
getScale(): number;
/**
*
* @returns {{x: number, y: number}}
*/
getViewPosition(): any;
}
/**
* Helper classes for LayoutEngine.
*
* Strategy pattern for usage of direction methods for hierarchical layouts.
*/
declare var TimSort: any;
/**
* @param {Object} options values specific to this edge, must contain at least 'from' and 'to'
* @param {Object} body shared state from Network instance
* @param {Object} globalOptions options from the EdgesHandler instance
* @param {Object} defaultOptions default options from the EdgeHandler instance. Value and reference are constant
*/
declare class Edge {
constructor(options: any, body: any, globalOptions: any, defaultOptions: any);
/**
* Set or overwrite options for the edge
* @param {Object} options an object with options
* @returns {null|boolean} null if no options, boolean if date changed
*/
setOptions(options: any): null | boolean;
/**
*
* @param {Object} parentOptions
* @param {Object} newOptions
* @param {boolean} [allowDeletion=false]
* @param {Object} [globalOptions={}]
* @param {boolean} [copyFromGlobals=false]
*/
static parseOptions(parentOptions: any, newOptions: any, allowDeletion?: boolean, globalOptions?: any, copyFromGlobals?: boolean): void;
/**
*
* @returns {ArrowOptions}
*/
getFormattingValues(): ArrowOptions;
/**
* update the options in the label module
*
* @param {Object} options
*/
updateLabelModule(options: any): void;
/**
* update the edge type, set the options
* @returns {boolean}
*/
updateEdgeType(): boolean;
/**
* Connect an edge to its nodes
*/
connect(): void;
/**
* Disconnect an edge from its nodes
*/
disconnect(): void;
/**
* get the title of this edge.
* @return {string} title The title of the edge, or undefined when no title
* has been set.
*/
getTitle(): string;
/**
* check if this node is selecte
* @return {boolean} selected True if node is selected, else false
*/
isSelected(): boolean;
/**
* Retrieve the value of the edge. Can be undefined
* @return {number} value
*/
getValue(): number;
/**
* Adjust the value range of the edge. The edge will adjust it's width
* based on its value.
* @param {number} min
* @param {number} max
* @param {number} total
*/
setValueRange(min: number, max: number, total: number): void;
/**
* Redraw a edge
* Draw this edge in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
draw(ctx: CanvasRenderingContext2D): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} arrowData
* @param {ArrowOptions} values
*/
drawArrows(ctx: CanvasRenderingContext2D, arrowData: any, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {Node} viaNode
*/
drawLabel(ctx: CanvasRenderingContext2D, viaNode: Node): void;
/**
* Determine all visual elements of this edge instance, in which the given
* point falls within the bounding shape.
*
* @param {point} point
* @returns {Array.<edgeClickItem|edgeLabelClickItem>} list with the items which are on the point
*/
getItemsOnPoint(point: point): (edgeClickItem | edgeLabelClickItem)[];
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top
* @return {boolean} True if location is located on the edge
*/
isOverlappingWith(obj: any): boolean;
/**
* Sets selected state to true
*/
select(): void;
/**
* Sets selected state to false
*/
unselect(): void;
/**
* cleans all required things on delete
* @returns {*}
*/
cleanup(): any;
/**
* Remove edge from the list and perform necessary cleanup.
*/
remove(): void;
/**
* Check if both connecting nodes exist
* @returns {boolean}
*/
endPointsValid(): boolean;
}
/**
* @param {Object} body
* @param {Canvas} canvas
*/
declare class NavigationHandler {
constructor(body: any, canvas: Canvas);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Creates or refreshes navigation and sets key bindings
*/
create(): void;
/**
* Cleans up previous navigation items
*/
cleanNavigation(): void;
/**
*
* @param {string} action
*/
bindToRedraw(action: string): void;
/**
*
* @param {string} action
*/
unbindFromRedraw(action: string): void;
/**
* bind all keys using keycharm.
*/
configureKeyboardBindings(): void;
}
/**
*
* @param {object} options An object containing options for the node. All
* options are optional, except for the id.
* {number} id Id of the node. Required
* {string} label Text label for the node
* {number} x Horizontal position of the node
* {number} y Vertical position of the node
* {string} shape Node shape
* {string} image An image url
* {string} title A title text, can be HTML
* {anytype} group A group name or number
*
* @param {Object} body Shared state of current network instance
* @param {Network.Images} imagelist A list with images. Only needed when the node has an image
* @param {Groups} grouplist A list with groups. Needed for retrieving group options
* @param {Object} globalOptions Current global node options; these serve as defaults for the node instance
* @param {Object} defaultOptions Global default options for nodes; note that this is also the prototype
* for parameter `globalOptions`.
*/
declare class Node {
constructor(options: any, body: any, imagelist: Network.Images, grouplist: Groups, globalOptions: any, defaultOptions: any);
/**
* Attach a edge to the node
* @param {Edge} edge
*/
attachEdge(edge: Edge): void;
/**
* Detach a edge from the node
*
* @param {Edge} edge
*/
detachEdge(edge: Edge): void;
/**
* Set or overwrite options for the node
*
* @param {Object} options an object with options
* @returns {null|boolean}
*/
setOptions(options: any): null | boolean;
/**
* Copy group option values into the node options.
*
* The group options override the global node options, so the copy of group options
* must happen *after* the global node options have been set.
*
* This method must also be called also if the global node options have changed and the group options did not.
*
* @param {Object} parentOptions
* @param {Object} newOptions new values for the options, currently only passed in for check
* @param {Object} groupList
*/
static updateGroupOptions(parentOptions: any, newOptions: any, groupList: any): void;
/**
* This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined.
* Static so it can also be used by the handler.
*
* @param {Object} parentOptions
* @param {Object} newOptions
* @param {boolean} [allowDeletion=false]
* @param {Object} [globalOptions={}]
* @param {Object} [groupList]
* @static
*/
static parseOptions(parentOptions: any, newOptions: any, allowDeletion?: boolean, globalOptions?: any, groupList?: any): void;
/**
*
* @returns {{color: *, borderWidth: *, borderColor: *, size: *, borderDashes: (boolean|Array|allOptions.nodes.shapeProperties.borderDashes|{boolean, array}), borderRadius: (number|allOptions.nodes.shapeProperties.borderRadius|{number}|Array), shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *}}
*/
getFormattingValues(): any;
/**
*
* @param {Object} options
*/
updateLabelModule(options: any): void;
/**
*
* @param {string} currentShape
*/
updateShape(currentShape: string): void;
/**
* select this node
*/
select(): void;
/**
* unselect this node
*/
unselect(): void;
/**
* Reset the calculated size of the node, forces it to recalculate its size
*/
needsRefresh(): void;
/**
* get the title of this node.
* @return {string} title The title of the node, or undefined when no title
* has been set.
*/
getTitle(): string;
/**
* Calculate the distance to the border of the Node
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle Angle in radians
* @returns {number} distance Distance to the border in pixels
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
* Check if this node has a fixed x and y position
* @return {boolean} true if fixed, false if not
*/
isFixed(): boolean;
/**
* check if this node is selecte
* @return {boolean} selected True if node is selected, else false
*/
isSelected(): boolean;
/**
* Retrieve the value of the node. Can be undefined
* @return {number} value
*/
getValue(): number;
/**
* Get the current dimensions of the label
*
* @return {rect}
*/
getLabelSize(): rect;
/**
* Adjust the value range of the node. The node will adjust it's size
* based on its value.
* @param {number} min
* @param {number} max
* @param {number} total
*/
setValueRange(min: number, max: number, total: number): void;
/**
* Draw this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
draw(ctx: CanvasRenderingContext2D): void;
/**
* Update the bounding box of the shape
* @param {CanvasRenderingContext2D} ctx
*/
updateBoundingBox(ctx: CanvasRenderingContext2D): void;
/**
* Recalculate the size of this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
resize(ctx: CanvasRenderingContext2D): void;
/**
* Determine all visual elements of this node instance, in which the given
* point falls within the bounding shape.
*
* @param {point} point
* @returns {Array.<nodeClickItem|nodeLabelClickItem>} list with the items which are on the point
*/
getItemsOnPoint(point: point): (nodeClickItem | nodeLabelClickItem)[];
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top, right, bottom
* @return {boolean} True if location is located on node
*/
isOverlappingWith(obj: any): boolean;
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top, right, bottom
* @return {boolean} True if location is located on node
*/
isBoundingBoxOverlappingWith(obj: any): boolean;
/**
* Check valid values for mass
*
* The mass may not be negative or zero. If it is, reset to 1
*
* @param {object} options
* @param {Node.id} id
* @static
*/
static checkMass(options: any, id: Node.id): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class BezierEdgeDynamic extends BezierEdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Connects an edge to node(s)
*/
connect(): void;
/**
* remove the support nodes
* @returns {boolean}
*/
cleanup(): boolean;
/**
* Positions bezier node
*/
positionBezierNode(): void;
/**
*
* @returns {Node|undefined|*|{index, line, column}}
*/
getViaNode(): Node | undefined | any | any;
/**
* Draw a bezier curve between two nodes
*
* The method accepts zero, one or two control points.
* Passing zero control points just draws a straight line
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} values | options for shadow drawing
* @param {Object|undefined} viaNode1 | first control point for curve drawing
* @param {Object|undefined} viaNode2 | second control point for curve drawing
*
* @protected
*/
protected _bezierCurve(ctx: CanvasRenderingContext2D, values: any, viaNode1: any | undefined, viaNode2: any | undefined): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class BezierEdgeStatic extends BezierEdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @returns {Array.<{x: number, y: number}>}
*/
getViaNode(): { x: number; y: number; }[];
/**
* Draw a bezier curve between two nodes
*
* The method accepts zero, one or two control points.
* Passing zero control points just draws a straight line
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} values | options for shadow drawing
* @param {Object|undefined} viaNode1 | first control point for curve drawing
* @param {Object|undefined} viaNode2 | second control point for curve drawing
*
* @protected
*/
protected _bezierCurve(ctx: CanvasRenderingContext2D, values: any, viaNode1: any | undefined, viaNode2: any | undefined): void;
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class CubicBezierEdge extends CubicBezierEdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @returns {Array.<{x: number, y: number}>}
*/
getViaNode(): { x: number; y: number; }[];
/**
* Draw a bezier curve between two nodes
*
* The method accepts zero, one or two control points.
* Passing zero control points just draws a straight line
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} values | options for shadow drawing
* @param {Object|undefined} viaNode1 | first control point for curve drawing
* @param {Object|undefined} viaNode2 | second control point for curve drawing
*
* @protected
*/
protected _bezierCurve(ctx: CanvasRenderingContext2D, values: any, viaNode1: any | undefined, viaNode2: any | undefined): void;
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class StraightEdge extends EdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @returns {undefined}
*/
getViaNode(): undefined;
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class BezierEdgeBase extends EdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
* Draw a bezier curve between two nodes
*
* The method accepts zero, one or two control points.
* Passing zero control points just draws a straight line
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} values | options for shadow drawing
* @param {Object|undefined} viaNode1 | first control point for curve drawing
* @param {Object|undefined} viaNode2 | second control point for curve drawing
*
* @protected
*/
protected _bezierCurve(ctx: CanvasRenderingContext2D, values: any, viaNode1: any | undefined, viaNode2: any | undefined): void;
/**
*
* @returns {*|{x, y}|{x: undefined, y: undefined}}
*/
getViaNode(): any | any | any;
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class CubicBezierEdgeBase extends BezierEdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
* Draw a bezier curve between two nodes
*
* The method accepts zero, one or two control points.
* Passing zero control points just draws a straight line
*
* @param {CanvasRenderingContext2D} ctx
* @param {Object} values | options for shadow drawing
* @param {Object|undefined} viaNode1 | first control point for curve drawing
* @param {Object|undefined} viaNode2 | second control point for curve drawing
*
* @protected
*/
protected _bezierCurve(ctx: CanvasRenderingContext2D, values: any, viaNode1: any | undefined, viaNode2: any | undefined): void;
/**
*
* @returns {*|{x, y}|{x: undefined, y: undefined}}
*/
getViaNode(): any | any | any;
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class EdgeBase {
constructor(options: any, body: any, labelModule: Label);
/**
* Connects a node to itself
*/
connect(): void;
/**
*
* @returns {boolean} always false
*/
cleanup(): boolean;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Node} nearNode
* @param {CanvasRenderingContext2D} ctx
* @param {Object} options
* @returns {{x: number, y: number}}
*/
findBorderPosition(nearNode: Node, ctx: CanvasRenderingContext2D, options: any): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @returns {{from: ({x: number, y: number, t: number}|*), to: ({x: number, y: number, t: number}|*)}}
*/
findBorderPositions(ctx: CanvasRenderingContext2D): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected - Unused
* @param {boolean} hover - Unused
* @returns {string}
*/
getColor(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean): string;
/**
* Calculate the distance between a point (x3,y3) and a line segment from (x1,y1) to (x2,y2).
* (x3,y3) is the point.
*
* http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment
*
* @param {number} x1
* @param {number} y1
* @param {number} x2
* @param {number} y2
* @param {number} x3
* @param {number} y3
* @param {Node} via
* @param {Array} values
* @returns {number}
*/
getDistanceToEdge(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, via: Node, values: Array): number;
/**
* @param {CanvasRenderingContext2D} ctx
* @param {string} position
* @param {Node} viaNode
* @param {boolean} selected
* @param {boolean} hover
* @param {Array} values
* @returns {{point: *, core: {x: number, y: number}, angle: *, length: number, type: *}}
*/
getArrowData(ctx: CanvasRenderingContext2D, position: string, viaNode: Node, selected: boolean, hover: boolean, values: Array): any;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
* @param {boolean} selected
* @param {boolean} hover
* @param {Object} arrowData
*/
drawArrowHead(ctx: CanvasRenderingContext2D, values: ArrowOptions, selected: boolean, hover: boolean, arrowData: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} values
*/
drawBackground(ctx: CanvasRenderingContext2D, values: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean|Array} dashes
*/
setStrokeDashed(ctx: CanvasRenderingContext2D, dashes: boolean | Array): void;
}
/**
* Common methods for endpoints
*
* @class
*/
declare class EndPoint {
/**
* Apply transformation on points for display.
*
* The following is done:
* - rotate by the specified angle
* - multiply the (normalized) coordinates by the passed length
* - offset by the target coordinates
*
* @param {Array<Point>} points
* @param {ArrowData} arrowData
* @static
*/
static transform(points: Point[], arrowData: ArrowData): void;
/**
* Draw a closed path using the given real coordinates.
*
* @param {CanvasRenderingContext2D} ctx
* @param {Array.<Point>} points
* @static
*/
static drawPath(ctx: CanvasRenderingContext2D, points: Point[]): void;
}
/**
* Drawing methods for the arrow endpoint.
* @extends EndPoint
*/
declare class Arrow extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the crow endpoint.
* @extends EndPoint
*/
declare class Crow extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the curve endpoint.
* @extends EndPoint
*/
declare class Curve extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the inverted curve endpoint.
* @extends EndPoint
*/
declare class InvertedCurve extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the trinagle endpoint.
* @extends EndPoint
*/
declare class Triangle extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x
* @param {number} y
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the inverted trinagle endpoint.
* @extends EndPoint
*/
declare class InvertedTriangle extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the circle endpoint.
*/
declare class Circle {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x width
* @param {number} y height
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle - Unused
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
* @param {Object} [imageObj]
* @param {Object} [imageObjAlt]
*/
setOptions(options: any, imageObj?: any, imageObjAlt?: any): void;
/**
* Set the images for this node.
*
* The images can be updated after the initial setting of options;
* therefore, this method needs to be reentrant.
*
* For correct working in error cases, it is necessary to properly set
* field 'nodes.brokenImage' in the options.
*
* @param {Image} imageObj required; main image to show for this node
* @param {Image|undefined} imageObjAlt optional; image to show when node is selected
*/
setImages(imageObj: Image, imageObjAlt: Image | undefined): void;
/**
* Set selection and switch between the base and the selected image.
*
* Do the switch only if imageObjAlt exists.
*
* @param {boolean} selected value of new selected state for current node
*/
switchImages(selected: boolean): void;
/**
* Adjust the node dimensions for a loaded image.
*
* Pre: this.imageObj is valid
*/
_resizeImage(): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the bar endpoint.
*/
declare class Bar {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the box endpoint.
*/
declare class Box {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the diamond endpoint.
*/
declare class Diamond {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the vee endpoint.
* @extends EndPoint
*/
declare class Vee extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* Drawing methods for the endpoints.
*/
declare class EndPoints {
/**
* Draw an endpoint
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Array.<HTMLImageElement>}imagelist
* @param {Array} grouplist
* @param {Object} globalOptions
* @param {Object} defaultOptions Global default options for nodes
*/
declare class Cluster extends Node {
constructor(options: any, body: any, imagelist: HTMLImageElement[], grouplist: Array, globalOptions: any, defaultOptions: any);
/**
* Transfer child cluster data to current and disconnect the child cluster.
*
* Please consult the header comment in 'Clustering.js' for the fields set here.
*
* @param {string|number} childClusterId id of child cluster to open
*/
_openChildCluster(childClusterId: string | number): void;
/**
* Attach a edge to the node
* @param {Edge} edge
*/
attachEdge(edge: Edge): void;
/**
* Detach a edge from the node
*
* @param {Edge} edge
*/
detachEdge(edge: Edge): void;
/**
* Set or overwrite options for the node
*
* @param {Object} options an object with options
* @returns {null|boolean}
*/
setOptions(options: any): null | boolean;
/**
*
* @returns {{color: *, borderWidth: *, borderColor: *, size: *, borderDashes: (boolean|Array|allOptions.nodes.shapeProperties.borderDashes|{boolean, array}), borderRadius: (number|allOptions.nodes.shapeProperties.borderRadius|{number}|Array), shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *}}
*/
getFormattingValues(): any;
/**
*
* @param {Object} options
*/
updateLabelModule(options: any): void;
/**
*
* @param {string} currentShape
*/
updateShape(currentShape: string): void;
/**
* select this node
*/
select(): void;
/**
* unselect this node
*/
unselect(): void;
/**
* Reset the calculated size of the node, forces it to recalculate its size
*/
needsRefresh(): void;
/**
* get the title of this node.
* @return {string} title The title of the node, or undefined when no title
* has been set.
*/
getTitle(): string;
/**
* Calculate the distance to the border of the Node
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle Angle in radians
* @returns {number} distance Distance to the border in pixels
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
* Check if this node has a fixed x and y position
* @return {boolean} true if fixed, false if not
*/
isFixed(): boolean;
/**
* check if this node is selecte
* @return {boolean} selected True if node is selected, else false
*/
isSelected(): boolean;
/**
* Retrieve the value of the node. Can be undefined
* @return {number} value
*/
getValue(): number;
/**
* Get the current dimensions of the label
*
* @return {rect}
*/
getLabelSize(): rect;
/**
* Adjust the value range of the node. The node will adjust it's size
* based on its value.
* @param {number} min
* @param {number} max
* @param {number} total
*/
setValueRange(min: number, max: number, total: number): void;
/**
* Draw this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
draw(ctx: CanvasRenderingContext2D): void;
/**
* Update the bounding box of the shape
* @param {CanvasRenderingContext2D} ctx
*/
updateBoundingBox(ctx: CanvasRenderingContext2D): void;
/**
* Recalculate the size of this node in the given canvas
* The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d");
* @param {CanvasRenderingContext2D} ctx
*/
resize(ctx: CanvasRenderingContext2D): void;
/**
* Determine all visual elements of this node instance, in which the given
* point falls within the bounding shape.
*
* @param {point} point
* @returns {Array.<nodeClickItem|nodeLabelClickItem>} list with the items which are on the point
*/
getItemsOnPoint(point: point): (nodeClickItem | nodeLabelClickItem)[];
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top, right, bottom
* @return {boolean} True if location is located on node
*/
isOverlappingWith(obj: any): boolean;
/**
* Check if this object is overlapping with the provided object
* @param {Object} obj an object with parameters left, top, right, bottom
* @return {boolean} True if location is located on node
*/
isBoundingBoxOverlappingWith(obj: any): boolean;
}
/**
* Drawing methods for the box endpoint.
*/
declare class Box {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the circle endpoint.
*/
declare class Circle {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x width
* @param {number} y height
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle - Unused
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
* @param {Object} [imageObj]
* @param {Object} [imageObjAlt]
*/
setOptions(options: any, imageObj?: any, imageObjAlt?: any): void;
/**
* Set the images for this node.
*
* The images can be updated after the initial setting of options;
* therefore, this method needs to be reentrant.
*
* For correct working in error cases, it is necessary to properly set
* field 'nodes.brokenImage' in the options.
*
* @param {Image} imageObj required; main image to show for this node
* @param {Image|undefined} imageObjAlt optional; image to show when node is selected
*/
setImages(imageObj: Image, imageObjAlt: Image | undefined): void;
/**
* Set selection and switch between the base and the selected image.
*
* Do the switch only if imageObjAlt exists.
*
* @param {boolean} selected value of new selected state for current node
*/
switchImages(selected: boolean): void;
/**
* Adjust the node dimensions for a loaded image.
*
* Pre: this.imageObj is valid
*/
_resizeImage(): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
* @param {Image} imageObj
* @param {Image} imageObjAlt
*/
declare class CircularImage extends CircleImageBase {
constructor(options: any, body: any, labelModule: Label, imageObj: Image, imageObjAlt: Image);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x width
* @param {number} y height
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle - Unused
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
* @param {Object} [imageObj]
* @param {Object} [imageObjAlt]
*/
setOptions(options: any, imageObj?: any, imageObjAlt?: any): void;
/**
* Set the images for this node.
*
* The images can be updated after the initial setting of options;
* therefore, this method needs to be reentrant.
*
* For correct working in error cases, it is necessary to properly set
* field 'nodes.brokenImage' in the options.
*
* @param {Image} imageObj required; main image to show for this node
* @param {Image|undefined} imageObjAlt optional; image to show when node is selected
*/
setImages(imageObj: Image, imageObjAlt: Image | undefined): void;
/**
* Set selection and switch between the base and the selected image.
*
* Do the switch only if imageObjAlt exists.
*
* @param {boolean} selected value of new selected state for current node
*/
switchImages(selected: boolean): void;
/**
* Adjust the node dimensions for a loaded image.
*
* Pre: this.imageObj is valid
*/
_resizeImage(): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Database extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
resize(ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Default implementation of this method call.
* This acts as a stub which can be overridden.
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the diamond endpoint.
*/
declare class Diamond {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Dot extends ShapeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Ellipse extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Default implementation of this method call.
* This acts as a stub which can be overridden.
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Hexagon extends ShapeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Icon extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx - Unused.
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover - Unused
* @param {ArrowOptions} values
*/
_icon(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
* @param {Image} imageObj
* @param {Image} imageObjAlt
*/
declare class Image extends CircleImageBase {
constructor(options: any, body: any, labelModule: Label, imageObj: Image, imageObjAlt: Image);
/**
*
* @param {CanvasRenderingContext2D} ctx - Unused.
* @param {boolean} [selected]
* @param {boolean} [hover]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
* @param {Object} [imageObj]
* @param {Object} [imageObjAlt]
*/
setOptions(options: any, imageObj?: any, imageObjAlt?: any): void;
/**
* Set the images for this node.
*
* The images can be updated after the initial setting of options;
* therefore, this method needs to be reentrant.
*
* For correct working in error cases, it is necessary to properly set
* field 'nodes.brokenImage' in the options.
*
* @param {Image} imageObj required; main image to show for this node
* @param {Image|undefined} imageObjAlt optional; image to show when node is selected
*/
setImages(imageObj: Image, imageObjAlt: Image | undefined): void;
/**
* Set selection and switch between the base and the selected image.
*
* Do the switch only if imageObjAlt exists.
*
* @param {boolean} selected value of new selected state for current node
*/
switchImages(selected: boolean): void;
/**
* Adjust the node dimensions for a loaded image.
*
* Pre: this.imageObj is valid
*/
_resizeImage(): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Square extends ShapeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Star extends ShapeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class Text extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
resize(ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x width
* @param {number} y height
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Default implementation of this method call.
* This acts as a stub which can be overridden.
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* Drawing methods for the trinagle endpoint.
* @extends EndPoint
*/
declare class Triangle extends EndPoint {
/**
* Draw this shape at the end of a line.
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowData} arrowData
* @static
*/
static draw(ctx: CanvasRenderingContext2D, arrowData: ArrowData): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x
* @param {number} y
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class TriangleDown extends ShapeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} x
* @param {number} y
* @param {boolean} selected
* @param {boolean} hover
* @param {ArrowOptions} values
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {number} angle
* @returns {number}
*/
distanceToBorder(ctx: CanvasRenderingContext2D, angle: number): number;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class CircleImageBase extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {Object} options
* @param {Object} [imageObj]
* @param {Object} [imageObjAlt]
*/
setOptions(options: any, imageObj?: any, imageObjAlt?: any): void;
/**
* Set the images for this node.
*
* The images can be updated after the initial setting of options;
* therefore, this method needs to be reentrant.
*
* For correct working in error cases, it is necessary to properly set
* field 'nodes.brokenImage' in the options.
*
* @param {Image} imageObj required; main image to show for this node
* @param {Image|undefined} imageObjAlt optional; image to show when node is selected
*/
setImages(imageObj: Image, imageObjAlt: Image | undefined): void;
/**
* Set selection and switch between the base and the selected image.
*
* Do the switch only if imageObjAlt exists.
*
* @param {boolean} selected value of new selected state for current node
*/
switchImages(selected: boolean): void;
/**
* Adjust the node dimensions for a loaded image.
*
* Pre: this.imageObj is valid
*/
_resizeImage(): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Default implementation of this method call.
* This acts as a stub which can be overridden.
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Default implementation of this method call.
* This acts as a stub which can be overridden.
*
* @param {number} x width
* @param {number} y height
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
*/
updateBoundingBox(x: number, y: number, ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} options
* @param {Object} body
* @param {Label} labelModule
*/
declare class ShapeBase extends NodeBase {
constructor(options: any, body: any, labelModule: Label);
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @param {Object} [values={size: this.options.size}]
*/
resize(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean, values?: any): void;
/**
*
* @param {number} x
* @param {number} y
*/
updateBoundingBox(x: number, y: number): void;
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableShadow(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
enableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
disableBorderDashes(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine if the shape of a node needs to be recalculated.
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
* @protected
*/
protected needsRefresh(selected: boolean, hover: boolean): boolean;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
initContextForDraw(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performStroke(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {ArrowOptions} values
*/
performFill(ctx: CanvasRenderingContext2D, values: ArrowOptions): void;
/**
* Determine the dimensions to use for nodes with an internal label
*
* Currently, these are: Circle, Ellipse, Database, Box
* The other nodes have external labels, and will not call this method
*
* If there is no label, decent default values are supplied.
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} [selected]
* @param {boolean} [hover]
* @returns {{width:number, height:number}}
*/
getDimensionsFromLabel(ctx: CanvasRenderingContext2D, selected?: boolean, hover?: boolean): any;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class BarnesHutSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @returns {number} random integer
*/
seededRandom(): number;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class CentralGravitySolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Calculates forces for each node
*/
solve(): void;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class ForceAtlas2BasedCentralGravitySolver extends CentralGravitySolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
* Calculates forces for each node
*/
solve(): void;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class ForceAtlas2BasedRepulsionSolver extends BarnesHutSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @returns {number} random integer
*/
seededRandom(): number;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class HierarchicalRepulsionSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class HierarchicalSpringSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class RepulsionSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
}
/**
* @param {Object} body
* @param {{physicsNodeIndices: Array, physicsEdgeIndices: Array, forces: {}, velocities: {}}} physicsBody
* @param {Object} options
*/
declare class SpringSolver {
constructor(body: any, physicsBody: any, options: any);
/**
*
* @param {Object} options
*/
setOptions(options: any): void;
}
/**
* Helper functions for components
* @class
*/
declare class ComponentUtil {
/**
* Determine values to use for (sub)options of 'chosen'.
*
* This option is either a boolean or an object whose values should be examined further.
* The relevant structures are:
*
* - chosen: <boolean value>
* - chosen: { subOption: <boolean or function> }
*
* Where subOption is 'node', 'edge' or 'label'.
*
* The intention of this method appears to be to set a specific priority to the options;
* Since most properties are either bridged or merged into the local options objects, there
* is not much point in handling them separately.
* TODO: examine if 'most' in previous sentence can be replaced with 'all'. In that case, we
* should be able to get rid of this method.
*
* @param {string} subOption option within object 'chosen' to consider; either 'node', 'edge' or 'label'
* @param {Object} pile array of options objects to consider
*
* @return {boolean|function} value for passed subOption of 'chosen' to use
*/
static choosify(subOption: string, pile: any): boolean | ((...params: any[]) => any);
/**
* Check if the point falls within the given rectangle.
*
* @param {rect} rect
* @param {point} point
* @param {rotationPoint} [rotationPoint] if specified, the rotation that applies to the rectangle.
* @returns {boolean} true if point within rectangle, false otherwise
* @static
*/
static pointInRect(rect: rect, point: point, rotationPoint?: rotationPoint): boolean;
/**
* Check if given value is acceptable as a label text.
*
* @param {*} text value to check; can be anything at this point
* @returns {boolean} true if valid label value, false otherwise
*/
static isValidLabel(text: any): boolean;
}
/**
* @param {Object} body
* @param {Object} options
* @param {boolean} [edgelabel=false]
*/
declare class Label {
constructor(body: any, options: any, edgelabel?: boolean);
/**
* @param {Object} options the options of the parent Node-instance
*/
setOptions(options: any): void;
/**
* If in-variable is a string, parse it as a font specifier.
*
* Note that following is not done here and have to be done after the call:
* - No number conversion (size)
* - Not all font options are set (vadjust, mod)
*
* @param {Object} outOptions out-parameter, object in which to store the parse results (if any)
* @param {Object} inOptions font options to parse
* @return {boolean} true if font parsed as string, false otherwise
* @static
*/
static parseFontString(outOptions: any, inOptions: any): boolean;
/**
* Set options and update internal state
*
* @param {Object} options options to set
* @param {Array} pile array of option objects to consider for option 'chosen'
*/
update(options: any, pile: Array): void;
/**
* When margins are set in an element, adjust sizes is called to remove them
* from the width/height constraints. This must be done prior to label sizing.
*
* @param {{top: number, right: number, bottom: number, left: number}} margins
*/
adjustSizes(margins: any): void;
/**
* Collapse the font options for the multi-font to single objects, from
* the chain of option objects passed (the 'pile').
*
* @param {Pile} pile sequence of option objects to consider.
* First item in list assumed to be the newly set options.
*/
propagateFonts(pile: Pile): void;
/**
* Main function. This is called from anything that wants to draw a label.
* @param {CanvasRenderingContext2D} ctx
* @param {number} x
* @param {number} y
* @param {boolean} selected
* @param {boolean} hover
* @param {string} [baseline='middle']
*/
draw(ctx: CanvasRenderingContext2D, x: number, y: number, selected: boolean, hover: boolean, baseline?: string): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
* @returns {{width: number, height: number}}
*/
getTextSize(ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean): any;
/**
* Get the current dimensions of the label
*
* @return {rect}
*/
getSize(): rect;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
* @param {number} [x=0]
* @param {number} [y=0]
* @param {'middle'|'hanging'} [baseline='middle']
*/
calculateLabelSize(ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean, x?: number, y?: number, baseline?: 'middle' | 'hanging'): void;
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {boolean} selected
* @param {boolean} hover
* @param {string} mod
* @returns {{color, size, face, mod, vadjust, strokeWidth: *, strokeColor: (*|string|allOptions.edges.font.strokeColor|{string}|allOptions.nodes.font.strokeColor|Array)}}
*/
getFormattingValues(ctx: CanvasRenderingContext2D, selected: boolean, hover: boolean, mod: string): any;
/**
*
* @param {boolean} selected
* @param {boolean} hover
* @returns {boolean}
*/
differentState(selected: boolean, hover: boolean): boolean;
/**
* Check if this label is visible
*
* @return {boolean} true if this label will be show, false otherwise
*/
visible(): boolean;
}
/**
* Callback to determine text dimensions, using the parent label settings.
* @callback MeasureText
* @param {text} text
* @param {text} mod
* @return {Object} { width, values} width in pixels and font attributes
*/
declare type MeasureText = (text: text, mod: text) => any;
/**
* Create an instance
*
* @param {string} text text to parse for markup
*/
declare class MarkupAccumulator {
constructor(text: string);
/**
* Handle parsing of whitespace
*
* @param {string} ch the character to check
* @returns {boolean} true if the character was processed as whitespace, false otherwise
*/
parseWS(ch: string): boolean;
/**
* @param {string} tagName label for block type we are currently processing
* @param {string|RegExp} tag string to match in text
* @returns {boolean} true if the tag was processed, false otherwise
*/
parseStartTag(tagName: string, tag: string | RegExp): boolean;
/**
* @param {string} tagName label for block type we are currently processing
* @param {string|RegExp} tag string to match in text
* @param {RegExp} [nextTag] regular expression to match for characters *following* the current tag
* @returns {boolean} true if the tag was processed, false otherwise
*/
parseEndTag(tagName: string, tag: string | RegExp, nextTag?: RegExp): boolean;
/**
* @param {string|RegExp} tag string to match in text
* @param {value} value string to replace tag with, if found at current position
* @returns {boolean} true if the tag was processed, false otherwise
*/
replace(tag: string | RegExp, value: value): boolean;
}
/**
* This object contains all possible options. It will check if the types are correct, if required if the option is one
* of the allowed values.
*
* __any__ means that the name of the property does not matter.
* __type__ is a required field for all objects and contains the allowed types of all objects
*/
declare var string: any;
/**
* @typedef {{type:string, point:Point, angle:number, length:number}} ArrowData
*
* Object containing instantiation data for a given endpoint.
*/
declare type ArrowData = any;
/**
* @typedef {{x:number, y:number}} Point
*
* A point in view-coordinates.
*/
declare type Point = any;
/**
* @typedef {{toArrow: boolean, toArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), toArrowType: *, middleArrow: boolean, middleArrowScale: (number|allOptions.edges.arrows.middle.scaleFactor|{number}|Array), middleArrowType: (allOptions.edges.arrows.middle.type|{string}|string|*), fromArrow: boolean, fromArrowScale: (allOptions.edges.arrows.to.scaleFactor|{number}|allOptions.edges.arrows.middle.scaleFactor|allOptions.edges.arrows.from.scaleFactor|Array|number), fromArrowType: *, arrowStrikethrough: (*|boolean|allOptions.edges.arrowStrikethrough|{boolean}), color: undefined, inheritsColor: (string|string|string|allOptions.edges.color.inherit|{string, boolean}|Array|*), opacity: *, hidden: *, length: *, shadow: *, shadowColor: *, shadowSize: *, shadowX: *, shadowY: *, dashes: (*|boolean|Array|allOptions.edges.dashes|{boolean, array}), width: *}} ArrowOptions
*/
declare type ArrowOptions = any;
/**
* @typedef {string|number} Id
*/
declare type Id = string | number;
/**
* @typedef {Id} NodeId
*/
declare type NodeId = Id;
/**
* @typedef {Id} EdgeId
*/
declare type EdgeId = Id;
/**
* @typedef {Id} LabelId
*/
declare type LabelId = Id;
/**
* @typedef {{x: number, y: number}} point
*/
declare type point = any;
/**
* @typedef {{left: number, top: number, width: number, height: number}} rect
*/
declare type rect = any;
/**
* @typedef {{x: number, y:number, angle: number}} rotationPoint
*
* point to rotate around and the angle in radians to rotate. angle == 0 means no rotation
*/
declare type rotationPoint = any;
/**
* @typedef {{nodeId:NodeId}} nodeClickItem
*/
declare type nodeClickItem = any;
/**
* @typedef {{nodeId:NodeId, labelId:LabelId}} nodeLabelClickItem
*/
declare type nodeLabelClickItem = any;
/**
* @typedef {{edgeId:EdgeId}} edgeClickItem
*/
declare type edgeClickItem = any;
/**
* @typedef {{edgeId:EdgeId, labelId:LabelId}} edgeLabelClickItem
*/
declare type edgeLabelClickItem = any;
/**
* @typedef {'bold'|'ital'|'boldital'|'mono'|'normal'} MultiFontStyle
*
* The allowed specifiers of multi-fonts.
*/
declare type MultiFontStyle = 'bold' | 'ital' | 'boldital' | 'mono' | 'normal';
/**
* @typedef {{color:string, size:number, face:string, mod:string, vadjust:number}} MultiFontOptions
*
* The full set of options of a given multi-font.
*/
declare type MultiFontOptions = any;
/**
* @typedef {Array.<object>} Pile
*
* Sequence of option objects, the order is significant.
* The sequence is used to determine the value of a given option.
*
* Usage principles:
*
* - All search is done in the sequence of the pile.
* - As soon as a value is found, the searching stops.
* - prototypes are totally ignored. The idea is to add option objects used as prototypes
* to the pile, in the correct order.
*/
declare type Pile = object[];
/**
* Turn an element into an clickToUse element.
* When not active, the element has a transparent overlay. When the overlay is
* clicked, the mode is changed to active.
* When active, the element is displayed with a blue border around it, and
* the interactive contents of the element can be used. When clicked outside
* the element, the elements mode is changed to inactive.
* @param {Element} container
* @constructor Activator
*/
declare class Activator {
constructor(container: Element);
/**
* Destroy the activator. Cleans up all created DOM and event listeners
*/
destroy(): void;
/**
* Activate the element
* Overlay is hidden, element is decorated with a blue shadow border
*/
activate(): void;
/**
* Deactivate the element
* Overlay is displayed on top of the element
*/
deactivate(): void;
}
/**
* @param {number} [pixelRatio=1]
*/
declare class ColorPicker {
constructor(pixelRatio?: number);
/**
* this inserts the colorPicker into a div from the DOM
* @param {Element} container
*/
insertTo(container: Element): void;
/**
* the callback is executed on apply and save. Bind it to the application
* @param {function} callback
*/
setUpdateCallback(callback: (...params: any[]) => any): void;
/**
* the callback is executed on apply and save. Bind it to the application
* @param {function} callback
*/
setCloseCallback(callback: (...params: any[]) => any): void;
/**
* Set the color of the colorPicker
* Supported formats:
* 'red' --> HTML color string
* '#ffffff' --> hex string
* 'rgb(255,255,255)' --> rgb string
* 'rgba(255,255,255,1.0)' --> rgba string
* {r:255,g:255,b:255} --> rgb object
* {r:255,g:255,b:255,a:1.0} --> rgba object
* @param {string|Object} color
* @param {boolean} [setInitial=true]
*/
setColor(color: string | any, setInitial?: boolean): void;
/**
* this shows the color picker.
* The hue circle is constructed once and stored.
*/
show(): void;
}
/**
* @param {Object} parentModule | the location where parentModule.setOptions() can be called
* @param {Object} defaultContainer | the default container of the module
* @param {Object} configureOptions | the fully configured and predefined options set found in allOptions.js
* @param {number} pixelRatio | canvas pixel ratio
*/
declare class Configurator {
constructor(parentModule: any, defaultContainer: any, configureOptions: any, pixelRatio?: number);
/**
* refresh all options.
* Because all modules parse their options by themselves, we just use their options. We copy them here.
*
* @param {Object} options
*/
setOptions(options: any): void;
/**
*
* @param {Object} moduleOptions
*/
setModuleOptions(moduleOptions: any): void;
/**
*
* @returns {{}} options
*/
getOptions(): any;
}
/**
* @param {Element} container The container object.
* @param {string} overflowMethod How the popup should act to overflowing ('flip' or 'cap')
*/
declare class Popup {
constructor(container: Element, overflowMethod: string);
/**
* @param {number} x Horizontal position of the popup window
* @param {number} y Vertical position of the popup window
*/
setPosition(x: number, y: number): void;
/**
* Set the content for the popup window. This can be HTML code or text.
* @param {string | Element} content
*/
setText(content: string | Element): void;
/**
* Show the popup window
* @param {boolean} [doShow] Show or hide the window
*/
show(doShow?: boolean): void;
/**
* Hide the popup window
*/
hide(): void;
/**
* Remove the popup window
*/
destroy(): void;
}
/**
* Test whether given object is a number
* @param {*} object
* @return {Boolean} isNumber
*/
declare function isNumber(object: any): boolean;
/**
* Remove everything in the DOM object
* @param {Element} DOMobject
*/
declare function recursiveDOMDelete(DOMobject: Element): void;
/**
* Test whether given object is a string
* @param {*} object
* @return {Boolean} isString
*/
declare function isString(object: any): boolean;
/**
* Test whether given object is a Date, or a String containing a Date
* @param {Date | String} object
* @return {Boolean} isDate
*/
declare function isDate(object: Date | string): boolean;
/**
* Create a UUID
* @return {string} uuid
*/
declare function randomUUID(): string;
/**
* Fill an object with a possibly partially defined other object.
*
* Only copies values for the properties already present in a.
* That means an object is not created on a property if only the b object has it.
*
* @param {object} a
* @param {object} b
* @param {boolean} [allowDeletion=false] if true, delete properties in a that are explicitly set to null in b
*/
declare function fillIfDefined(a: any, b: any, allowDeletion?: boolean): void;
/**
* Extend object a with the properties of object b or a series of objects
* Only properties with defined values are copied
* @param {Object} a
* @param {...Object} b
* @return {Object} a
*/
declare function extend(a: any, ...b: any[]): any;
/**
* Extend object a with selected properties of object b or a series of objects
* Only properties with defined values are copied
* @param {Array.<string>} props
* @param {Object} a
* @param {Object} b
* @return {Object} a
*/
declare function selectiveExtend(props: string[], a: any, b: any): any;
/**
* Extend object a with selected properties of object b.
* Only properties with defined values are copied.
*
* **Note:** Previous version of this routine implied that multiple source objects
* could be used; however, the implementation was **wrong**.
* Since multiple (>1) sources weren't used anywhere in the `vis.js` code,
* this has been removed
*
* @param {Array.<string>} props names of first-level properties to copy over
* @param {object} a target object
* @param {object} b source object
* @param {boolean} [allowDeletion=false] if true, delete property in a if explicitly set to null in b
* @returns {Object} a
*/
declare function selectiveDeepExtend(props: string[], a: any, b: any, allowDeletion?: boolean): any;
/**
* Extend object `a` with properties of object `b`, ignoring properties which are explicitly
* specified to be excluded.
*
* The properties of `b` are considered for copying.
* Properties which are themselves objects are are also extended.
* Only properties with defined values are copied
*
* @param {Array.<string>} propsToExclude names of properties which should *not* be copied
* @param {Object} a object to extend
* @param {Object} b object to take properties from for extension
* @param {boolean} [allowDeletion=false] if true, delete properties in a that are explicitly set to null in b
* @return {Object} a
*/
declare function selectiveNotDeepExtend(propsToExclude: string[], a: any, b: any, allowDeletion?: boolean): any;
/**
* Deep extend an object a with the properties of object b
*
* @param {Object} a
* @param {Object} b
* @param {boolean} [protoExtend=false] If true, the prototype values will also be extended.
* (ie. the options objects that inherit from others will also get the inherited options)
* @param {boolean} [allowDeletion=false] If true, the values of fields that are null will be deleted
* @returns {Object}
*/
declare function deepExtend(a: any, b: any, protoExtend?: boolean, allowDeletion?: boolean): any;
/**
* Test whether all elements in two arrays are equal.
* @param {Array} a
* @param {Array} b
* @return {boolean} Returns true if both arrays have the same length and same
* elements.
*/
declare function equalArray(a: Array, b: Array): boolean;
/**
* Convert an object to another type
* @param {boolean | number | string | Date | Moment | Null | undefined} object
* @param {string | undefined} type Name of the type. Available types:
* 'Boolean', 'Number', 'String',
* 'Date', 'Moment', ISODate', 'ASPDate'.
* @return {*} object
* @throws Error
*/
declare function convert(object: boolean | number | string | Date | Moment | null | undefined, type: string | undefined): any;
/**
* Get the type of an object, for example exports.getType([]) returns 'Array'
* @param {*} object
* @return {string} type
*/
declare function getType(object: any): string;
/**
* Used to extend an array and copy it. This is used to propagate paths recursively.
*
* @param {Array} arr
* @param {*} newValue
* @returns {Array}
*/
declare function copyAndExtendArray(arr: Array, newValue: any): Array;
/**
* Used to extend an array and copy it. This is used to propagate paths recursively.
*
* @param {Array} arr
* @returns {Array}
*/
declare function copyArray(arr: Array): Array;
/**
* Retrieve the absolute left value of a DOM element
* @param {Element} elem A dom element, for example a div
* @return {number} left The absolute left position of this element
* in the browser page.
*/
declare function getAbsoluteLeft(elem: Element): number;
/**
* Retrieve the absolute top value of a DOM element
* @param {Element} elem A dom element, for example a div
* @return {number} top The absolute top position of this element
* in the browser page.
*/
declare function getAbsoluteTop(elem: Element): number;
/**
* add a className to the given elements style
* @param {Element} elem
* @param {string} classNames
*/
declare function addClassName(elem: Element, classNames: string): void;
/**
* add a className to the given elements style
* @param {Element} elem
* @param {string} classNames
*/
declare function removeClassName(elem: Element, classNames: string): void;
/**
* For each method for both arrays and objects.
* In case of an array, the built-in Array.forEach() is applied. (**No, it's not!**)
* In case of an Object, the method loops over all properties of the object.
* @param {Object | Array} object An Object or Array
* @param {function} callback Callback method, called for each item in
* the object or array with three parameters:
* callback(value, index, object)
*/
declare function forEach(object: any | Array, callback: (...params: any[]) => any): void;
/**
* Convert an object into an array: all objects properties are put into the
* array. The resulting array is unordered.
* @param {Object} object
* @returns {Array} array
*/
declare function toArray(object: any): Array;
/**
* Update a property in an object
* @param {Object} object
* @param {string} key
* @param {*} value
* @return {Boolean} changed
*/
declare function updateProperty(object: any, key: string, value: any): boolean;
/**
* Throttle the given function to be only executed once per animation frame
* @param {function} fn
* @returns {function} Returns the throttled function
*/
declare function throttle(fn: (...params: any[]) => any): (...params: any[]) => any;
/**
* Add and event listener. Works for all browsers
* @param {Element} element An html element
* @param {string} action The action, for example "click",
* without the prefix "on"
* @param {function} listener The callback function to be executed
* @param {boolean} [useCapture]
*/
declare function addEventListener(element: Element, action: string, listener: (...params: any[]) => any, useCapture?: boolean): void;
/**
* Remove an event listener from an element
* @param {Element} element An html dom element
* @param {string} action The name of the event, for example "mousedown"
* @param {function} listener The listener function
* @param {boolean} [useCapture]
*/
declare function removeEventListener(element: Element, action: string, listener: (...params: any[]) => any, useCapture?: boolean): void;
/**
* Cancels the event if it is cancelable, without stopping further propagation of the event.
* @param {Event} event
*/
declare function preventDefault(event: Event): void;
/**
* Get HTML element which is the target of the event
* @param {Event} event
* @return {Element} target element
*/
declare function getTarget(event: Event): Element;
/**
* Check if given element contains given parent somewhere in the DOM tree
* @param {Element} element
* @param {Element} parent
* @returns {boolean}
*/
declare function hasParent(element: Element, parent: Element): boolean;
/**
* http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb
*
* @param {string} hex
* @returns {{r: *, g: *, b: *}} | 255 range
*/
declare function hexToRGB(hex: string): any;
/**
* This function takes color in hex format or rgb() or rgba() format and overrides the opacity. Returns rgba() string.
* @param {string} color
* @param {number} opacity
* @returns {String}
*/
declare function overrideOpacity(color: string, opacity: number): string;
/**
*
* @param {number} red 0 -- 255
* @param {number} green 0 -- 255
* @param {number} blue 0 -- 255
* @returns {String}
* @constructor
*/
declare class RGBToHex {
constructor(red: number, green: number, blue: number);
}
/**
* Parse a color property into an object with border, background, and
* highlight colors
* @param {Object | String} color
* @return {Object} colorObject
*/
declare function parseColor(color: any | string): any;
/**
* http://www.javascripter.net/faq/rgb2hsv.htm
*
* @param {number} red
* @param {number} green
* @param {number} blue
* @returns {{h: number, s: number, v: number}}
* @constructor
*/
declare class RGBToHSV {
constructor(red: number, green: number, blue: number);
}
/**
* Append a string with css styles to an element
* @param {Element} element
* @param {string} cssText
*/
declare function addCssText(element: Element, cssText: string): void;
/**
* Remove a string with css styles from an element
* @param {Element} element
* @param {string} cssText
*/
declare function removeCssText(element: Element, cssText: string): void;
/**
* https://gist.github.com/mjijackson/5311256
* @param {number} h
* @param {number} s
* @param {number} v
* @returns {{r: number, g: number, b: number}}
* @constructor
*/
declare class HSVToRGB {
constructor(h: number, s: number, v: number);
}
/**
* This recursively redirects the prototype of JSON objects to the referenceObject
* This is used for default options.
*
* @param {Array.<string>} fields
* @param {Object} referenceObject
* @returns {*}
*/
declare function selectiveBridgeObject(fields: string[], referenceObject: any): any;
/**
* This recursively redirects the prototype of JSON objects to the referenceObject
* This is used for default options.
*
* @param {Object} referenceObject
* @returns {*}
*/
declare function bridgeObject(referenceObject: any): any;
/**
* This method provides a stable sort implementation, very fast for presorted data
*
* @param {Array} a the array
* @param {function} compare an order comparator
* @returns {Array}
*/
declare function insertSort(a: Array, compare: (...params: any[]) => any): Array;
/**
* This is used to set the options of subobjects in the options object.
*
* A requirement of these subobjects is that they have an 'enabled' element
* which is optional for the user but mandatory for the program.
*
* The added value here of the merge is that option 'enabled' is set as required.
*
*
* @param {object} mergeTarget | either this.options or the options used for the groups.
* @param {object} options | options
* @param {string} option | option key in the options argument
* @param {object} globalOptions | global options, passed in to determine value of option 'enabled'
*/
declare function mergeOptions(mergeTarget: any, options: any, option: string, globalOptions: any): void;
So, some of this does not parse, because it is dependent on the quality of the jsdoc.
One way to have a long-term sustainable maintenance cycle might be to: 1) Correct the jsdoc annotations so that they generate proper typescript. 2) Require users who make interface changes to update their jsdocs annotations and run a 'ts-generate' step, and check in the new file. 3) Add a step to the build that generates the typescript, and compares it to what was checked in, to ensure no one manually edits the typescript file and that it is up to date.
Alternatively, we could use this as a starting point and maintain it manually from this point onwards. This may end up with higher quality typescript overall, as many contributors would understand the process and contribute to improve the ts defs, and may be able to help with tricky definitions that the tsd-jsdoc falls back to using any
for. However, I worry that we'll end up with stale jsdoc and stale ts defs.
very nice, thanks for running this and advancing the conversation.
Alternatively, we could use this as a starting point and maintain it manually from this point onwards.
I lean towards this approach: use all the information we have to make the best manually maintained native TypeScript type annotations we can
This issue looks stale - by chance has any progress been made?
@jamestharpe you are right it is stale.
It looks the successor project to this fork has a partial typescript conversion underway, which is pretty cool: https://github.com/visjs/vis-network/blob/master/lib/network/typedefs.js
I would recommend using their project: https://github.com/visjs/vis-network
I am using vis from Angular and a DefinitelyTyped package would help in using the network.