Skip to main content

Hotkeys Plugins

Keyboard shortcuts for camera and nodes operations.

Overview

Flowscape SDK provides two hotkey plugins:

  • NodeHotkeysPlugin - shortcuts for node operations (copy, paste, delete, z-index)
  • CameraHotkeysPlugin - shortcuts for camera controls (zoom, pan)

Usage

import { CameraHotkeysPlugin, NodeHotkeysPlugin } from "@flowscape-ui/core-sdk";

const engine = new CoreEngine({
container,
plugins: [new CameraHotkeysPlugin(), new NodeHotkeysPlugin()],
});

NodeHotkeysPlugin

Provides keyboard shortcuts for node manipulation.

Clipboard Operations

ShortcutAction
Ctrl+CCopy selected nodes
Ctrl+XCut selected nodes
Ctrl+VPaste nodes

Node Management

ShortcutAction
Delete / BackspaceDelete selected nodes
Ctrl+]Move node up (increase z-index)
Ctrl+[Move node down (decrease z-index)

Example

import { NodeHotkeysPlugin } from "@flowscape-ui/core-sdk";

const engine = new CoreEngine({
container,
plugins: [new NodeHotkeysPlugin()],
});

// Create some nodes
const rect = engine.nodes.addShape({ x: 100, y: 100, width: 100, height: 100 });
const circle = engine.nodes.addCircle({ x: 200, y: 200, radius: 50 });

// Now you can:
// - Select nodes and press Ctrl+C to copy
// - Press Ctrl+V to paste
// - Press Delete to remove selected nodes
// - Press Ctrl+] to move node forward

CameraHotkeysPlugin

Provides keyboard shortcuts for camera navigation.

Zoom Controls

ShortcutAction
Ctrl+WheelZoom in/out at cursor position
+ / =Zoom in
-Zoom out

Pan Controls

ShortcutAction
Arrow KeysPan camera in direction
Middle Mouse+DragPan camera with mouse
Right Mouse+DragPan camera with mouse

Example

import { CameraHotkeysPlugin } from "@flowscape-ui/core-sdk";

const engine = new CoreEngine({
container,
plugins: [new CameraHotkeysPlugin()],
});

// Now you can:
// - Hold Ctrl and scroll to zoom
// - Press + or - to zoom in/out
// - Use arrow keys to pan
// - Hold Space and drag to pan

Combined Usage

For the best experience, use both plugins together:

import {
CoreEngine,
CameraHotkeysPlugin,
NodeHotkeysPlugin,
SelectionPlugin,
} from "@flowscape-ui/core-sdk";

const engine = new CoreEngine({
container,
plugins: [
new SelectionPlugin(), // Required for node selection
new NodeHotkeysPlugin(), // Node operations
new CameraHotkeysPlugin(), // Camera controls
],
});

Customization

Both plugins work out of the box with default settings. If you need custom hotkeys, you can create your own plugin by extending the Plugin class and listening to keyboard events through the event bus.