contextClick property

void Function(InputEvent, GraphObject)? get contextClick

Gets or sets the function to execute when the user single-secondary-clicks on this object. This typically involves a mouse-down followed by a prompt mouse-up at approximately the same position using the right (secondary) 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 "ObjectContextClicked".

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.

Implementation

void Function(
  _i3.InputEvent,
  _i3.GraphObject,
)? get contextClick => (
      _i3.InputEvent p0,
      _i3.GraphObject p1,
    ) =>
        _i4.callMethod(
          _i4.getProperty(
            this,
            'contextClick',
          ),
          r'call',
          [
            this,
            p0,
            p1,
          ],
        );
set contextClick (void value(InputEvent, GraphObject)?)

Implementation

set contextClick(
    void Function(
      _i3.InputEvent,
      _i3.GraphObject,
    )? value) {
  _i4.setProperty(
    this,
    'contextClick',
    value == null ? _i5.undefined : _i4.allowInterop(value),
  );
}