@types/svg-path-bounding-box
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Installation

npm install --save @types/svg-path-bounding-box

Summary

This package contains type definitions for svg-path-bounding-box (https://github.com/icons8/svg-path-bounding-box).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/svg-path-bounding-box.

index.d.ts

export = svgPathBoundingBox;

declare function svgPathBoundingBox(
    path: string,
): svgPathBoundingBox.BoundingBoxView;

declare namespace svgPathBoundingBox {
    /**
     * pass in initial points if you want
     * @see https://github.com/gabelerner/canvg/blob/860e418aca67b9a41e858a223d74d375793ec364/canvg.js#L449
     */
    class BoundingBox {
        x1: number;
        y1: number;
        x2: number;
        y2: number;

        constructor(x1: number, y1: number, x2: number, y2: number);

        width(): number;

        height(): number;

        addPoint(x: number, y: number): void;

        addX(x: number): void;

        addY(y: number): void;

        addQuadraticCurve(
            p0x: number,
            p0y: number,
            p1x: number,
            p1y: number,
            p2x: number,
            p2y: number,
        ): void;

        /** @see http://blog.hackers-cafe.net/2009/06/how-to-calculate-bezier-curves-bounding.html */
        addBezierCurve(
            p0x: number,
            p0y: number,
            p1x: number,
            p1y: number,
            p2x: number,
            p2y: number,
            p3x: number,
            p3y: number,
        ): void;
    }

    class BoundingBoxView {
        x1: number;
        y1: number;
        x2: number;
        y2: number;
        minX: number;
        minY: number;
        maxX: number;
        maxY: number;
        width: number;
        height: number;

        constructor(boundingBox: BoundingBox);

        round(precision?: number): this;

        scale(scale?: number): this;

        toString(): string;
    }

    class Path {
        d: string;

        constructor(d: string);

        getBoundingBox(): BoundingBoxView;
    }
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: none

Credits

These definitions were written by Tiger Oakes.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/svg-path-bounding-box

Weekly Downloads

220

Version

1.0.2

License

MIT

Unpacked Size

6.12 kB

Total Files

5

Last publish

Collaborators

  • types