This repository was archived by the owner on Jul 26, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,16 @@ export function transform(
6262 fullImage,
6363 } = options ;
6464 let { width = image . width , height = image . height } = options ;
65+
66+ if ( ! isValidMatrix ( transformMatrix ) ) {
67+ throw new TypeError (
68+ `transformation matrix must be 2x3 or 3x3. Received ${ transformMatrix . length } x${ transformMatrix [ 1 ] . length } ` ,
69+ ) ;
70+ }
71+ if ( transformMatrix . length === 2 ) {
72+ transformMatrix . push ( [ 0 , 0 , 1 ] ) ;
73+ }
74+
6575 if ( fullImage ) {
6676 transformMatrix = transformMatrix . map ( ( row ) => row . slice ( ) ) ;
6777 transformMatrix [ 0 ] [ 2 ] = 0 ;
@@ -126,15 +136,6 @@ export function transform(
126136 height = Math . round ( height ) ;
127137 }
128138
129- if ( ! isValidMatrix ( transformMatrix ) ) {
130- throw new TypeError (
131- `transformation matrix must be 2x3 or 3x3. Received ${ transformMatrix . length } x${ transformMatrix [ 1 ] . length } ` ,
132- ) ;
133- }
134- if ( transformMatrix . length === 2 ) {
135- transformMatrix . push ( [ 0 , 0 , 1 ] ) ;
136- }
137-
138139 if ( ! options . inverse ) {
139140 transformMatrix = inverse ( new Matrix ( transformMatrix ) ) . to2DArray ( ) ;
140141 }
You can’t perform that action at this time.
0 commit comments