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.
@@ -22118,7 +22118,7 @@ EngraverController.prototype.engraveTune = function (abcTune, tuneNumber, lineOf
22118
22118
 
22119
22119
  if (this.oneSvgPerLine) {
22120
22120
  var div = this.renderer.paper.svg.parentNode;
22121
- this.svgs = splitSvgIntoLines(div, abcTune.metaText.title);
22121
+ this.svgs = splitSvgIntoLines(div, abcTune.metaText.title, this.responsive);
22122
22122
  } else {
22123
22123
  this.svgs = [this.renderer.paper.svg];
22124
22124
  }
@@ -22126,7 +22126,7 @@ EngraverController.prototype.engraveTune = function (abcTune, tuneNumber, lineOf
22126
22126
  setupSelection(this, this.svgs);
22127
22127
  };
22128
22128
 
22129
- function splitSvgIntoLines(output, title) {
22129
+ function splitSvgIntoLines(output, title, responsive) {
22130
22130
  // Each line is a top level <g> in the svg. To split it into separate
22131
22131
  // svgs iterate through each of those and put them in a new svg. Since
22132
22132
  // they are placed absolutely, the viewBox needs to be manipulated to
@@ -22135,8 +22135,9 @@ function splitSvgIntoLines(output, title) {
22135
22135
  // since we want that to include a count. And the height is now a fraction of the original svg.
22136
22136
  if (!title) title = "Untitled";
22137
22137
  var source = output.querySelector("svg");
22138
+ if (responsive === 'resize') output.style.paddingBottom = '';
22138
22139
  var style = source.querySelector("style");
22139
- var width = source.getAttribute("width");
22140
+ var width = responsive === 'resize' ? source.viewBox.baseVal.width : source.getAttribute("width");
22140
22141
  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.
22141
22142
 
22142
22143
  var nextTop = 0; // There are often gaps between the elements for spacing, so the actual top and height needs to be inferred.
@@ -22152,11 +22153,14 @@ function splitSvgIntoLines(output, title) {
22152
22153
 
22153
22154
  var height = box.height + gapBetweenLines;
22154
22155
  var wrapper = document.createElement("div");
22155
- wrapper.setAttribute("style", "overflow: hidden;height:" + height + "px;");
22156
+ var divStyles = "overflow: hidden;";
22157
+ if (responsive !== 'resize') divStyles += "height:" + height + "px;";
22158
+ wrapper.setAttribute("style", divStyles);
22156
22159
  var svg = duplicateSvg(source);
22157
22160
  var fullTitle = "Sheet Music for \"" + title + "\" section " + (i + 1);
22158
22161
  svg.setAttribute("aria-label", fullTitle);
22159
- svg.setAttribute("height", height);
22162
+ if (responsive !== 'resize') svg.setAttribute("height", height);
22163
+ if (responsive === 'resize') svg.style.position = '';
22160
22164
  svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + height);
22161
22165
  svg.appendChild(style.cloneNode(true));
22162
22166
  var titleEl = document.createElement("title");
@@ -29147,7 +29151,7 @@ module.exports = unhighlight;
29147
29151
  \********************/
29148
29152
  /***/ (function(module) {
29149
29153
 
29150
- var version = '6.1.1';
29154
+ var version = '6.1.2';
29151
29155
  module.exports = version;
29152
29156
 
29153
29157
  /***/ })