Skip to content

Click Action Handler

This callback is optional. You don’t need to implement anything for it and it doesn’t need to return anything to Common Canvas. It gets triggered each time the user performs a click, double-click or right-click action on an object in the flow editor or on the flow editor (canvas) background.

An example of where this might be useful might be to open a properties dialog when the user double-clicks a node.

clickActionHandler

    clickActionHandler(source)

The callback is called with a single source parameter which contains information about the object that was clicked.

Note: When handling selections, the selectionChangeHandler callback should be used in preference to this handler when possible. selectionChangeHandler will notify you of all selection changes regardless of how they occur, such as when the user presses Ctrl+A on the keyboard to select all objects.

The clickActionHandler is called for click, double-click and context-menu-click actions on nodes, comments, links and the canvas background. It is provided with one parameter that looks like this:

    {
      clickType: "DOUBLE_CLICK"
      id: "node_1",
      objectType: "node",
      selectedObjectIds: ["node_1", "node_2"]
    }
The fields can be:

  • clickType - This can be either “SINGLE_CLICK”, “SINGLE_CLICK_CONTEXTMENU” or “DOUBLE_CLICK”
  • objectType - Can be either “node”, “comment”, “link”, “canvas” or “region”. “region” is specified when the user pulls out a selection rectangle around a set of objects that might include nodes and comments.
  • id - The ID of the node, comment or link clicked. Only provided when objectType is “node”, “comment” or “link”.
  • selectedObjectIds - An array of the selected objects (after the click action was performed).

Note: “SINGLE_CLICK_CONTEXTMENU” indicates that the user performed a contextmenu gesture when doing the click such as pressing the right-side mouse button or a two finger tap on a trackpad.