Flow chart control GoJS built-in GraphObject class index introduction (2)

GoJS is a powerful, fast and lightweight flowchart control that can help you create flowcharts in JavaScript and HTML5 Canvas programs, and greatly simplify your JavaScript / Canvas programs.

Download the latest version of GoJS【Huidu.com】

Background click: function (é: InputEvent, thisObj: GraphObject): void| null

Gets or sets the function to be executed when the user clicks the object. Usually, this requires moving the mouse down, and then using the right mouse button (auxiliary) to quickly move the mouse up at approximately the same position. When the user clicks the GraphObject, ClickSelectingTool uses this property. In addition to the DiagramEvent triggered by name, the culprit is also called. "ObjectContextClicked"

If this attribute value is a function, use InputEvent and this GraphObject to call. The InputEvent.targetObject stipulates that GraphObject GraphObject.panel s are found before the mouse clicks on the visual tree to obtain this object.

From the second parameter obj, you can reach Node or Link through the part attribute. From there, you can access the bound data through the Panel.data property. Therefore, you can obtain the binding data obj.part.data from the event handler.

By default, this attribute is null.

The objects in the Layer of Layer.isTemporary do not receive click events. If you really want such objects to respond to clicks, please set isActionable to true.

If it does provide a function that can change the diagram or its model, this should be done within a transaction-call Diagram.startTransaction and Diagram.commitTransaction.

Context menu: Adornment | HTMLInfo | null

When the context is clicked on this object, this decoration or HTMLInfo will be displayed. The default value is null, which means that the context menu is not displayed.

Changing this value will not modify or delete any existing menus displayed for this object.

The context menu may also depend on the same data binding as the decorated part (ie, the value of Panel.data is the same).

The context menu is not copied by copy, so the context menu can be shared by all instances of the template.

A typical context menu is implemented as a decoration with multiple buttons. For example, this context menu is defined in the "dynamic port" example:
var nodeMenu = // context menu for each Node
$("ContextMenu",
$("ContextMenuButton",
$(go.TextBlock, "Add top port"),
{ click: function(e, obj) {addPort("top");} }),
$("ContextMenuButton",
$(go.TextBlock, "Add left port"),
{click: function(e, obj) {addPort ("left");} }),
$("ContextMenuButton",
$(go.TextBlock, "Add right port"),
{click: function(e, obj) {addPort("right");} }),
$("ContextMenuButton",
$(go.TextBlock, "Add bottom port"),
{click: function(e, obj) {addPort("bottom");} }));




contextMenu: nodeMenu
},
.. .); The
context menu is usually positioned by ContextMenuTool.positionContextMenu. However, if there is a placeholder in the context menu, the context menu (that is, decoration) will be placed so that the placeholder is in the same position as the decorated GraphObject.
This basic sample also shows how to invalidate commands that are not visible when the context menu item is present.

Replacing this value will not modify or delete any existing context menu displayed for this object.

Learn more about context menus in "Context Menu".

Cursor: string

Gets or sets the mouse cursor used when the mouse hovers over this object and the mouse button is not pressed. If no specific cursor is specified for this object, the value is null; the actual cursor is determined by any cursor containing Panel.

The default value is an empty string, which means that the current mouse cursor is determined by the chart. The other strings should be valid CSS strings specifying the cursor. This provides more information about cursor syntax: CSS cursors (mozilla.org).

Required size

Gets or sets the desired size (in local coordinates) of this GraphObject. The value must be of type Size. The default value is Size (NaN, NaN). You cannot modify the width or height of this attribute value-if you want to change the desired size, you must set this attribute to another size.

Getting or setting the width or height is equivalent to getting or setting the width or height of this property.

This size does not include any transformation due to scale or angle, nor any pen thickness due to Shape.strokeWidth (if this is Shape). If there is a panel containing a panel, the panel will determine the actual size. If the desired size is larger than the allowable size determined by the GraphObject panel, the GraphObject may be visually clipped. If the expected size does not meet the minSize and maxSize constraints, the GraphObject size will be adjusted to meet them.

