Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/component/marker/MarkerView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function updateZ(

if (markerModel && markerDraw && markerDraw.group) {
const { z, zlevel } = retrieveZInfo(markerModel);
traverseUpdateZ(markerDraw.group, z, zlevel);
traverseUpdateZ(markerDraw.group, z, zlevel, type === 'markLine' ? 0 : 2);
}
});
}
Expand Down
9 changes: 6 additions & 3 deletions src/util/graphic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -843,8 +843,9 @@ export function traverseUpdateZ(
el: Element,
z: number,
zlevel: number,
labelZ2Lift?: number
): void {
doUpdateZ(el, z, zlevel, -Infinity);
doUpdateZ(el, z, zlevel, -Infinity, labelZ2Lift == null ? 2 : labelZ2Lift);
}

function doUpdateZ(
Expand All @@ -855,6 +856,7 @@ function doUpdateZ(
// e.g. in graph, edge labels should be above node elements.
// Currently impl does not guarantee that.
maxZ2: number,
labelZ2Lift: number
): number {
// `ignoreModelZ` is used to intentionally lift elements to cover other elements,
// where maxZ2 (for label.z2) should also not be counted for its parents.
Expand All @@ -876,7 +878,8 @@ function doUpdateZ(
children[i],
z,
zlevel,
maxZ2
maxZ2,
labelZ2Lift
),
maxZ2
);
Expand All @@ -899,7 +902,7 @@ function doUpdateZ(
label.zlevel = zlevel;
// lift z2 of text content
// TODO if el.emphasis.z2 is spcefied, what about textContent.
isFinite(maxZ2) && (label.z2 = maxZ2 + 2);
isFinite(maxZ2) && (label.z2 = maxZ2 + labelZ2Lift);
}
if (labelLine) {
const textGuideLineConfig = el.textGuideLineConfig;
Expand Down
73 changes: 73 additions & 0 deletions test/marker-z-z2.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.