Skip to content

Commit

Permalink
Make interlines not add vertical space, see #5.
Browse files Browse the repository at this point in the history
Bring downstream the changes from
faustedition/faust-app/72125ed350bb95096bfa2f30f5c1809d2e579f3b
faustedition/faust-app/0f847e36c74108e1e362d99c6bc45a9f0396cdab
faustedition/faust-app/55106a04da7fdbd0f0e151fbe8f0f95ccc0e31d2
  • Loading branch information
wissenbach committed Dec 7, 2016
1 parent e7045b3 commit 93d03c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
7 changes: 6 additions & 1 deletion svg_rendering/page/js-gen/transcript-configuration-faust.js
Expand Up @@ -330,7 +330,12 @@ if(window.Faust === undefined) {

if (position.indexOf("between") >= 0) {
lineAttrs.between = true;
}
}

var type = node.data()["type"] || "";
if (type.indexOf("inter") >= 0) {
lineAttrs.interline = true;
}

var vc = new FaustTranscript.Line(lineAttrs);
vc.classes.push('lineNumber' + layoutState.lineCount);
Expand Down
28 changes: 21 additions & 7 deletions svg_rendering/page/js-gen/transcript.js
Expand Up @@ -258,19 +258,32 @@ if(window.FaustTranscript === undefined) {
FaustTranscript.Line.prototype.dimension = function() {
};

FaustTranscript.Line.prototype.previousNonIntermediateLine = function() {
if (this.pos == 1)
return this.parent.children[0];
if (this.parent == null || this.pos <= 0)
return null;
pre = this.parent.children[this.pos - 1];

if (typeof pre.lineAttrs !== 'undefined' && pre.lineAttrs['interline'] === true)
return pre.previousNonIntermediateLine();
else
return pre;
};

FaustTranscript.Line.prototype.defaultAligns = function () {

if ("indent" in this.lineAttrs) {
this.setAlign("hAlign", new FaustTranscript.Align(this, this.parent, this.rotX(), 0, this.lineAttrs["indent"], FaustTranscript.Align.INDENT_ATTR));
} else if ("indentCenter" in this.lineAttrs) {
this.setAlign("hAlign", new FaustTranscript.Align(this, this.parent, this.rotX(), 0, this.lineAttrs["indent"], FaustTranscript.Align.INDENT_ATTR));
} else if ("indentCenter" in this.lineAttrs) {
this.setAlign("hAlign", new FaustTranscript.Align(this, this.parent, this.rotX(), 0.5, this.lineAttrs["indentCenter"], FaustTranscript.Align.INDENT_CENTER_ATTR));
} else {
this.setAlign("hAlign", new FaustTranscript.Align(this, this.parent, this.rotX(), 0, 0, FaustTranscript.Align.IMPLICIT_BY_DOC_ORDER));
}
} else {
this.setAlign("hAlign", new FaustTranscript.Align(this, this.parent, this.rotX(), 0, 0, FaustTranscript.Align.IMPLICIT_BY_DOC_ORDER));
}


if (this.previous()) {
var yourJoint = 1.5;
var yourJoint = this.lineAttrs['interline'] ? 0.75 : 1.5;;
if (Faust.TranscriptConfiguration.overlay === "overlay") {
//yourJoint = ("between" in this.lineAttrs)? 1 : 1;
yourJoint = ("over" in this.lineAttrs)? 0.1 : yourJoint;
Expand All @@ -279,7 +292,8 @@ if(window.FaustTranscript === undefined) {
yourJoint = ("over" in this.lineAttrs)? 0.5 : yourJoint;
}

this.setAlign("vAlign", new FaustTranscript.Align(this, this.previous(), this.rotY(), 0, yourJoint, FaustTranscript.Align.IMPLICIT_BY_DOC_ORDER));
this.setAlign("vAlign", new FaustTranscript.Align(this, this.previousNonIntermediateLine(), this.rotY(), 0, yourJoint, FaustTranscript.Align.IMPLICIT_BY_DOC_ORDER));

} else {
this.setAlign("vAlign", new FaustTranscript.Align(this, this.parent, this.rotY(), 0, 0, FaustTranscript.Align.IMPLICIT_BY_DOC_ORDER));
}
Expand Down

0 comments on commit 93d03c4

Please sign in to comment.