Foblex Flow
Introduction
Overview
Nodes
Custom Nodes
Drag Handle
Node Selection
Resize Handle
Rotate Handle
Grouping
Updated
Drag to Group
Updated
Stress Test
Stress Test with Connections
Connectors
Node as Connector
Connector Inside Node
Connector Outlet
Limiting Connections
Connectability Check
Connectable Side
Connections
Drag to Connect
Drag to Reassign
Updated
Create Node on Connection Drop
Remove Connection on Drop
Assign Node to Connection on Drop
Auto Snap
Connection Types
Custom Connection Type
Connection Behaviours
Connection Markers
Connection Text
Connection Center
Custom Connections
Extensions
Add Node from Palette
Selection Area
Help in Positioning
Grid System
Minimap
Zoom
Background
Advanced
Cut/Copy/Paste
New
Undo/Redo
Undo/Redo V2
New
Dagre Layout
ELKJS Layout
Drag Start/End Events
Custom Event Triggers
Pro Examples
Visual Programming
DB Management
UML Diagram
Tournament Bracket
Foblex Flow

Custom Event Triggers

Description

This example demonstrates how to set up custom event triggers to handle drag operations.

To add a custom trigger, you need to create a function that accepts a parameter of type FTriggerEvent and returns a boolean. Below is an example of a trigger for zooming that requires holding the Ctrl key:

Next, you need to set this function to the appropriate attribute, as shown in the example below:

In this example, three custom triggers are defined:

  1. fWheelTrigger: Zooming is activated by the mouse wheel, but only when the Ctrl key is held.

  2. fNodeMoveTrigger: Dragging is activated by the mouse, but only when the Shift key is held.

  3. fCreateConnectionTrigger: Creating a connection between nodes is only possible when the F key is held.

But you can define custom triggers for any event that the flow supports:

fZoom: fWheelTrigger, fDblClickTrigger;

fDraggable: fReassignConnectionTrigger, fCreateConnectionTrigger, fNodeResizeTrigger, fNodeMoveTrigger, fCanvasMoveTrigger, fExternalItemTrigger, fMultiSelectTrigger;

f-selection-area: fTrigger;

Example

[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/custom-event-triggers/custom-event-triggers.component.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/custom-event-triggers/custom-event-triggers.component.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/advanced/custom-event-triggers/custom-event-triggers.component.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss