Fixes fit so it works after a chop or slice (#1171)
* fix fit so it works after a chop or slice * format
This commit is contained in:
parent
39006e4d71
commit
263c13c36e
1 changed files with 8 additions and 5 deletions
|
|
@ -2957,11 +2957,14 @@ export const { loopAt, loopat } = register(['loopAt', 'loopat'], function (facto
|
||||||
export const fit = register('fit', (pat) =>
|
export const fit = register('fit', (pat) =>
|
||||||
pat.withHaps((haps, state) =>
|
pat.withHaps((haps, state) =>
|
||||||
haps.map((hap) =>
|
haps.map((hap) =>
|
||||||
hap.withValue((v) => ({
|
hap.withValue((v) => {
|
||||||
...v,
|
const slicedur = ('end' in v ? v.end : 1) - ('begin' in v ? v.begin : 0);
|
||||||
speed: (state.controls._cps || 1) / hap.whole.duration,
|
return {
|
||||||
unit: 'c',
|
...v,
|
||||||
})),
|
speed: ((state.controls._cps || 1) / hap.whole.duration) * slicedur,
|
||||||
|
unit: 'c',
|
||||||
|
};
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue