0.0.11 ā€¢ Published 2 years ago

fabric-guideline-plugin v0.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

fabric-guideline-plugin

šŸ¤© Help you easily append guidelines and auto-snap to your fabric.js canvas.

Features

  • šŸ˜ Easily append guidelines to your fabric.js canvas
  • šŸŽØ Automatically snap to nearby elements
  • šŸ¤– Automatically adjust the auto-snap threshold when the window is zoomed
  • šŸ› ļø Customize guidelines' style and other options
  • šŸ“¦ Zero dependencies

Example

See šŸ‘‰ CodeSandbox.

Quick Start

npm install fabric-guideline-plugin --save

After install, you can use it in your project.

import { AlignGuidelines } from "fabric-guideline-plugin";

Usage

import { fabric } from "fabric";
import { AlignGuidelines } from "fabric-guideline-plugin";

const fabricCanvas = new fabric.Canvas("myCanvas");

const guideline = new AlignGuidelines({
  canvas: fabricCanvas,
});

guideline.init();

You can also set some options to customize the guideline.

const guideline = new AlignGuidelines({
  canvas: fabricCanvas,
  pickObjTypes: [{ key: "myType", value: "box" }],
  aligningOptions: {
    lineColor: "#32D10A",
    lineWidth: 2,
    lineMargin: 2,
  },
});

Development

If you want to develop this plugin, you can easily start with the following steps:

$ git clone https://github.com/caijinyc/guideline.git
$ cd guideline
$ pnpm install
$ pnpm dev
0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago