Skip to content

Commit

Permalink
fix curveset
Browse files Browse the repository at this point in the history
  • Loading branch information
slimbuck committed Aug 11, 2023
1 parent 1b66d6a commit 25a6993
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/ArrayInput/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,12 @@ class ArrayInput extends Element implements IFocusable, IBindable {
if (!array) {
array = new Array(size);
for (let i = 0; i < size; i++) {
array[i] = utils.deepCopy(ArrayInput.DEFAULTS[this._valueType as keyof typeof ArrayInput.DEFAULTS]);
if (defaultValue === undefined) initDefaultValue();
array[i] = utils.deepCopy(defaultValue);
}
} else if (array.length < size) {
const newArray = new Array(size - array.length);
for (let i = 0; i < newArray.length; i++) {
newArray[i] = utils.deepCopy(ArrayInput.DEFAULTS[this._valueType as keyof typeof ArrayInput.DEFAULTS]);
if (defaultValue === undefined) initDefaultValue();
newArray[i] = utils.deepCopy(defaultValue);
}
Expand All @@ -279,7 +277,6 @@ class ArrayInput extends Element implements IFocusable, IBindable {
if (!values.length) {
const array = new Array(size);
for (let i = 0; i < size; i++) {
array[i] = utils.deepCopy(ArrayInput.DEFAULTS[this._valueType as keyof typeof ArrayInput.DEFAULTS]);
if (defaultValue === undefined) initDefaultValue();
array[i] = utils.deepCopy(defaultValue);
}
Expand Down Expand Up @@ -396,7 +393,12 @@ class ArrayInput extends Element implements IFocusable, IBindable {
// Set the value to the same row of every array in values.
this._values.forEach((array) => {
if (array && array.length > index) {
array[index] = value;
if (this._valueType === 'curveset') {
// curveset is passing the value in an array
array[index] = value ? value[0] : value;
} else {
array[index] = value;
}
}
});

Expand Down

0 comments on commit 25a6993

Please sign in to comment.