11import { Factory } from '../Factory' ;
2- import { Shape , ShapeConfig } from '../Shape' ;
32import { _registerNode } from '../Global' ;
3+ import { Shape , ShapeConfig } from '../Shape' ;
44
5- import { GetSet , PathSegment } from '../types' ;
65import {
76 getCubicArcLength ,
87 getQuadraticArcLength ,
98 t2length ,
109} from '../BezierFunctions' ;
10+ import { GetSet , PathSegment } from '../types' ;
1111
1212export interface PathConfig extends ShapeConfig {
1313 data ?: string ;
@@ -217,7 +217,7 @@ export class Path extends Shape<PathConfig> {
217217 * @example
218218 * var point = path.getPointAtLength(10);
219219 */
220- getPointAtLength ( length ) {
220+ getPointAtLength ( length : number ) {
221221 return Path . getPointAtLengthOfDataArray ( length , this . dataArray ) ;
222222 }
223223
@@ -370,26 +370,33 @@ export class Path extends Shape<PathConfig> {
370370 return { x : ix + adjustedRun , y : iy + adjustedRise } ;
371371 }
372372
373- static getPointOnCubicBezier ( pct , P1x , P1y , P2x , P2y , P3x , P3y , P4x , P4y ) {
374- function CB1 ( t ) {
373+ static getPointOnCubicBezier (
374+ pct : number ,
375+ P1x : number ,
376+ P1y : number ,
377+ P2x : number ,
378+ P2y : number ,
379+ P3x : number ,
380+ P3y : number ,
381+ P4x : number ,
382+ P4y : number
383+ ) {
384+ function CB1 ( t : number ) {
375385 return t * t * t ;
376386 }
377- function CB2 ( t ) {
387+ function CB2 ( t : number ) {
378388 return 3 * t * t * ( 1 - t ) ;
379389 }
380- function CB3 ( t ) {
390+ function CB3 ( t : number ) {
381391 return 3 * t * ( 1 - t ) * ( 1 - t ) ;
382392 }
383- function CB4 ( t ) {
393+ function CB4 ( t : number ) {
384394 return ( 1 - t ) * ( 1 - t ) * ( 1 - t ) ;
385395 }
386396 const x = P4x * CB1 ( pct ) + P3x * CB2 ( pct ) + P2x * CB3 ( pct ) + P1x * CB4 ( pct ) ;
387397 const y = P4y * CB1 ( pct ) + P3y * CB2 ( pct ) + P2y * CB3 ( pct ) + P1y * CB4 ( pct ) ;
388398
389- return {
390- x : x ,
391- y : y ,
392- } ;
399+ return { x, y } ;
393400 }
394401 static getPointOnQuadraticBezier ( pct , P1x , P1y , P2x , P2y , P3x , P3y ) {
395402 function QB1 ( t ) {
@@ -404,10 +411,7 @@ export class Path extends Shape<PathConfig> {
404411 const x = P3x * QB1 ( pct ) + P2x * QB2 ( pct ) + P1x * QB3 ( pct ) ;
405412 const y = P3y * QB1 ( pct ) + P2y * QB2 ( pct ) + P1y * QB3 ( pct ) ;
406413
407- return {
408- x : x ,
409- y : y ,
410- } ;
414+ return { x, y } ;
411415 }
412416 static getPointOnEllipticalArc (
413417 cx : number ,
@@ -854,15 +858,15 @@ export class Path extends Shape<PathConfig> {
854858 return 0 ;
855859 }
856860 static convertEndpointToCenterParameterization (
857- x1 ,
858- y1 ,
859- x2 ,
860- y2 ,
861- fa ,
862- fs ,
863- rx ,
864- ry ,
865- psiDeg
861+ x1 : number ,
862+ y1 : number ,
863+ x2 : number ,
864+ y2 : number ,
865+ fa : number ,
866+ fs : number ,
867+ rx : number ,
868+ ry : number ,
869+ psiDeg : number
866870 ) {
867871 // Derived from: http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
868872 const psi = psiDeg * ( Math . PI / 180.0 ) ;
0 commit comments