improve treeview inlining

This commit is contained in:
Thibault Duplessis 2017-01-24 14:02:49 +01:00
parent 1563744da3
commit 5744661323
2 changed files with 25 additions and 15 deletions

View file

@ -1314,17 +1314,24 @@ body.piece_letter .tview2 move {
margin-bottom: 0;
}
.tview2 inline {
display: inline-block;
display: inline;
font-style: italic;
font-size: 0.9em;
opacity: 0.8;
}
.tview2 inline::before,
.tview2 inline::after {
vertical-align: 0.4em;
opacity: 0.7;
font-size: 0.9em;
}
.tview2 inline::before {
vertical-align: top;
content: '(';
margin-left: 3px;
margin-left: 2px;
}
.tview2 inline::after {
vertical-align: top;
content: ')';
margin-right: 3px;
margin-right: 2px;
}
.tview2 .conceal {
opacity: 0.4;

View file

@ -99,16 +99,19 @@ function renderChildrenOf(ctx, node, opts) {
}
function renderInlined(ctx, nodes, opts) {
if (nodes[1] && !nodes[2] && !treeOps.hasBranching(nodes[1], 4)) {
var n = nodes[0];
return renderMoveAndChildrenOf(ctx, n, {
parentPath: opts.parentPath,
isMainline: false,
noConceal: opts.noConceal,
truncate: n.comp && !pathContains(ctx, opts.parentPath + n.id) ? 3 : null,
inline: nodes[1]
});
}
if (!nodes[1] || nodes[2]) return;
var found;
if (!treeOps.hasBranching(nodes[1], 4)) found = [0, 1];
else if (!treeOps.hasBranching(nodes[0], 4)) found = [1, 0];
if (!found) return;
var node = nodes[found[0]];
var alt = nodes[found[1]];
return renderMoveAndChildrenOf(ctx, node, {
parentPath: opts.parentPath,
isMainline: false,
noConceal: opts.noConceal,
inline: alt
});
}
function renderLines(ctx, nodes, opts) {