doubleClick property
Gets or sets the function to execute when the user double-primary-clicks on this object.
This typically involves a mouse-down/up/down/up in rapid succession
at approximately the same position using the left (primary) mouse button.
This property is used by the ClickSelectingTool
when the user clicks on a GraphObject.
The function is called in addition to the DiagramEvent
that is raised with the name "ObjectDoubleClicked"
.
If this property value is a function, it is called with an InputEvent and this GraphObject. The InputEvent#targetObject provides the GraphObject that was found at the mouse point before looking up the visual tree of GraphObject#panels to get to this object.
From the second argument, obj, you can get to the Node or Link via the #part property.
From there you can access the bound data via the Panel#data property.
So from an event handler you can get the bound data by obj.part.data
.
By default this property is null.
Objects in Layers that are Layer#isTemporary do not receive click events. If you do want such objects to respond to clicks, set #isActionable to true.
If you do provide a function that makes changes to the diagram or to its model, you should do so within a transaction -- call Diagram#startTransaction and Diagram#commitTransaction.
The Class Hierarchy sample demonstrates the definition of a double-click event handler that opens up a web page with the documentation for that class:
diagram.nodeTemplate =
$(go.Node, . . .,
{
doubleClick: // here the second argument is this object, which is this Node
(e, node) => { window.open("../api/symbols/" + node.data.key + ".html"); }
},
. . .
);
Implementation
void Function(
_i3.InputEvent,
_i3.GraphObject,
)? get doubleClick => (
_i3.InputEvent p0,
_i3.GraphObject p1,
) =>
_i4.callMethod(
_i4.getProperty(
this,
'doubleClick',
),
r'call',
[
this,
p0,
p1,
],
);
Implementation
set doubleClick(
void Function(
_i3.InputEvent,
_i3.GraphObject,
)? value) {
_i4.setProperty(
this,
'doubleClick',
value == null ? _i5.undefined : _i4.allowInterop(value),
);
}