Read only diagram: Diagram | null

This read-only property returns the Diagram where this GraphObject is located (if it exists).

This attribute cannot be set. Although you cannot add any ordinary GraphObject to the diagram, you can call Diagram.add to add components to the diagram.

Double click: function (é: InputEvent, thisObj: GraphObject): void| null

Gets or sets the function to be executed when the user double-clicks the object. Usually, this involves using the left mouse button (primary button) to move the mouse down/down/up/down/up in rapid succession at roughly the same position. When the user clicks the GraphObject, ClickSelectingTool uses this property. In addition to the DiagramEvent triggered by name, this function is also called. "ObjectDoubleClicked"

If this attribute value is a function, use InputEvent and this GraphObject to call. The InputEvent.targetObject stipulates that GraphObject GraphObject.panel s are found before the mouse clicks on the visual tree to obtain this object.

From the second parameter obj, you can reach Node or Link through the part attribute. From there, you can access the bound data through the Panel.data property. Therefore, you can obtain the binding data obj.part.data from the event handler.

By default, this attribute is null.

The objects in the Layer of Layer.isTemporary do not receive click events. If you really want such objects to respond to clicks, please set isActionable to true.

If it does provide a function that can change the diagram or its model, this should be done within a transaction-call Diagram.startTransaction and Diagram.commitTransaction.

This hierarchy class sample shows that the definition of the double-click event handler for this type of document webpage is opened:
diagram.nodeTemplate =
$(go.Node,.. .,
{
doubleClick: // here the second argument is this object, which is this Node
function(e, node) {window.open("../api/symbols/" + node.data.key + ".html");}
},
...
);
Enable changes: function(thisObj: GraphObject, enabled: boolean): void | null

Gets or sets the function, which is executed when some Panel.isEnabled changes in the value of Panel. It is usually used to modify the appearance of an object. This function must not change the value of Panel.isEnabled for any panel.

If this property value is a function, call it with two parameters (this GraphObject and the new value). By default, this property is null-no function is called.

fromEndSegmentLength:number

Gets or sets the length of the first segment of the link from this port. This value will be used when the calculated "from spot" is not Spot.None. The default value is 10. This value also limits the time that Link.fromShortLength can be drawn.

When determining the route of the link, the value of Link.fromEndSegmentLength (if not NaN) takes precedence over the value on this port.

For an example of how to use this attribute, see "Link End Length".

Unless the entire Node acts as a single port, this attribute must be set on the GraphObject whose portId is not null. In this case, this attribute should be set on the Node.

fromLinkable : boolean | null

Gets or sets whether the user can draw links from this port. LinkingBaseTool.isValidFrom uses this property.

The default value is null, which means that the actual value is inherited from the parent Panel; if the parent panel is not included, it is false.

You must set this property on GraphObject whose port ID is not null, unless the entire Node acts as a single port, in which case this property should be set on Node, or unless you disable the "linkability" of a specific object Panel The GraphObject in the fromLinkable has been set or bound to true.

From linkable duplicates: Boolean

Gets or sets whether the user can draw duplicate links from this port. LinkingBaseTool.isValidLink uses this property. The default value is false.

Unless the entire Node acts as a single port, this attribute must be set on the GraphObject whose portId is not null. In this case, this attribute should be set on the Node.

From linkable self node: Boolean

Gets or sets whether the user can draw the link connected from the Node of this port. LinkingBaseTool.isValidLink uses this property. The default value is false.

Unless the entire Node acts as a single port, this attribute must be set on the GraphObject whose portId is not null. In this case, this attribute should be set on the Node.

If you want to purchase a genuine GoJS license, or for more product information, please [Consult Huidu Online Customer Service]

Guess you like

Origin blog.51cto.com/15078157/2605730