Skip to content

Commit

Permalink
work with missing rastrums
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan-Peter Voigt committed Oct 31, 2024
1 parent 50175fd commit f1c508e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tools/mei.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export async function initializeDiploTrans (filename, wzObj, surfaceId, appVersi
affectedStaves.forEach((obj, i) => {
if (i % systemcount === 0) {
if (sb && corresp) {
sb.setAttribute('corresp', ' '.join(corresp))
sb.setAttribute('corresp', corresp.join(' '))
}
corresp = []
sb = document.createElementNS('http://www.music-encoding.org/ns/mei', 'sb')
Expand Down Expand Up @@ -1199,7 +1199,8 @@ export const prepareDtForRendering = ({ dtDom, sourceDom }) => {

const rastrumID = sbZone.getAttribute('bw.rastrumIDs').split(' ')[staffN - 1]
const rastrum = layout.querySelector('rastrum[*|id="' + rastrumID + '"]')
const staffY = parseFloat(rastrum.getAttribute('system.topmar')) * factor
// TODO: if rastrum is null/undefined set to 0 ???
const staffY = rastrum ? parseFloat(rastrum.getAttribute('system.topmar')) * factor : 0
childZone.setAttribute('uly', staffY.toFixed(1))
}

Expand Down

0 comments on commit f1c508e

Please sign in to comment.