@dsebastien/music-notation 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tab/index.js CHANGED
@@ -896,9 +896,16 @@ function splitUnbarred(measures, meter) {
896
896
  if (eighths <= perBar || m.width - m.pad < span * 1.5)
897
897
  return [m];
898
898
  const count = Math.floor((cols.at(-1) - m.pad) / span) + 1;
899
- return Array.from({ length: count }, (_, k) => {
900
- const from = m.pad + k * span;
901
- const beats = m.beats.filter((b) => (k === 0 || b.col >= from) && (k === count - 1 || b.col < from + span)).map((b) => ({ notes: b.notes, col: b.col - k * span }));
899
+ const pieces = Array.from({ length: count }, () => []);
900
+ for (const b of m.beats) {
901
+ let k = Math.min(count - 1, Math.max(0, Math.floor((b.col - m.pad) / span)));
902
+ while (k < count - 1 && b.col >= m.pad + (k + 1) * span)
903
+ k++;
904
+ while (k > 0 && b.col < m.pad + k * span)
905
+ k--;
906
+ pieces[k].push({ notes: b.notes, col: b.col - k * span });
907
+ }
908
+ return pieces.map((beats, k) => {
902
909
  return {
903
910
  beats,
904
911
  width: m.pad + span,
@@ -2079,5 +2086,5 @@ export {
2079
2086
  textTabToAlphaTex
2080
2087
  };
2081
2088
 
2082
- //# debugId=676F0DA21BF6D94464756E2164756E21
2089
+ //# debugId=7EA581924096D5C364756E2164756E21
2083
2090
  //# sourceMappingURL=index.js.map