npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

reactflow-better-bezier-edge

v1.0.3

Published

A ReactFlow Bezier Edge but with Offset

Downloads

28

Readme

REACTFLOW-BETTER-BEZIER-EDGE

npm version npm downloads MIT License   Donation

Are you suffering the default bezier curve goes into your marker?

If so, this is the solution for you.

after-before

All credits go to reactflow for the bezier curve calculation. I just made modifications to the original code to make it better.

Give me a ⭐ if you like it.

📦 Requirements

  • ReactFlow >= 11.0.0

🚀 Getting Started

Installation

npm install reactflow-better-bezier-edge

Usage Example

import { Position } from "reactflow";
import { getBetterBezierPath } from "reactflow-better-bezier-edge";

const [path, labelX, labelY, offsetX, offsetY] = getBetterBezierPath({
  sourceX: source.x,
  sourceY: source.y,
  sourcePosition: Position.Right,
  targetX: target.x,
  targetY: target.y,
  targetPosition: Position.Left,
  offset: 70,
});

📖 API Reference

Parameters

The parameters for the bezier curve. | Prop | Optional | Type | Default | Description | | --- | --- | --- | --- | --- | |sourceX|No|number| |The x-coordinate of the source node.| |sourceY|No|number| |The y-coordinate of the source node.| |sourcePosition|Yes|Position|Position.Bottom|The position of the source node.| |targetX|No|number| |The x-coordinate of the target node.| |targetY|No|number| |The y-coordinate of the target node.| |targetPosition|Yes|Position|Position.Top|The position of the target node.| |offset|Yes|number|0|The offset of the bezier curve.|

[NOTE]
Play around with the offset to get the best result.

Returns

| Array | Type | Description | | --- | --- | --- | |[0]|string|The path to use in an SVG element.| |[1]|number|The x position you can use to render a label for this edge.| |[2]|number|The y position you can use to render a label for this edge.| |[3]|number|The absolute difference between the source x position and the x position of the middle of this path.| |[4]|number|The absolute difference between the source y position and the y position of the middle of this path.|

You can reference to BezierEdge for more information.

🤝 Contributing

Contributions are welcome! If you find a bug , please open an issue. If you want to contribute code, please fork the repository and submit a pull request.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details

☕ Donation

Love it? Consider a donation to support my work.

"Donation" <- click me~