Skip to content

@fabwcie/free-drawing / components/toolbar/widgets/PathShapeWidget / scalePath

Function: scalePath() ​

scalePath(path, width, height): string

Defined in: packages/free-drawing/src/components/toolbar/widgets/PathShapeWidget.ts:12

Svg path of a box of width and height 1 (absolute commands of points: M, L, C, Z) scaled to a box

Parameters ​

path ​

string

Svg path of the box of size 1, numbers are x and y of points in turn

width ​

number

Width of the box to fill

height ​

number

Height of the box to fill

Returns ​

string

Path with x multiplied by width and y by height, rounded to 2 decimals