Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@doodle3d/fill-path

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@doodle3d/fill-path

Vector based fill tool (like floodfill)

  • 1.0.7
  • latest
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

Fill Path

Vector based fill tool (like floodfill) build with Clipper

Usage

Include fillPath in your project. fillPath accepts two arguments, paths and point.

fillPath( Paths, Point, [ { LineWidth = 1.0, Scale = 10.0, MiterLimit = 2.0, FillOffset = 'center' } ] );

Paths = [...[...Point];
Point = { x: Number, y: Number };

LineWidth = Float;
Scale = Float;
MiterLimit = Float;
FillOffset = String;

Note: the Point argument gets rounded because Clipper needs IntPoint for polygon collision.

Include fill-path

Using JSPM

import fillPath from 'Doodle3D/fill-path';

Using NPM

const fillPath = require('fill-path');

Example code

const paths = [rect(0, 0, 30, 30), rect(10, 10, 10, 10)];
const result = fillPath(paths, { x: 5, y: 5 });

// result = [ [
//   { x: 1, y: 1 },
//   { x: 1, y: 29 },
//   { x: 29, y: 29 },
//   { x: 29, y: 1 }
// ], [
//   { x: 21, y: 10 },
//   { x: 21, y: 20 },
//   { x: 20, y: 21 },
//   { x: 10, y: 21 },
//   { x: 9, y: 20 },
//   { x: 9, y: 10 },
//   { x: 10, y: 10 },
//   { x: 10, y: 9 },
//   { x: 20, y: 9 }
// ] ]

function rect(x, y, w, h) {
  return [
    { x, y },
    { x: w + x, y },
    { x: w + x, y: h + y },
    { x, y: h + y },
    { x, y }
  ];
}

Installation

Using NPM

npm install fill-path

using JSPM

jspm install github:Doodle3D/fill-path

Clone Project

git clone git@github.com:Doodle3D/fill-path.git
cd fill-path
npm install
jspm install

Test

npm run test

Example

npm run example

Keywords

FAQs

Package last updated on 24 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc