jonobr1 / two.js

A renderer agnostic two-dimensional drawing api for the web.
https://two.js.org
MIT License
8.27k stars 454 forks source link

wrong type in getPointAT declaration in path class #692

Open alfredo-valero opened 1 year ago

alfredo-valero commented 1 year ago

In types.d.t , the method getPointAT is declarated with 2 params t as boolean and obj as any, when t should be a number (float)

/**
         * @name Two.Path#getPointAt
         * @function
         * @param {Boolean} t - Percentage value describing where on the {@link Two.Path} to estimate and assign coordinate values.
         * @param {Two.Vector} [object] - Object to apply calculated x, y to. If none available returns new `Object`.
         * @returns {Object}
         * @description Given a float `t` from 0 to 1, return a point or assign a passed `obj`'s coordinates to that percentage on this {@link Two.Path}'s curve.
         */
        getPointAt(t: boolean, obj: any): any;

==>

/**
         * @name Two.Path#getPointAt
         * @function
         * @param {number} t - Percentage value describing where on the {@link Two.Path} to estimate and assign coordinate values.
         * @param {Two.Vector} [object] - Object to apply calculated x, y to. If none available returns new `Object`.
         * @returns {Object}
         * @description Given a float `t` from 0 to 1, return a point or assign a passed `obj`'s coordinates to that percentage on this {@link Two.Path}'s curve.
         */
        getPointAt(t: number, obj: any): any;

Congratulations on your great work!

jonobr1 commented 1 year ago

Which version of Two.js are you using? The latest dev branch actually already has this fixed.

jonobr1 commented 1 year ago

This PR improves it a bit too. Thanks for sharing: https://github.com/jonobr1/two.js/pull/694