Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.42 KB

README.md

File metadata and controls

55 lines (40 loc) · 1.42 KB

Rete area plugin

Adds functionality to the are of a rete js project

Installation

Plugin install() arguments:

import AreaPlugin from 'rete-area-plugin';
function createEditor(container: HTMLElement) {
    var editor = new Rete.NodeEditor("[email protected]", container);
    editor.use(AreaPlugin, {
        background: true, 
        snap: true,
        scaleExtent: {
            min: 0.5,
            max: 1,
        },
        translateExtent: { 
            width: 5000, 
            height: 4000 
        }
    });
}

If background is set to true, a grid is displayed on the background behind nodes:

image alt

if snap is set to true, dragged elements will snap to grid

snap

scaleExtent sets the min/max scale of the background

snap

translateExtent sets the translation limits for width and height

snap

ZoomAt

the zoomAt() function sets the editor to start set the nodes in its viewpoint

import AreaPlugin from 'rete-area-plugin';
function createEditor(container: HTMLElement) {
    var editor = new Rete.NodeEditor("[email protected]", container);
    AreaPlugin.zoomAt(editor, editor.nodes);
}