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(
62
62
fullImage,
63
63
} = options ;
64
64
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
+
65
75
if ( fullImage ) {
66
76
transformMatrix = transformMatrix . map ( ( row ) => row . slice ( ) ) ;
67
77
transformMatrix [ 0 ] [ 2 ] = 0 ;
@@ -126,15 +136,6 @@ export function transform(
126
136
height = Math . round ( height ) ;
127
137
}
128
138
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
-
138
139
if ( ! options . inverse ) {
139
140
transformMatrix = inverse ( new Matrix ( transformMatrix ) ) . to2DArray ( ) ;
140
141
}
You can’t perform that action at this time.
0 commit comments