2.0.2 • Published 3 months ago

rete-render-utils v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Rete.js Render utils

Made in Ukraine Discord

Rete.js utils

Key features

  • Basic connection paths: provides the classic and loop SVG paths
  • Sockets position: enables the calculation of socket positions
    • DOM-based: calculates the position of sockets using offsetTop/offsetLeft

Getting Started

Before using this package, make sure to install it as a peer and dev dependency into your the render plugin.

This package exposes getDOMSocketPosition, which is a SocketPositionWatcher type and used by default in render plugins.

import { getDOMSocketPosition } from 'rete-render-utils';

const socketsPositionWatcher = getDOMSocketPosition<Schemes, AreaExtra>(area)

socketPositionWatcher.attach(area)

const unwatch = positionWatcher.listen(nodeId, portSide, portKey, (position) => {
  /// called when the socket position changes
})

The render plugins also use its default implementations for rendering connection paths using classicConnectionPath and loopConnectionPath.

import { classicConnectionPath } from 'rete-render-utils';

const curvature = 0.3
const points = [sourcePoint, targetPoint] // should contain two points
const svgPath = classicConnectionPath(points, curvature)

Contribution

Please refer to the Contribution guide

License

MIT

2.0.2

3 months ago

2.0.0-beta.15

10 months ago

2.0.0-beta.14

10 months ago

2.0.0-beta.13

11 months ago

2.0.1

10 months ago

2.0.0

10 months ago

2.0.0-beta.12

12 months ago

2.0.0-beta.11

1 year ago

2.0.0-beta.10

1 year ago

2.0.0-beta.9

1 year ago

2.0.0-beta.8

1 year ago

2.0.0-beta.7

1 year ago

2.0.0-beta.6

1 year ago

2.0.0-beta.5

1 year ago

2.0.0-beta.4

1 year ago

2.0.0-beta.3

1 year ago

2.0.0-beta.2

1 year ago

2.0.0-beta.1

1 year ago