@@ -13,7 +13,7 @@ import Bar from '../models/bar';
1313import Part from '../models/part' ;
1414import Tune from '../models/tune' ;
1515
16- import { getKeys , getVexDuration , addDecorations , getTabPosition } from '../utils' ;
16+ import { getKeys , getVexDuration , addDecorations , getTabPosition , generateBeamsCompound } from '../utils' ;
1717import { VEX_ACCIDENTAL_FROM_ABCJS } from '../constants' ;
1818
1919/**
@@ -163,6 +163,36 @@ export default function generateVexObjects(partRegions, tuneAttrs, renderOptions
163163 tabNoteToAdd . addModifier ( tabGraceNoteGroup ) ;
164164 }
165165
166+ obj . pitches . forEach ( ( pitch ) => {
167+ if ( pitch . startTie ) {
168+ currentPart . curves . push ( {
169+ startNote : noteToAdd
170+ } ) ;
171+ }
172+ if ( pitch . endTie ) {
173+ currentPart . curves [ currentPart . curves . length - 1 ] . endNote = noteToAdd ;
174+ }
175+ if ( pitch . startSlur ) {
176+ pitch . startSlur . forEach ( ( ) => {
177+ currentPart . curves . push ( {
178+ startNote : noteToAdd
179+ } ) ;
180+ } ) ;
181+ }
182+ if ( pitch . endSlur ) {
183+ pitch . endSlur . forEach ( ( ) => {
184+ let i = currentPart . curves . length - 1 ;
185+ while ( i >= 0 ) {
186+ if ( ! currentPart . curves [ i ] . endNote ) {
187+ currentPart . curves [ i ] . endNote = noteToAdd ;
188+ return ;
189+ }
190+ i += - 1 ;
191+ }
192+ } ) ;
193+ }
194+ } ) ;
195+
166196 currentBar . tabNotes . push ( tabNoteToAdd ) ;
167197 } else { // IS a rest
168198 noteToAdd = new StaveNote ( {
@@ -198,7 +228,7 @@ export default function generateVexObjects(partRegions, tuneAttrs, renderOptions
198228 if ( obj . endTriplet && inTriplet ) {
199229 currentBar . tuplets . push ( new Tuplet ( inTriplet . notes , {
200230 num_notes : inTriplet . num_notes ,
201- notes_occupied : inTriplet . notes_occupied ,
231+ notes_occupied : inTriplet . notes_occupied
202232 } ) ) ;
203233 // I think still need to create tuplets for the tabNotes so they align correctly,
204234 // but don't want to draw them because it's already drawn in the regular stave
@@ -210,17 +240,21 @@ export default function generateVexObjects(partRegions, tuneAttrs, renderOptions
210240 }
211241 } ) ; // end of barRegion.contents.forEach
212242
243+ const { meter } = tune . tuneAttrs ;
244+
213245 // set the voice so setBarPositions can use it to have VexFlow Formatter figure out the space needed
214- const meterArray = tune . tuneAttrs . meter . split ( '/' ) ;
246+ const meterArray = meter . split ( '/' ) ;
215247 const voice = new Voice ( { num_beats : meterArray [ 0 ] , beat_value : meterArray [ 1 ] } ) ;
216248 voice . setStrict ( false ) ;
217249 voice . addTickables ( currentBar . notes ) ;
218250 currentBar . voice = voice ;
219251
220- if ( tuneAttrs . meter === '4/4' ) {
252+ if ( meter === '4/4' ) {
221253 currentBar . beams = Beam . generateBeams ( currentBar . notes , { groups : [ new Vex . Flow . Fraction ( 2 , 4 ) ] } ) ;
254+ } else if ( meter === '3/8' || meter === '6/8' || meter === '9/8' || meter === '12/8' ) {
255+ currentBar . beams = generateBeamsCompound ( currentBar . notes ) ;
222256 } else {
223- currentBar . beams = Beam . generateBeams ( currentBar . notes , { groups : Beam . getDefaultBeamGroups ( tuneAttrs . meter ) } ) ;
257+ currentBar . beams = Beam . generateBeams ( currentBar . notes , { groups : Beam . getDefaultBeamGroups ( meter ) } ) ;
224258 }
225259 } ) ;
226260 } ) ;
0 commit comments