Event Catalog
Every event the DrawingManager raises, with the interaction argument types
DrawingManager exposes sixteen public events so hosts can react to user interaction without polling. They fall into four groups: component, diagram, line and lifecycle events. All of them are raised on the UI thread during input processing.
Table of Contents
Component Events
Raised when the pointer interacts with a component. All four use ComponentInteractionEventArgs.
| Event | Raised when |
|---|---|
ComponentClicked | A component is single-clicked. |
ComponentDoubleClicked | A component is double-clicked (typical drill-down hook). |
ComponentRightClicked | A component is right-clicked (context-menu hook). |
ComponentHoverChanged | The pointer enters or leaves a component. |
Diagram Events
Raised when the pointer interacts with empty canvas space. They use DiagramInteractionEventArgs.
| Event | Raised when |
|---|---|
DiagramClicked | Empty canvas is clicked (selection-clear hook). |
DiagramDoubleClicked | Empty canvas is double-clicked. |
DiagramRightClicked | Empty canvas is right-clicked (canvas context menu). |
Line Events
Raised for connection lines. They use LineInteractionEventArgs, which carries the Line and an IsArrowClick flag so hosts can distinguish a click on the arrowhead from a click on the stroke.
| Event | Raised when |
|---|---|
LineClicked | A connection line is clicked. |
LineDoubleClicked | A connection line is double-clicked (label editing hook). |
LineRightClicked | A connection line is right-clicked. |
LineHoverChanged | The pointer enters or leaves a line. |
Lifecycle Events
| Event | Arguments | Raised when |
|---|---|---|
ComponentDropped | ComponentDropEventArgs | A component drag ends; carries canvas and screen positions plus final bounds. |
SelectionChanged | EventArgs | The selection set changes (select, add, clear, delete). |
HistoryChanged | EventArgs | An undoable action is pushed, undone or redone. |
SaveRequested | EventArgs | A save is requested through the manager (for example from a keyboard shortcut). |
DrawSurface | ConnectionEventArgs | A frame has been drawn; the host can paint overlays. |
Event Arguments
Interaction arguments share a common shape: positions in both canvas and screen space, the mouse button and key modifiers, an InteractionType, a settable Handled flag and a free Tag slot.
| Member | Available on | Description |
|---|---|---|
Component | Component args | The component involved in the interaction. |
Line | Line args | The connection line involved. |
CanvasPosition | All | Pointer position in world coordinates. |
ScreenPosition | All | Pointer position in screen coordinates. |
MouseButton | All | Button index that triggered the event. |
Modifiers | All | SKKeyModifiers active at the time. |
InteractionType | All | Which interaction produced the event (see below). |
IsArrowClick | Line args | True when the arrowhead was hit rather than the stroke. |
Handled | All | Set to true to mark the interaction consumed. |
Tag | All | Caller-defined payload. |
InteractionType
Click, DoubleClick, RightClick, MiddleClick, HoverEnter, HoverLeave, Hover, DragStart, Dragging, DragEnd.
Handling Pattern
// Drill down on double-click
drawingManager.ComponentDoubleClicked += (s, e) =>
{
if (e.Component is ProcessNode process)
{
e.Handled = true;
OpenDetail(process);
}
};
// Canvas context menu
drawingManager.DiagramRightClicked += (s, e) =>
{
ShowCanvasMenu(e.ScreenPosition);
};
// Edit a line label on double-click
drawingManager.LineDoubleClicked += (s, e) =>
{
if (e.IsArrowClick) return;
BeginLabelEdit(e.Line, e.ScreenPosition);
};
// Track undo availability in the UI
drawingManager.HistoryChanged += (s, e) =>
{
undoButton.Enabled = drawingManager.CanUndo;
redoButton.Enabled = drawingManager.CanRedo;
};
// React to drops (for example, snap-into-container logic)
drawingManager.ComponentDropped += (s, e) =>
{
if (e.Component is CardNode && !containerBounds.Contains(e.CanvasPosition))
e.Component.X = containerBounds.Left + 12;
};
The types under Beep.Skia.Events (ComponentClickEventArgs, DiagramClickEventArgs, LineClickEventArgs, HoverChangedEventArgs) are public but not raised by the manager; they exist as a simpler payload shape for host code. Use the interaction argument types above for manager events.