@types/leaflet-textpath
TypeScript icon, indicating that this package has built-in type declarations

1.2.5 • Public • Published

Installation

npm install --save @types/leaflet-textpath

Summary

This package contains type definitions for leaflet-textpath (https://github.com/makinacorpus/Leaflet.TextPath).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/leaflet-textpath.

index.d.ts

// Needed to access the leaflet module, to extend it.
import * as Leaflet from "leaflet";

// Needed to access JSX.IntrinsicElements.
import * as React from "react";

/*
 * Add new properties to existing types in the leaflet module.
 */
declare module "leaflet" {
    /**
     * <number> rotates the text by the specified angle, in degrees.
     * 'flip' rotates the text by 180 degrees.
     * 'perpendicular' rotates the text by 90 degrees.
     */
    type TextPathOrientation = "flip" | "perpendicular" | number;

    interface TextPathOptions {
        /**
         * Specifies if the text should be repeated along the polyline.
         * @default false
         */
        repeat?: boolean | undefined;
        /**
         * Centers the text according to the polyline's bounding box.
         * @default false
         */
        center?: boolean | undefined;
        /**
         * Show text below the path.
         * @default false
         */
        below?: boolean | undefined;
        /**
         * Set an offset to position text relative to the polyline.
         * @default 0
         */
        offset?: number | undefined;
        /**
         * Rotate text.
         * @default 0
         */
        orientation?: TextPathOrientation | undefined;
        /**
         * Object containing the attributes applied to the text tag.
         * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text#attributes
         * @default {}
         */
        attributes?: Record<string, string> | undefined;
    }

    interface Polyline {
        /**
         * Set the text to display over this Polyline.
         * @default null Represents no text.
         */
        setText: (text: string | null, options?: TextPathOptions) => void;
    }

    interface LayerGroup {
        /**
         * Set the text to display over the Polylines in this layer group.
         * @default null Represents no text.
         */
        setText: (text: string | null, options?: TextPathOptions) => void;
    }
}

Additional Details

Credits

These definitions were written by .

Readme

Keywords

none

Package Sidebar

Install

npm i @types/leaflet-textpath

Weekly Downloads

663

Version

1.2.5

License

MIT

Unpacked Size

6.62 kB

Total Files

5

Last publish

Collaborators

  • types