Skip to content

sfe-efficy/area-plugin

 
 

Repository files navigation

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("demo@0.1.0", 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("demo@0.1.0", container);
    AreaPlugin.zoomAt(editor, editor.nodes);
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.1%
  • Sass 5.2%
  • JavaScript 4.7%