abcjs 6.2.1 → 6.2.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.
@@ -211,6 +211,8 @@ var GuitarTablature = __webpack_require__(/*! ../tablatures/instruments/guitar/t
211
211
  // Existing tab classes
212
212
  var pluginTab = {
213
213
  'violin': 'ViolinTab',
214
+ 'fiddle': 'ViolinTab',
215
+ 'mandolin': 'ViolinTab',
214
216
  'guitar': 'GuitarTab'
215
217
  };
216
218
  var abcTablatures = {
@@ -16632,6 +16634,7 @@ TabRenderer.prototype.doLayout = function () {
16632
16634
  this.tabStaff.voices = [];
16633
16635
  for (var ii = 0; ii < nbVoices; ii++) {
16634
16636
  var tabVoice = new VoiceElement(0, 0);
16637
+ if (ii > 0) tabVoice.duplicate = true;
16635
16638
  var nameHeight = buildTabName(this, tabVoice) / spacing.STEP;
16636
16639
  nameHeight = Math.max(nameHeight, 1); // If there is no label for the tab line, then there needs to be a little padding
16637
16640
  staffGroup.staffs[this.staffIndex].top += nameHeight;
@@ -21565,14 +21568,20 @@ function printLine(renderer, x1, x2, y, klass, name, dy) {
21565
21568
  x2 = roundNumber(x2);
21566
21569
  var y1 = roundNumber(y - dy);
21567
21570
  var y2 = roundNumber(y + dy);
21568
- // TODO-PER: This fixes a firefox bug where a path needs to go over the 0.5 mark or it isn't displayed
21569
- if (renderer.firefox112 && dy < 1) {
21570
- var _int = Math.floor(y2);
21571
- var distToHalf = 0.52 - (y2 - _int);
21572
- if (distToHalf > 0) {
21573
- y1 += distToHalf;
21574
- y2 += distToHalf;
21575
- }
21571
+ // TODO-PER: This fixes a firefox bug where it isn't displayed
21572
+ if (renderer.firefox112) {
21573
+ y += dy / 2; // Because the y coordinate is the edge of where the line goes but the width widens from the middle.
21574
+ var attr = {
21575
+ x1: x1,
21576
+ x2: x2,
21577
+ y1: y,
21578
+ y2: y,
21579
+ stroke: renderer.foregroundColor,
21580
+ 'stroke-width': Math.abs(dy * 2)
21581
+ };
21582
+ if (klass) attr['class'] = klass;
21583
+ if (name) attr['data-name'] = name;
21584
+ return renderer.paper.lineToBack(attr);
21576
21585
  }
21577
21586
  var pathString = sprintf("M %f %f L %f %f L %f %f L %f %f z", x1, y1, x2, y1, x2, y2, x1, y2);
21578
21587
  var options = {
@@ -21623,15 +21632,20 @@ function printStem(renderer, x, dx, y1, y2, klass, name) {
21623
21632
  }
21624
21633
  x = roundNumber(x);
21625
21634
  var x2 = roundNumber(x + dx);
21626
- // TODO-PER: This fixes a firefox bug where a path needs to go over the 0.5 mark or it isn't displayed
21627
- if (renderer.firefox112 && Math.abs(dx) < 1) {
21628
- var higher = Math.max(x, x2);
21629
- var _int = Math.floor(higher);
21630
- var distToHalf = 0.52 - (higher - _int);
21631
- if (distToHalf > 0) {
21632
- x += distToHalf;
21633
- x2 += distToHalf;
21634
- }
21635
+ // TODO-PER: This fixes a firefox bug where it isn't displayed
21636
+ if (renderer.firefox112) {
21637
+ x += dx / 2; // Because the x coordinate is the edge of where the line goes but the width widens from the middle.
21638
+ var attr = {
21639
+ x1: x,
21640
+ x2: x,
21641
+ y1: y1,
21642
+ y2: y2,
21643
+ stroke: renderer.foregroundColor,
21644
+ 'stroke-width': Math.abs(dx)
21645
+ };
21646
+ if (klass) attr['class'] = klass;
21647
+ if (name) attr['data-name'] = name;
21648
+ return renderer.paper.lineToBack(attr);
21635
21649
  }
21636
21650
  var pathArray = [["M", x, y1], ["L", x, y2], ["L", x2, y2], ["L", x2, y1], ["z"]];
21637
21651
  var attr = {
@@ -23147,13 +23161,13 @@ EngraverController.prototype.engraveTune = function (abcTune, tuneNumber, lineOf
23147
23161
  this.selectables = ret.selectables;
23148
23162
  if (this.oneSvgPerLine) {
23149
23163
  var div = this.renderer.paper.svg.parentNode;
23150
- this.svgs = splitSvgIntoLines(div, abcTune.metaText.title, this.responsive);
23164
+ this.svgs = splitSvgIntoLines(this.renderer, div, abcTune.metaText.title, this.responsive);
23151
23165
  } else {
23152
23166
  this.svgs = [this.renderer.paper.svg];
23153
23167
  }
23154
23168
  setupSelection(this, this.svgs);
23155
23169
  };
23156
- function splitSvgIntoLines(output, title, responsive) {
23170
+ function splitSvgIntoLines(renderer, output, title, responsive) {
23157
23171
  // Each line is a top level <g> in the svg. To split it into separate
23158
23172
  // svgs iterate through each of those and put them in a new svg. Since
23159
23173
  // they are placed absolutely, the viewBox needs to be manipulated to
@@ -23183,7 +23197,9 @@ function splitSvgIntoLines(output, title, responsive) {
23183
23197
  svg.setAttribute("aria-label", fullTitle);
23184
23198
  if (responsive !== 'resize') svg.setAttribute("height", height);
23185
23199
  if (responsive === 'resize') svg.style.position = '';
23186
- svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + height);
23200
+ // TODO-PER: Hack! Not sure why this is needed.
23201
+ var viewBoxHeight = renderer.firefox112 ? height + 1 : height;
23202
+ svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + viewBoxHeight);
23187
23203
  svg.appendChild(style.cloneNode(true));
23188
23204
  var titleEl = document.createElement("title");
23189
23205
  titleEl.innerText = fullTitle;
@@ -25486,6 +25502,15 @@ Svg.prototype.pathToBack = function (attr) {
25486
25502
  this.prepend(el);
25487
25503
  return el;
25488
25504
  };
25505
+ Svg.prototype.lineToBack = function (attr) {
25506
+ var el = document.createElementNS(svgNS, 'line');
25507
+ var keys = Object.keys(attr);
25508
+ for (var i = 0; i < keys.length; i++) {
25509
+ el.setAttribute(keys[i], attr[keys[i]]);
25510
+ }
25511
+ this.prepend(el);
25512
+ return el;
25513
+ };
25489
25514
  Svg.prototype.append = function (el) {
25490
25515
  if (this.currentGroup.length > 0) this.currentGroup[0].appendChild(el);else this.svg.appendChild(el);
25491
25516
  };
@@ -25521,7 +25546,7 @@ module.exports = Svg;
25521
25546
  \********************/
25522
25547
  /***/ (function(module) {
25523
25548
 
25524
- var version = '6.2.1';
25549
+ var version = '6.2.2';
25525
25550
  module.exports = version;
25526
25551
 
25527
25552
  /***/ })