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 (Straight, Bezier, Step)
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 (Directed Graph)
ELKJS Layout (Directed Graph)
Drag Start/End Events
Custom Event Triggers
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

Edit this page on GitHub
In this article