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

Drag Handle

Description

This example showcases how to add a DragHandle for nodes, allowing users to move them easily within Angular and Foblex Flow.

The fDragHandle directive can be applied to any HTML element inside a node fNode. It defines which part of the node should respond to drag gestures. This enables you to:

  • Make the entire node draggable
  • Limit dragging to a specific element like an icon, header, or image
  • Build flexible and intuitive drag behavior for custom UIs

How to Handle Position Changes

To track and persist node positions, you should handle the fNodePositionChange event emitted by each node. This event returns a new position of the node { x: number, y: number } whenever it is moved.

You can use this event to:

  • Save the new position to a model or store
  • Sync changes to a backend or local storage
  • Trigger layout adjustments or constraints

In addition, the fMoveNodes event emitted by <f-flow> is triggered whenever one or more nodes are moved, including single-node moves. It provides an array of updated nodes, each with its new position, making it ideal for:

  • Tracking bulk movements (e.g., group drag)
  • Implementing undo/redo systems
  • Managing external logic like snapping or alignment

Example

[component.html] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-handle/drag-handle.component.html [component.ts] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-handle/drag-handle.component.ts [component.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/nodes/drag-handle/drag-handle.component.scss [common.scss] <<< https://raw.githubusercontent.com/Foblex/f-flow/main/projects/f-examples/_flow-common.scss