positionContextMenu method

void positionContextMenu(
  1. Adornment contextmenu, [
  2. GraphObject? obj
])

This is called by #showContextMenu to position the context menu within the viewport. It normally goes just below the cursor. But if the mouse is too close to the right edge or the bottom edge of the viewport, it is positioned left and/or above the cursor.

This method only operates if the context menu, an Adornment, does not have a Adornment#placeholder. When there is a Placeholder in the context menu, that Adornment is automatically positioned so that the Placeholder is positioned at the adorned object, the second argument to this method.

This method may be overridden. Please read the Introduction page on Extensions for how to override methods and how to call this base method.

If you override this method to position the context menu, the context menu has already been measured but not arranged, so you can use its GraphObject#measuredBounds width and height but not its GraphObject#actualBounds. @expose @param {Adornment} contextmenu @param {GraphObject} obj The GraphObject getting the context menu, or null if the context menu is for the diagram background.

Implementation

void positionContextMenu(
  _i3.Adornment contextmenu, [
  _i3.GraphObject? obj,
]) {
  _i4.callMethod(
    this,
    'positionContextMenu',
    [
      contextmenu,
      obj ?? _i5.undefined,
    ],
  );
}