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.
- package/README.md +3 -0
- package/RELEASE.md +15 -0
- package/dist/abcjs-basic-min.js +2 -2
- package/dist/abcjs-basic.js +46 -21
- package/dist/abcjs-basic.js.map +1 -1
- package/dist/abcjs-plugin-min.js +2 -2
- package/package.json +1 -1
- package/src/api/abc_tablatures.js +2 -0
- package/src/tablatures/tab-renderer.js +1 -0
- package/src/write/draw/print-line.js +16 -7
- package/src/write/draw/print-stem.js +16 -8
- package/src/write/engraver-controller.js +5 -3
- package/src/write/svg.js +10 -0
- package/types/index.d.ts +1 -1
- package/version.js +1 -1
package/package.json
CHANGED
|
@@ -227,6 +227,7 @@ TabRenderer.prototype.doLayout = function () {
|
|
|
227
227
|
this.tabStaff.voices = [];
|
|
228
228
|
for (var ii = 0; ii < nbVoices; ii++) {
|
|
229
229
|
var tabVoice = new VoiceElement(0, 0);
|
|
230
|
+
if (ii > 0) tabVoice.duplicate = true;
|
|
230
231
|
var nameHeight = buildTabName(this, tabVoice) / spacing.STEP;
|
|
231
232
|
nameHeight = Math.max(nameHeight, 1) // If there is no label for the tab line, then there needs to be a little padding
|
|
232
233
|
staffGroup.staffs[this.staffIndex].top += nameHeight;
|
|
@@ -7,14 +7,23 @@ function printLine(renderer, x1, x2, y, klass, name, dy) {
|
|
|
7
7
|
x2 = roundNumber(x2);
|
|
8
8
|
var y1 = roundNumber(y - dy);
|
|
9
9
|
var y2 = roundNumber(y + dy);
|
|
10
|
-
// TODO-PER: This fixes a firefox bug where
|
|
11
|
-
if (renderer.firefox112
|
|
12
|
-
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
// TODO-PER: This fixes a firefox bug where it isn't displayed
|
|
11
|
+
if (renderer.firefox112) {
|
|
12
|
+
y += dy / 2; // Because the y coordinate is the edge of where the line goes but the width widens from the middle.
|
|
13
|
+
var attr = {
|
|
14
|
+
x1: x1,
|
|
15
|
+
x2: x2,
|
|
16
|
+
y1: y,
|
|
17
|
+
y2: y,
|
|
18
|
+
stroke: renderer.foregroundColor,
|
|
19
|
+
'stroke-width': Math.abs(dy*2)
|
|
17
20
|
}
|
|
21
|
+
if (klass)
|
|
22
|
+
attr['class'] = klass;
|
|
23
|
+
if (name)
|
|
24
|
+
attr['data-name'] = name;
|
|
25
|
+
|
|
26
|
+
return renderer.paper.lineToBack(attr);
|
|
18
27
|
}
|
|
19
28
|
|
|
20
29
|
var pathString = sprintf("M %f %f L %f %f L %f %f L %f %f z", x1, y1, x2, y1,
|
|
@@ -12,15 +12,23 @@ function printStem(renderer, x, dx, y1, y2, klass, name) {
|
|
|
12
12
|
}
|
|
13
13
|
x = roundNumber(x);
|
|
14
14
|
var x2 = roundNumber(x + dx);
|
|
15
|
-
// TODO-PER: This fixes a firefox bug where
|
|
16
|
-
if (renderer.firefox112
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
// TODO-PER: This fixes a firefox bug where it isn't displayed
|
|
16
|
+
if (renderer.firefox112) {
|
|
17
|
+
x += dx / 2; // Because the x coordinate is the edge of where the line goes but the width widens from the middle.
|
|
18
|
+
var attr = {
|
|
19
|
+
x1: x,
|
|
20
|
+
x2: x,
|
|
21
|
+
y1: y1,
|
|
22
|
+
y2: y2,
|
|
23
|
+
stroke: renderer.foregroundColor,
|
|
24
|
+
'stroke-width': Math.abs(dx)
|
|
23
25
|
}
|
|
26
|
+
if (klass)
|
|
27
|
+
attr['class'] = klass;
|
|
28
|
+
if (name)
|
|
29
|
+
attr['data-name'] = name;
|
|
30
|
+
|
|
31
|
+
return renderer.paper.lineToBack(attr);
|
|
24
32
|
}
|
|
25
33
|
var pathArray = [["M", x, y1], ["L", x, y2], ["L", x2, y2], ["L", x2, y1], ["z"]];
|
|
26
34
|
var attr = { path: "" };
|
|
@@ -256,14 +256,14 @@ EngraverController.prototype.engraveTune = function (abcTune, tuneNumber, lineOf
|
|
|
256
256
|
|
|
257
257
|
if (this.oneSvgPerLine) {
|
|
258
258
|
var div = this.renderer.paper.svg.parentNode
|
|
259
|
-
this.svgs = splitSvgIntoLines(div, abcTune.metaText.title, this.responsive)
|
|
259
|
+
this.svgs = splitSvgIntoLines(this.renderer, div, abcTune.metaText.title, this.responsive)
|
|
260
260
|
} else {
|
|
261
261
|
this.svgs = [this.renderer.paper.svg];
|
|
262
262
|
}
|
|
263
263
|
setupSelection(this, this.svgs);
|
|
264
264
|
};
|
|
265
265
|
|
|
266
|
-
function splitSvgIntoLines(output, title, responsive) {
|
|
266
|
+
function splitSvgIntoLines(renderer, output, title, responsive) {
|
|
267
267
|
// Each line is a top level <g> in the svg. To split it into separate
|
|
268
268
|
// svgs iterate through each of those and put them in a new svg. Since
|
|
269
269
|
// they are placed absolutely, the viewBox needs to be manipulated to
|
|
@@ -297,7 +297,9 @@ function splitSvgIntoLines(output, title, responsive) {
|
|
|
297
297
|
svg.setAttribute("height", height)
|
|
298
298
|
if (responsive === 'resize')
|
|
299
299
|
svg.style.position = ''
|
|
300
|
-
|
|
300
|
+
// TODO-PER: Hack! Not sure why this is needed.
|
|
301
|
+
var viewBoxHeight = renderer.firefox112 ? height+1 : height
|
|
302
|
+
svg.setAttribute("viewBox", "0 " + nextTop + " " + width + " " + viewBoxHeight)
|
|
301
303
|
svg.appendChild(style.cloneNode(true))
|
|
302
304
|
var titleEl = document.createElement("title")
|
|
303
305
|
titleEl.innerText = fullTitle
|
package/src/write/svg.js
CHANGED
|
@@ -345,6 +345,16 @@ Svg.prototype.pathToBack = function (attr) {
|
|
|
345
345
|
return el;
|
|
346
346
|
};
|
|
347
347
|
|
|
348
|
+
Svg.prototype.lineToBack = function (attr) {
|
|
349
|
+
var el = document.createElementNS(svgNS, 'line');
|
|
350
|
+
var keys = Object.keys(attr)
|
|
351
|
+
for (var i = 0; i < keys.length; i++)
|
|
352
|
+
el.setAttribute(keys[i], attr[keys[i]]);
|
|
353
|
+
this.prepend(el);
|
|
354
|
+
return el;
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
|
|
348
358
|
Svg.prototype.append = function (el) {
|
|
349
359
|
if (this.currentGroup.length > 0)
|
|
350
360
|
this.currentGroup[0].appendChild(el);
|
package/types/index.d.ts
CHANGED
|
@@ -259,7 +259,7 @@ declare module 'abcjs' {
|
|
|
259
259
|
dragColor?: string;
|
|
260
260
|
dragging?: boolean;
|
|
261
261
|
foregroundColor?: string;
|
|
262
|
-
format?: { [attr in FormatAttributes]
|
|
262
|
+
format?: { [attr in FormatAttributes]?: any };
|
|
263
263
|
header_only?: boolean;
|
|
264
264
|
initialClef?: boolean;
|
|
265
265
|
jazzchords?: boolean;
|
package/version.js
CHANGED