Skip to content

Commit 9393751

Browse files
authored
Fix dimension assignment in createVector function
1 parent 34eecd8 commit 9393751

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/math/math.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ function math(p5, fn) {
109109
'Calling createVector() with no arguments is deprecated and will be removed in a future release. Pass zeros for the desired dimensionality.'
110110
);
111111
}
112-
112+
this.dimension = arguments.length;
113113
const safeArgs =
114-
arguments.length === 1 ? [x ?? 0, 0, 0]
115-
: arguments.length === 2 ? [x ?? 0, y ?? 0, 0]
114+
arguments.length === 1 ? [x, 0, 0]
115+
: arguments.length === 2 ? [x, y, 0]
116116
: [...arguments];
117117

118118
if (this instanceof p5) {

0 commit comments

Comments
 (0)