Newer
Older
pixi.js / packages / graphics / src / styles / LineStyle.js
import FillStyle from './FillStyle';

/**
 * Represents the line style for Graphics.
 * @memberof PIXI
 * @class
 * @extends PIXI.FillStyle
 */
export default class LineStyle extends FillStyle
{
    /**
     * Convert the object to JSON
     *
     * @return {object}
     */
    toJSON()
    {
        return {
            color: this.color,
            alpha: this.alpha,
            texture: this.texture,
            matrix: this.matrix,
            visible: this.visible,
            width: this.width,
            alignment: this.alignment,
            native: this.native,
        };
    }

    /**
     * Reset the line style to default.
     */
    reset()
    {
        super.reset();

        // Override default line style color
        this.color = 0x0;

        /**
         * The width (thickness) of any lines drawn.
         *
         * @member {number}
         * @default 0
         */
        this.width = 0;

        /**
         * The alignment of any lines drawn (0.5 = middle, 1 = outter, 0 = inner).
         *
         * @member {number}
         * @default 0
         */
        this.alignment = 0.5;

        /**
         * If true the lines will be draw using LINES instead of TRIANGLE_STRIP
         *
         * @member {boolean}
         * @default false
         */
        this.native = false;
    }
}