Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

toArray/fromArray fixes #7318

Merged
merged 3 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/core/math/vec2.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ class Vec2 {
/**
* Set the values of the vector from an array.
*
* @param {number[]} arr - The array to set the vector values from.
* @param {number[]|ArrayBufferView} arr - The array to set the vector values from.
* @param {number} [offset] - The zero-based index at which to start copying elements from the
* array. Default is 0.
* @returns {Vec2} Self for chaining.
Expand Down Expand Up @@ -677,13 +677,13 @@ class Vec2 {
/**
* Converts the vector to an array.
*
* @param {number[]} [arr] - The array to populate with the color components. If not specified,
* @param {number[]|ArrayBufferView} [arr] - The array to populate with the color components. If not specified,
* a new array is created.
* @param {number} [offset] - The zero-based index at which to start copying elements to the
* array. Default is 0.
* @returns {number[]} The vector as an array.
* @returns {number[]|ArrayBufferView} The vector as an array.
* @example
* const v = new pc.Vec3(20, 10);
* const v = new pc.Vec2(20, 10);
* // Outputs [20, 10]
* console.log(v.toArray());
*/
Expand Down
6 changes: 3 additions & 3 deletions src/core/math/vec3.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ class Vec3 {
/**
* Set the values of the vector from an array.
*
* @param {number[]} arr - The array to set the vector values from.
* @param {number[]|ArrayBufferView} arr - The array to set the vector values from.
* @param {number} [offset] - The zero-based index at which to start copying elements from the
* array. Default is 0.
* @returns {Vec3} Self for chaining.
Expand Down Expand Up @@ -695,11 +695,11 @@ class Vec3 {
/**
* Converts the vector to an array.
*
* @param {number[]} [arr] - The array to populate with the color components. If not specified,
* @param {number[]|ArrayBufferView} [arr] - The array to populate with the color components. If not specified,
* a new array is created.
* @param {number} [offset] - The zero-based index at which to start copying elements to the
* array. Default is 0.
* @returns {number[]} The vector as an array.
* @returns {number[]|ArrayBufferView} The vector as an array.
* @example
* const v = new pc.Vec3(20, 10, 5);
* // Outputs [20, 10, 5]
Expand Down
8 changes: 4 additions & 4 deletions src/core/math/vec4.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ class Vec4 {
/**
* Set the values of the vector from an array.
*
* @param {number[]} arr - The array to set the vector values from.
* @param {number[]|ArrayBufferView} arr - The array to set the vector values from.
* @param {number} [offset] - The zero-based index at which to start copying elements from the
* array. Default is 0.
* @returns {Vec4} Self for chaining.
Expand Down Expand Up @@ -659,13 +659,13 @@ class Vec4 {
/**
* Converts the vector to an array.
*
* @param {number[]} [arr] - The array to populate with the color components. If not specified,
* @param {number[]|ArrayBufferView} [arr] - The array to populate with the color components. If not specified,
* a new array is created.
* @param {number} [offset] - The zero-based index at which to start copying elements to the
* array. Default is 0.
* @returns {number[]} The vector as an array.
* @returns {number[]|ArrayBufferView} The vector as an array.
* @example
* const v = new pc.Vec3(20, 10, 5, 1);
* const v = new pc.Vec4(20, 10, 5, 1);
* // Outputs [20, 10, 5, 1]
* console.log(v.toArray());
*/
Expand Down