This repository was archived by the owner on Jul 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,8 @@ function createGitgraph(
211211 moveElement ( tag , x ) ;
212212
213213 // BBox width misses box padding and offset
214- // => they are set later, on branch label update.
215- // We would need to make branch label update happen before to solve it.
214+ // => they are set later, on tag update.
215+ // We would need to make tag update happen before to solve it.
216216 const offset = parseFloat ( tag . getAttribute ( "data-offset" ) || "0" ) ;
217217 const tagWidth = tag . getBBox ( ) . width + 2 * TAG_PADDING_X + offset ;
218218 x += tagWidth + padding ;
@@ -469,6 +469,12 @@ function createGitgraph(
469469 translate : { x : 0 , y : commit . style . dot . size } ,
470470 children : [ tagElement ] ,
471471 } ) ;
472+ // `data-offset` is used to position tag element in `positionCommitsElements`.
473+ // => because when it's executed, tag offsets are not resolved yet
474+ tagContainer . setAttribute (
475+ "data-offset" ,
476+ tag . style . pointerWidth . toString ( ) ,
477+ ) ;
472478
473479 setTagRef ( commit , tagContainer ) ;
474480
Original file line number Diff line number Diff line change @@ -20,9 +20,7 @@ function createTag(tag: Tag<SVGElement>): SVGGElement {
2020 } ) ;
2121
2222 const result = createG ( { children : [ path ] } ) ;
23- // Pass computed box width to gitgraph so it can adapt.
2423 const offset = tag . style . pointerWidth ;
25- result . setAttribute ( "data-offset" , offset . toString ( ) ) ;
2624
2725 const observer = new MutationObserver ( ( ) => {
2826 const { height, width } = text . getBBox ( ) ;
You can’t perform that action at this time.
0 commit comments