-
Notifications
You must be signed in to change notification settings - Fork 0
Special Types
This document describes the types available to plugins with special meaning to the editor such as label, color, etc. Any code samples in this document use TypeScript conventions.
Most types have a straight forward mapping to programming language types, but some such as color are less intuitive.
Points correspond to the following interface
interface Point {
x: number;
y: number;
}
Style is one of the following strings:
- solid
- dotted
- dashed
Width may either be a number for precise control or one of the following strings:
- thin
- medium
- thick
- parents(edge[]): Edges pointing to this node.
- children(edge[]): Edges pointing away from this node.
- label(string): Name associated with the node.
- color(color): Color of the node.
- position(point): Physical position of the node.
- shape(shape): Display shape of the node.
- image(string): A relative path to an image from the plugin directory for display if node.shape == "image". This image should be an SVG graphic.
- anchorPoints(point[]): A list of coordinates according to the image (i.e. not the graph coordinates, but from the SVG instead) which can have edges drawn to and from.
- borderColor(color): Color of the border around the node.
- borderStyle(style): The type of border around a node (such as dotted or straight).
- borderWidth(width): The width of the border around the node.
- source(node): Source node of this edge.
- destination(node): Destination node of this edge.
- label(string): Name associated with the edge.
- color(color): Color of the edge.
- lineStyle(style): Style of line to draw such as dotted or straight.
- lineWidth(width): Width of line to draw between the source and destination.
- showSourceArrow(boolean): If true, display arrow pointing towards source (you generally don't want to do this). Default false.
- showDestinationArrow(boolean): If true, display arrow pointing towards destination (this is much more common than the previous option). Default true.
- nodes(node[]): All nodes in the graph.
- edges(edge[]): All edges in the graph.
Properties such as source/destination can often be inferred for a plugin and need not be specified directly by the plugin, though the specific type specified by the plugin for these properties may be used to prevent connecting an edge between certain nodes.
class InputNode {
}
class OutputNode {
}
class GeneralNode {
}
class Edge {
source: InputNode | GeneralNode;
destination: OutputNode | GeneralNode;
}
For instance, in the above example, there can not be a node going from an OutputNode to an InputNode.
See plugin.ts for more information.