mouseLeave property

(void Function(InputEvent, GraphObject, GraphObject)?) mouseLeave

Gets or sets the function to execute when the user moves the mouse out of this object without holding down any buttons. This property is used by the ToolManager.

If this property value is a function, it is called with an InputEvent, this GraphObject that the mouse has left, and any next GraphObject that the mouse is now in. 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. By default this property is null.

This function is called with Diagram#skipsUndoManager temporarily set to true, so that any changes to GraphObjects are not recorded in the UndoManager. You do not need to start and commit any transaction in this function. After calling this function the diagram will be updated immediately.

For example, the Flow Chart sample automatically shows and hides the ports as the mouse passes over a node. The node template includes the following settings:

myDiagram.nodeTemplate =
  $(go.Node,
    . . .
    {
      . . .
      // handle mouse enter/leave events to show/hide the ports
      mouseEnter: (e, obj) => showPorts(obj.part, true),
      mouseLeave: (e, obj) => showPorts(obj.part, false)
      . . .
    });

where the showPorts function is defined to set the #visible property of each of the port elements of the node.

Implementation

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

Implementation

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