abcjs 6.1.1 → 6.1.2
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/README.md +1 -1
- package/RELEASE.md +7 -0
- package/abcjs-audio.css +1 -0
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +10 -6
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/package.json +1 -1
- package/src/write/abc_engraver_controller.js +13 -5
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -249,14 +249,14 @@ EngraverController.prototype.engraveTune = function (abcTune, tuneNumber, lineOf
|
|
|
249
249
|
|
|
250
250
|
if (this.oneSvgPerLine) {
|
|
251
251
|
var div = this.renderer.paper.svg.parentNode
|
|
252
|
-
this.svgs = splitSvgIntoLines(div, abcTune.metaText.title)
|
|
252
|
+
this.svgs = splitSvgIntoLines(div, abcTune.metaText.title, this.responsive)
|
|
253
253
|
} else {
|
|
254
254
|
this.svgs = [this.renderer.paper.svg];
|
|
255
255
|
}
|
|
256
256
|
setupSelection(this, this.svgs);
|
|
257
257
|
};
|
|
258
258
|
|
|
259
|
-
function splitSvgIntoLines(output, title) {
|
|
259
|
+
function splitSvgIntoLines(output, title, responsive) {
|
|
260
260
|
// Each line is a top level <g> in the svg. To split it into separate
|
|
261
261
|
// svgs iterate through each of those and put them in a new svg. Since
|
|
262
262
|
// they are placed absolutely, the viewBox needs to be manipulated to
|
|
@@ -265,8 +265,10 @@ function splitSvgIntoLines(output, title) {
|
|
|
265
265
|
// since we want that to include a count. And the height is now a fraction of the original svg.
|
|
266
266
|
if (!title) title = "Untitled"
|
|
267
267
|
var source = output.querySelector("svg")
|
|
268
|
+
if (responsive === 'resize')
|
|
269
|
+
output.style.paddingBottom = ''
|
|
268
270
|
var style = source.querySelector("style")
|
|
269
|
-
var width = source.getAttribute("width")
|
|
271
|
+
var width = responsive === 'resize' ? source.viewBox.baseVal.width : source.getAttribute("width")
|
|
270
272
|
var sections = output.querySelectorAll("svg > g") // each section is a line, or the top matter or the bottom matter, or text that has been inserted.
|
|
271
273
|
var nextTop = 0 // There are often gaps between the elements for spacing, so the actual top and height needs to be inferred.
|
|
272
274
|
var wrappers = [] // Create all the elements and place them at once because we use the current svg to get data. It would disappear after placing the first line.
|
|
@@ -277,11 +279,17 @@ function splitSvgIntoLines(output, title) {
|
|
|
277
279
|
var gapBetweenLines = box.y - nextTop // take the margin into account
|
|
278
280
|
var height = box.height + gapBetweenLines;
|
|
279
281
|
var wrapper = document.createElement("div");
|
|
280
|
-
|
|
282
|
+
var divStyles = "overflow: hidden;"
|
|
283
|
+
if (responsive !== 'resize')
|
|
284
|
+
divStyles += "height:"+height+"px;"
|
|
285
|
+
wrapper.setAttribute("style", divStyles)
|
|
281
286
|
var svg = duplicateSvg(source)
|
|
282
287
|
var fullTitle = "Sheet Music for \"" + title + "\" section " + (i+1)
|
|
283
288
|
svg.setAttribute("aria-label", fullTitle)
|
|
284
|
-
|
|
289
|
+
if (responsive !== 'resize')
|
|
290
|
+
svg.setAttribute("height", height)
|
|
291
|
+
if (responsive === 'resize')
|
|
292
|
+
svg.style.position = ''
|
|
285
293
|
svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + height )
|
|
286
294
|
svg.appendChild(style.cloneNode(true))
|
|
287
295
|
var titleEl = document.createElement("title")
|
package/version.js
CHANGED