Nationwide Polamorous Matrimony

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

    1.5.2 • Public • Published

    Installation

    npm install --save @types/canvas-fit

    Summary

    This package contains type definitions for canvas-fit (https://github.com/hughsk/canvas-fit).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/canvas-fit.

    index.d.ts

    // Type definitions for canvas-fit 1.5
    // Project: https://github.com/hughsk/canvas-fit
    // Definitions by: Piotr Błażejewicz <https://github.com/peterblazejewicz>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    /**
     * Creates a resize function for your canvas element. Calling this function will resize the canvas to fit its parent element.
     */
    declare function fit(
        canvas: HTMLCanvasElement | SVGElement,
        parent?: EventTarget | Document | HTMLElement,
        scale?: string | number,
    ): resize;
    
    interface resize {
        (this: any, ev: any): any;
        /**
         * Dynamically change the canvas' target scale.
         * Note that you still need to manually trigger a resize after doing this.
         */
        scale: number;
        /**
         * Dynamically change the canvas' target scale.
         * Note that you still need to manually trigger a resize after doing this.
         * Instead of filling a given element, explicitly set the width and height of the canvas.
         * Note that this value will still be scaled up according to resize.scale
         */
        parent?: Element | (() => [number, number]) | undefined;
    }
    
    /**
     * Small module for fitting a canvas element within the bounds of its parent.
     * Useful, for example, for making a canvas fill the screen. Works with SVG elements too!
     */
    export = fit;

    Additional Details

    • Last updated: Thu, 08 Jul 2021 00:35:50 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Piotr Błażejewicz.

    Keywords

    none

    Install

    npm i @types/canvas-fit

    DownloadsWeekly Downloads

    110

    Version

    1.5.2

    License

    MIT

    Unpacked Size

    5.23 kB

    Total Files

    4

    Last publish

    Collaborators

    • types